19-01-2013, 01:26 PM
Real-Time Kernels
Real-Time.ppt (Size: 462 KB / Downloads: 29)
A process is an abstraction of a running program and is the logical unit of work scheduled by OS
Threads are light-weighted processes sharing resources of the parent process
RTOS task management functions: task scheduling, task dispatching, inter task communication and synchronization
Real-Time Kernels
The kernel of the OS is the smallest portion that provides for task management functions
A scheduler determines which task will run next
A dispatcher provides a necessary bookkeeping to start the next task
Inter task communication and synchronization assures that the tasks cooperate
Polled loop systems
Simplest form of Real-time “kernel”.
Used for fast reaction to single events
Do not require interrupts.
Simple while loop used to wait for an event signaled via DMA from a hardware device.
Handler should clear event before servicing to catch bursts.
These systems are easy to construct and analyze and thus to guarantee response times.
Synchronized polled loops
Polled loop response may be so fast that false events are induced by premature resetting of the flag.
Switch bounce phenomenon in physical systems is a cause of such problems.
Delay can be a no-op, loop, or interrupt (clock) driven delay.
Increases response times-- but it’s worth it.
Context switching
Context switching is the process of saving and restoring sufficient information for a real-time task so that it can be resumed after being interrupted.
The context is ordinarily saved to a stack data structure.
Context switching time is a major contributor to response time and therefore must be minimized.
The rule for saving context is simple: save the minimum amount of information necessary to safely restore any process after it has been interrupted.
FOREGROUND/ BACKGROUND SYSTEMS
Foreground/background systems are an improvement over the interrupt-only systems in that the polled loop(dummy background process) is replaced by code that performs useful processing.
Foreground/background systems are the most common architecture for embedded applications.
They involve a set of interrupt-driven or real-time processes called the foreground and a collection of non interrupt-driven processes called the background
The foreground tasks run in round-robin, preemptive priority, or hybrid fashion.
The background task is fully pre-emptable by any foreground task and, in a sense, represents the lowest priority task in the system.
Background processing
Easy processing should be placed in background.
Process with lowest priority
The background consist of all non-interrupt driven tasks. Includes anything that is not time critical.
Foreground tasks are interrupt driven tasks and are time critical.
Rate at which the background will be executed can be very low which depends on time-loading factor.
The task control block model
We associate with each task a context; identification number; a status.
These items are stored in a structure called TCB.
TCB contains context. Collection is stored in one or more data structures such as a linked list.
TCB model can be used in round-robin, preemptive priority or combination systems, although it is generally associated with round-robin systems with a single clock.
Is the most popular method for implementing commercial, full-featured, real-time operating systems.
used in interactive on-line systems where tasks (associated with users) come and go.