Académique Documents
Professionnel Documents
Culture Documents
Need of an OS
Felt to overcome the shortfalls of simple sequential programming:1.no. of tasks being high some sporadic tasks may be missed 2.If one of the tasks is held up, whole system will so. 3.Some tasks may need to be prioritized. 4.Requires large RAM as all of the tasks acquire memory for all the time.
Hard
Hard real time means strict adherence to each task deadline. When an event occurs, it should be serviced within the predictable time at all times in a given hard real time system. Automobile engine control system and anti lock brake are the examples of hard real time systems
Soft
In which deadlines are mostly met. Soft real time means that only the precedence and sequence for the task-operations are defined, interrupt latencies and context switching latencies are small but there can be few deviations between expected latencies of the tasks and observed time constraints and a few deadline misses are accepted . Mobile phone, digital cameras and orchestra playing robots are examples of soft real time systems
RTOS
A real time operating system (RTOS) is multitasking operation system for the applications with hard or soft real time constraints and system having the service deadlines of tasks, interrupt service threads and ISRs Real-time constraint means constraint on occurance of an event and system expected response to the event
Funtion of RTOS
Generally performs three main functions It decides which task should run and for how long i.e schedules. It provides communication and synchronization between tasks, ISRs and ISTs. It controls the use of resources shared between the tasks, for example memory and hardware peripherals
Diff of OS &RTOS
Parts of an RTOS
Basic parts are Scheduler (kernel) RTOS services Synchronization and messaging tools may have some common device drivers ( TCP/IP, FS, keyboard , lcd, USB etc.)
Sheduling
Cooperative scheduling Round-robin scheduling Preemptive scheduling (static/dynamic) Preemptive plus round-robin
The kernel usually provides an interface to manipulate task operations. Typical task operations are: Creating a task Deleting a task Changing the priority of a task Changing the state of a task
RTOS Services
RTOS services are utilities provided by the kernel that help developers create real-time tasks efficiently. For example, a task can use time services to obtain the current date and time. Some of these services are: Interrupt handling services Time services Device management services Memory management services Input-output services
Device drivers
It is a piece of software that -reads and/or writes that particular device's data, control and status registers directly. -hides the underlying hardware from the application software developer (hardware abstraction) -handles interrupts from the device -provides APIs for accessing the device to the application developer. -is to be as much general as possible to a class of devices (ex: flash devices) void flashErase(uint32_t sector); void flashWrite(uint32_t offset, uint8_t *pSrcAddr, uint32_t numBytes);
Structure of a RTOS
RTOS from different vendors: VxWorks, pSOS, RTLinux
Appln prog
Interrupt or polling
I/O
I/O Interrupt
Interrupt
Hardware
Variations
Hybrid RTOS
Time criticality
Times which are critical on the performance of an embedded system Repetition Rate( periodic tasks) Execution Time Required Response time (to an event ) Task (Context) Switching
Characteristics of a RTOS
Deterministic (i.e predictable) Interrupt latency should be small Context switching time should be small Configurable Scalable Protection mechanism need not be present