RTX - 51 Objectives  Resources needed  Architecture  Components of RTX-51 - Task - Memory pools - Mail box - Signals.

Slides:



Advertisements
Similar presentations
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Advertisements

Real-Time Library: RTX
Development of Real Time Kernel Master of Technology In EMBEDDED SYSTEM SCHOOL OF ELECTRONICS DEVI AHILYA VISWAVIDYALAYA INDORE. April 2010 Guided by -
The Process Control Block From: A Process Control Block (PCB, also called Task Control Block or Task Struct) is.
Real-Time Kernels and Operating Systems Basic Issue - Purchase commercial “off-the- shelf” system or custom build one Basic Functions –Task scheduling.
Process Description and Control
Process Description and Control Chapter 3. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
CSE Fall Introduction - 1 What is an Embedded Systems  Its not a desktop system  Fixed or semi-fixed functionality (not user programmable)
1 Process Description and Control Chapter 3. 2 Process Management—Fundamental task of an OS The OS is responsible for: Allocation of resources to processes.
CSCE 351: Operating System Kernels
OS Spring’03 Introduction Operating Systems Spring 2003.
CSSE Operating Systems
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Process Description and Control A process is sometimes called a task, it is a program in execution.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Embedded ‘C’.  It is a ‘mid-level’, with ‘high-level’ features (such as support for functions and modules), and ‘low-level’ features (such as good access.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Real Time Operating System
Introduction to Embedded Systems
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
Real-Time Kernel (Part 1)
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Processes and Threads CS550 Operating Systems. Processes and Threads These exist only at execution time They have fast state changes -> in memory and.
2-1 The critical section –A piece of code which cannot be interrupted during execution Cases of critical sections –Modifying a block of memory shared by.
Multiprocessor and Real-Time Scheduling Chapter 10.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
CE Operating Systems Lecture 11 Windows – Object manager and process management.
Overview Task State Diagram Task Priority Idle Hook AND Co-Routines
1 Review of Process Mechanisms. 2 Scheduling: Policy and Mechanism Scheduling policy answers the question: Which process/thread, among all those ready.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
ECGR-6185 µC/OS II Nayana Rao University of North Carolina at Charlotte.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
MicroC/OS-II S O T R.  MicroC/OS-II (commonly termed as µC/OS- II or uC/OS-II), is the acronym for Micro-Controller Operating Systems Version 2.  It.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
CS 390 Unix Programming Environment
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Operating Systems CMPSC 473 Signals, Introduction to mutual exclusion September 28, Lecture 9 Instructor: Bhuvan Urgaonkar.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
1 Lecture 19: Unix signals and Terminal management n what is a signal n signal handling u kernel u user n signal generation n signal example usage n terminal.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Processes and threads.
Process concept.
Topics Covered What is Real Time Operating System (RTOS)
Protection of System Resources
Chapter 3 – Process Concepts
Interrupts In 8085 and 8086.
Real-time Software Design
Operating Systems CPU Scheduling.
Structure of Processes
Computer System Overview
System Structure and Process Model
Process & its States Lecture 5.
Process Description and Control
Process Description and Control
Threads Chapter 4.
Multiprocessor and Real-Time Scheduling
Process Control B.Ramamurthy 2/22/2019 B.Ramamurthy.
Process Description and Control
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Process Description and Control in Unix
Process Description and Control in Unix
Presentation transcript:

RTX - 51

Objectives  Resources needed  Architecture  Components of RTX-51 - Task - Memory pools - Mail box - Signals

Resources Needed RTX - 51 requires the following 8051 system resources: Code memory: - Approx. 6 to 8 KB of memory. Internal (Data & IData) RAM: - 40 to 46 bytes for system data to 200 bytes for stack. - Register bank 0 for standard tasks. - Register banks 1,2,3 for fast tasks.

System ISRs Application ISRs Application Tasks System Tasks Architecture Of RTX 51 Scheduler Int. Handler Dispatcher Kernel

External (XDATA) RAM: - Minimum of 450 bytes. Timer 0 or 1 for system clock.

Components of RTX - 51 Task Management Memory Management * Memory pools Intertask Communication * Mail-Box Intertask Synchronization * Signals * Semaphores

Scheduler Dispatcher Task Management

* Scheduler Task Classification Standard Tasks Fast Tasks

Task Classes : 1) Standard tasks: - More time for task switching. - Share common stack and register bank. - Register bank 0. - Interrupted by fast tasks. - Interrupt themselves mutually. - Contains context area in external memory - Maximum of 16 standard tasks. - Priorities 0,1,2.

. 2) Fast tasks: - Short responses. - Contains separate register bank and stack area. - Register banks 1,2,3 - Contains highest priority(3) & can therefore interrupt standard tasks. - Cannot mutually interrupt. - Maximum of 3 fast tasks can be active in system.

Scheduling Algorithms 1) Cooperative(or)Round-robin: - Process currently running must give up CPU time slices to other processes. - Application must have special code loop that yields control to allow other application to execute. - When fails to yield, it “hogs” the CPU. - Ex: Macintosh, Win3.X 2) Preemptive: - OS schedules CPU time and an application can be preempted by OS at any time. - Ex: Win95, WinNT, Unix.

Ready Sleeping RunningBlocked Task State Diagram

Task States : READY: - All tasks which can run are READY.One of these tasks is the RUNNING task. RUNNING: - Task which is currently being executed by processor. - Only one task can be in this state at a time BLOCKED: - Task waits for an event.

SLEEPING: - All tasks which were not started or which have terminated themselves are in this state. By default preemption method is used in RTX-51

Task1 Initialize Function to be performed Function to be performed System call: wait for an event System call: wait for an event Task2 Initialize Function to be performed Function to be performed System call: delete itself System call: delete itself Stop Task Layout Task Layout

-Task1 has to perform certain action each time an event occurs.After completion it will wait for a new event. - Task2 after performing one event, will delete itself. Ex:Self-test-has to be executed once at every power-up.

Stack-Area for Normal task Stack Area for Fast Task 3 Stack Area for Fast Task 2 Stack Area for Fast Task 1 Reg. bank 3 for Fast Task3 Reg. bank 2 for Fast Task 2 Reg. bank 1 for Fast Task 1 Reg.bank 0 for Normal Tasks Normal-Task Context Normal-Task Context Normal-Task Context Switching of Dispatcher

Task Management Services offered by task management are: * To start and initialize system.(os_start_system) * To declare a task. * To create a task(os_create_task) * To delete a task(os_delete_task)

To Initialize and start the system: signed char os_start_system(unsigned char task_id) - task_id identifies first task to be started. - During this command following steps will take place: * disable all interrupts * clear memory space * initialize system clock hardware * creation of first user task * initialize interrupt hardware * enable interrupts * start dispatcher

To declare a Task : void func(void) _task_ _priority_ - func. is variable name for task to be declared. - Cannot return a value. - No parameter values are passed. - ranges from 0…255.Maximum of 256 tasks can be defined. - Only 19 tasks can be active at a time. - Declare task will reside in SLEEPING state.

1) Task Management (a) To create a task: signed char os_create_task(unsigned char task_id) - task_id identifies task to be started. - starts a function defined with C51 attribute _task_ as RTX-51 task. - task is placed in list of READY tasks. (b) To delete a task: signed char os_delete_task(unsigned char task_id)

- task_id identifies task to be deleted. - Only created task can be deleted. (c ) To determine running task_id: signed char os_running_task_id(void) - Number of the task currently being executed by the processor is returned. - Task number corresponds to number used in task declaration(0…255).

1) Memory Management Services offered by memory management are: * To generate memory pool(os_create_pool) * To request memory block from pool(os_get_block) * To return memory block to pool(os_free_block)

- Dynamic memory space is desired for storing intermediate results memory pools memory blocks in each pool Functions supported are : (a) Generate memory pool : signed char os_create_pool(unsigned int block_size,void xdata *memory, unsigned int mem_size)

-block size defines usable size of individual blocks.only one pool can be defined per block size. -*memory designs start address of memory area to be managed. -mem_size designs size of area. -Pools with various block sizes. -Pool is stored and managed in XDATA area. (b) Request memory block from pool: void xdata os_get_block(unsigned int block_size) -block size defines usable size of individual blocks.only one pool can be defined per block size. -*memory designs start address of memory area to be managed. -mem_size designs size of area. -Pools with various block sizes. -Pool is stored and managed in XDATA area. (b) Request memory block from pool: void xdata os_get_block(unsigned int block_size)

- gets memory block from memory pool referenced by block size. - block_size is desired block size.pool with blocks of required size must exist. (c ) Return memory block to pool: signed char os_free_block(unsigned int block_size, void xdata *block) - returns memory block to associated pool. - block designates returned block. - gets memory block from memory pool referenced by block size. - block_size is desired block size.pool with blocks of required size must exist. (c ) Return memory block to pool: signed char os_free_block(unsigned int block_size, void xdata *block) - returns memory block to associated pool. - block designates returned block.

3) Intertask Communication Services offered by memory management are: * To send a message(os_send_message) * To read a message(os_wait)

* Mailboxes : -Messages can be exchanged free of conflicts between individual tasks. -Fixed number of 8 mailboxes.(0…7) -Messages can be exchanged in words (2 bytes). -Identified with a mailbox number. -Freely used by all tasks. * Mailboxes : -Messages can be exchanged free of conflicts between individual tasks. -Fixed number of 8 mailboxes.(0…7) -Messages can be exchanged in words (2 bytes). -Identified with a mailbox number. -Freely used by all tasks.

Functions supported are: (a) Send a message: signed char os_send_message(unsigned char mailbox,unsigned int message,unsigned char timeout) -mailbox is identification of mailbox. -message is 2-byte value. -timeout is time limit for wait time for a full message. (b) Read a message: signed char os_wait(unsigned char event_selector, unsigned char timer_ticks, unsigned int xdata *message) Functions supported are: (a) Send a message: signed char os_send_message(unsigned char mailbox,unsigned int message,unsigned char timeout) -mailbox is identification of mailbox. -message is 2-byte value. -timeout is time limit for wait time for a full message. (b) Read a message: signed char os_wait(unsigned char event_selector, unsigned char timer_ticks, unsigned int xdata *message)

- event_selector = event1+event2..specifies the events which are to be waited for. Ex: K_MBX+mailbox number. - selects mail-box from which message is to be received. - timer_ticks determines number of system intervals to occur until time_out event occurs, if K_TMO was specified. ! must be 0 if no wait. ! 255 for endless waiting. - event_selector = event1+event2..specifies the events which are to be waited for. Ex: K_MBX+mailbox number. - selects mail-box from which message is to be received. - timer_ticks determines number of system intervals to occur until time_out event occurs, if K_TMO was specified. ! must be 0 if no wait. ! 255 for endless waiting.

3) Inter task synchronization Services offered by memory management are: * Signals - To send a signal(os_send_signal) - To wait for a signal(os_wait) - To clear a signal(os_clear_signal) * Semaphores - Wait for a token(os_wait) - Send a token(os_send_token)

* Signals : - Used when task synchronization is required without data exchange. Functions supported are: (a) send a signal: signed char os_send_signal(unsigned chartask_id) - task_id is where signal is to be sent. - if task is already waiting,it is made READY. - Otherwise signal is stored in signal flag. * Signals : - Used when task synchronization is required without data exchange. Functions supported are: (a) send a signal: signed char os_send_signal(unsigned chartask_id) - task_id is where signal is to be sent. - if task is already waiting,it is made READY. - Otherwise signal is stored in signal flag.

(b) Wait for a signal: os_wait(K_SIG, timer_ticks, 0) - Since there is no data transfer denote message as 0. (c ) Clear a signal: signed char os_clear_signal(unsigned char task_id) - task_id denotes the task whose signal flag is to be cleared. * Semaphores : - Used to control access to shared resources. - resources can be shared free of conflicts. (b) Wait for a signal: os_wait(K_SIG, timer_ticks, 0) - Since there is no data transfer denote message as 0. (c ) Clear a signal: signed char os_clear_signal(unsigned char task_id) - task_id denotes the task whose signal flag is to be cleared. * Semaphores : - Used to control access to shared resources. - resources can be shared free of conflicts.

Functions supported are: (a) Wait for a token: os_wait(K_MBX+sem.no., timer_ticks, 0) - Semaphore number ranges from 8…15. - Since no data transfer, message is 0. - Task requesting a resource controlled by semaphore can obtain a token from this. this semaphore. - If token is available, task will continue its execution. (b) Send a token: signed char os_send_token(unsigned char semaphore) Functions supported are: (a) Wait for a token: os_wait(K_MBX+sem.no., timer_ticks, 0) - Semaphore number ranges from 8…15. - Since no data transfer, message is 0. - Task requesting a resource controlled by semaphore can obtain a token from this. this semaphore. - If token is available, task will continue its execution. (b) Send a token: signed char os_send_token(unsigned char semaphore)

- semaphore is the number of desired semaphore. - After completing its operation, a task will return related token to semaphore. System clock Management : (a) To set system time interval: signed char os_set_slice(unsigned int timeslice) - timeslice defines time interval in number of processor cycles.Permissible values are 1000… default time interval is semaphore is the number of desired semaphore. - After completing its operation, a task will return related token to semaphore. System clock Management : (a) To set system time interval: signed char os_set_slice(unsigned int timeslice) - timeslice defines time interval in number of processor cycles.Permissible values are 1000… default time interval is

(b) To wait for time-out: os_wait( K_TMO, timer-ticks, 0) - K_TMO is event selector. - System will wait for time_out.If ticks is 0, then no wait for time_out. If 255, then endless waiting. (b) To wait for time-out: os_wait( K_TMO, timer-ticks, 0) - K_TMO is event selector. - System will wait for time_out.If ticks is 0, then no wait for time_out. If 255, then endless waiting.

Interrupt Management Services offered by memory management are: * To assign an interrupt to calling task(os_attach_interrupt) * To detach interrupt(os_detach_interrupt) * To enable interrupt(os_enable_isr) * To disable interrupt(os_disable_isr)

(a) To attach interrupt : signed char os_attach_interrupt(unsigned char interrupt) - interrupt designates vector number of interrupt source.(values are 0….31) - Assigns an interrupt source to calling task. - each interrupt source cannot be assigned to more than one task. - several interrupt source can be assigned to one task. (a) To attach interrupt : signed char os_attach_interrupt(unsigned char interrupt) - interrupt designates vector number of interrupt source.(values are 0….31) - Assigns an interrupt source to calling task. - each interrupt source cannot be assigned to more than one task. - several interrupt source can be assigned to one task.

(b) To detach interrupt : signed char os_detach_interrupt(unsigned char interrupt) - interrupt designates vector number of interrupt source.(values are 0….31) - Cancels the assignment of interrupt source to calling task. (b) To detach interrupt : signed char os_detach_interrupt(unsigned char interrupt) - interrupt designates vector number of interrupt source.(values are 0….31) - Cancels the assignment of interrupt source to calling task.

(c) To enable interrupt source : signed char os_enable_isr(unsigned char interrupt) - interrupt designates vector number of interrupt source assigned to.(values are 0….31) - Enables an interrupt source which is assigned to interrupt function.

(d) To disable interrupt source : signed char os_disable_isr(unsigned char interrupt) - interrupt designates vector number of interrupt source assigned to.(values are 0….31) - Disables an interrupt source which is assigned to interrupt function.

End Of The Session!

Thank You!