
- •Introduction
- •Applications of Real-Time Systems
- •Voltage
- •Figure 7: Conversion of an Analog Signal to a 16 bit Binary Number
- •Figure 11: Schematic Representation of tmr
- •It is relatively simple to design a hardware equipment to be fault-tolerant. The following are two methods that are popularly used to achieve hardware fault-tolerance:
- •Software Fault-Tolerance Techniques
- •Types of Real-Time Tasks
- •Timing Constraints
- •Events in a Real-Time System
- •Figure 16: Delay Constraint Between Two Events el and e2
- •Examples of Different Types of Timing Constraints
- •Figure 19: Classification of Timing Constraints
- •Real-Time Task Scheduling
- •Figure 1: Relative and Absolute Deadlines of a Task
- •Figure 2: Precedence Relation Among Tasks
- •Types of Real-Time Tasks and Their Characteristics
- •Classification of Real-Time Task Scheduling Algorithms
- •Figure 5: An Example Schedule Table for a Cyclic Scheduler
- •Figure 6: Major and Minor Cycles in a Cyclic Scheduler
- •Comparison of Cyclic with Table-Driven Scheduling
- •Hybrid Schedulers
- •Event-driven Scheduling
- •Is edf Really a Dynamic Priority Scheduling Algorithm?
- •Implementation of edf
- •Figure 10: Priority Assignment to Tasks in rma
- •We now illustrate the applicability of the rma schodulability criteria through a few examples.
- •Deadline Monotonic Algorithm (dma)
- •Handling Aperiodic and Sporadic Tasks
- •Dealing With Task Jitter
- •W Good real-time task scheduling algorithms ensure fairness to real-time tasks while scheduling.
- •State whether the following assertions are True or False. Write one or two sentences to justify your choice in each case.
- •Figure 2: Unbounded Priority Inversion
- •Highest Locker Protocol(hlp)
- •Priority Ceiling Protocol (pcp)
- •Comparison of Resource Sharing Protocols
- •Handling Task Dependencies
- •Fault-Tolerant Scheduling of Tasks
- •Clocks in Distributed Real-Time Systems
- •Clock Synchronization
- •Figure 1: Centralized synchronization system
- •Cn Slave clocks
- •Commercial Real-Time Operating Systems
- •Time Services
- •Clock Interrupt Processing
- •Providing High Clock Resolution
- •Figure 2: Use of a Watchdog Tinier
- •Unix as a Real-Time Operating System
- •In Unix, dynamic priority computations cause I/o intensive tasks to migrate to higher and higher priority levels, whereas cpu-intensive tasks are made to seek lower priority levels.
- •Host-Target Approach
- •Preemption Point Approach
- •Self-Host Systems
- •Windows As a Real-Time Operating System
- •Figure 9: Task Priorities in Windows nt
- •Open Software
- •Genesis of posix
- •Overview of posix
- •Real-Time posix Standard
- •Rt Linux
- •7.8 Windows ce
- •Benchmarking Real-Time Systems
- •Figure 13: Task Switching Time Among Equal Priority Tasks
- •Real-Time Communication
- •Figure 2: a Bus Architecture
- •Figure 4: Logical Ring in a Token Bus
- •Soft Real-Time Communication in a lan
- •Figure 6: Priority Arbitration Example
- •Figure 8: Problem in Virtual Time Protocol
- •Figure 9: Structure of a Token in ieee 802.5
- •Figure 10: Frames in the Window-based Protocol
- •Performance Comparison
- •A Basic Service Model
- •Traffic Characterization
- •Figure 16: Constant Bit-Rato Traffic
- •Routing Algorithms
- •Resource Reservation
- •Resource Reservation Protocol (rsvp)
- •Traffic Shaping and Policing
- •Traffic Distortion
- •Traffic Scheduling Disciplines
- •Figure 20: Packet Service in Jittor-edd
- •Differentiated Services
- •Functional Elements of DiffServ Architecture
- •Real Time Databases
- •Isolation: Transactions are executed concurrently as long as they do not interfere in each other’s computations.
- •Real-Time Databases
- •Real-Time Database Application Design Issues
- •Temporal Consistency
- •Concurrency Control in Real-Time Databases
- •It can bo shown that pcp is doadlock froo and single blocking. Rocolloct that single blocking moans that once a transaction starts executing after being blocked, it may not block again.
- •Speculative Concurrency Control
- •Comparison of Concurrency Control Protocols
- •Commercial Real-Time Databases
- •Figure 16: Uniform Priority Assignment to Tasks of Example 15
- •Version 2 cse, iit Kharagpur
Deadline Monotonic Algorithm (dma)
RMA no longer remains an optimal scheduling algorithm for the periodic real-time tasks, when task deadlines and periods differ (i.e. di Ф pi) for some tasks in the task set to be scheduled. For such task sets, Deadline Monotonic Algorithm (DMA) turns out to be more proficient than RMA. DMA is essentially a variant of RMA and assigns priorities to tasks based on their deadlines, rather than assigning priorities based on task periods as done in RMA. DMA assigns higher priorities to tasks with shorter deadlines. When the relative deadline of every task is proportional to its period, RMA and DMA produce identical solutions. When the relative deadlines are arbitrary, DMA is more proficient than RMA in the sense that it can sometimes produce a feasible schedule when RMA fails. On the other hand, RMA always fails when DMA fails. We now illustrate our discussions using an example task set that is DMA schedulable but not RMA schedulable.
Example 2.12: Is the following task set schedulable by DMA? Also check whether it is schedulable using RMA. T\ = (^i=10 msec, /jj =50 msec, di=35 msec), T2 = (e2=15 msec, p2=100 msec, d2 =20 msec), T3 = (^з=20 msec, Рз=200 msec, fi3=200 msec)
Solution: First, let us check RMA schedulability of the given set of tasks, by checking the Lehoczky’s criterion. The tasks are already ordered in descending order of their priorities. Checking for Ti : lOm.s^c < 35wiser. Therefore, T\ would meet its first deadline.
Checking for T2 : 10 + 15 % 20. Therefore, T2 will miss its first deadline.
Hence, the given task set can not be feasibly scheduled under RMA.
Now lot us chock tho schodulability using DMA:
Under DMA, tho priority ordering of the tasks is as follows: Pr(T2) > Pr{T\) > Pr(T3) Checking for T2 : 10wiser < 35msec. Hence T2 will moot its first deadline.
Checking for T\ : (15 + 20)msec < 20msec, Hence T\ will moot its first deadline. Checking for T3 : (70 + 30 + 20)msec < 200msec. Therefore, T3 will moot its deadline.
Therefore, the given task set is schodulablo under DMA but not under RMA.
Context Switching Overhead
So far, while determining schodulability of a task sot, wo had ignored the overheads incurred on account of context switching. Let us now investigate the effect of context switching overhead on schodulability of tasks under RMA.
It is easy to realize that under RMA, whenever a task arrives, it preempts at most one task — the task that is currently running. From this observation, it can be concluded that in the worst-caso, each task incurs at most two context, switches under RMA. One when it, preempts the currently running task. And the other when it, completes possibly the task that, was preempted or some other task is dispatched to run. Of course, a task may incur just, one context, switching overhead, if it, does not, preempt, any task. For example, it, arrives when the processor is idle or when a higher priority task was running. However, we need to consider two context, switches for every task, if we try to determine the worst-caso context, switching overhead.
For simplicity we can assume that context switching time is constant, and equals с milli Seconds where с is a constant,. From this, it, follows that, the net, effect, of context, switches is to increase the execution time e.i of each task T-i to at, most, e.i + 2 * c. It, is therefore clear that, in order to take context, switching time into consideration, in all schodulability computations, wo need to replace e.i by e.i + 2c for each Tj.
Example 13: Check whether the following set, of periodic real-timo tasks is schodulablo under RMA on a uniprocessor: T\=(e\=20 msec,p! =100 msec), T2=(e2=30 msoc,p2=150 msec), T3=(e.3=9Q msoc,;)3=200 msec). Assume that context, switching overhead does not, exceed 1 milli secs and is to be taken into account, in schodulability computations.
Solution:
Tho not, effect, of context, switches is to increase the execution time of each task by two context, switching times. Therefore, the utilization due to the task set, is:
v- 22 зг 92 n
Ш+Ш+ 200 ^0'893
г=1
Since 2Ji=i ui > 0-78, the task set, is not, RMA schodulablo according to tho Liu and Layland tost,.
Lot, us try Lohoczky’s test,:
The tasks are already ordered in descending order of their priorities.
Checking
for task Ti
Checking
for task T2
Checking
for task T3
22 * 2 + 32 < 150. This is satisfied, therefore T2 moots its first deadline.
22 * 2 + 32 * 2 + 90 < 200. This is satisfied, therefore T3 moots its first deadline.
Therefore, the task set, can be feasibly scheduled under RMA even when context, switching overhead is taken into consideration.
Self Suspension
A task might cause its self suspension, when it performs its input/output operations or when it waits for some events/conditions to occur. When a task self suspends itself, the operating system removes it from the ready queue, places it in the blocked queue, and takes up the next eligible task for scheduling. Thus, self suspension introduces an additional scheduling point, which we did not consider in Sec. 2.3.1. We therefore need to augment our definition of a scheduling point given in Sec. 2.3.1 accordingly.
In event-driven scheduling, the scheduling points are defined by task completion, task arrival, and self-suspension events.
Let us now determine the effect of self-suspension on the schedulability of a task set. Let us consider a set of periodic real-time tasks {Ti,T2, ...,Tn}, which have been arranged in the increasing order of their priorities (or decreasing order of their periods). Let the worst case self suspension time of a task T* is ftj. Let the delay that the task T-i might incur due to its own self suspension and the self suspension of all higher priority tasks be fttj. Then, bti can be expressed as:
i—1
bti =bi + ^2 min(ek,bk) ... (2.15)
*=i
Self suspension of a higher priority task Tk may affect the response time of a lower priority task I; by as much as its execution time ek if ek < ft*. This worst case delay might occur when the higher priority task after self suspension starts its execution exactly at the time instant the lower priority task would have otherwise executed. That is, after self suspension, the execution of the higher priority task overlaps with the lower priority task, with which it would otherwise not have overlapped. However, if ek > ft*, then the self suspension of a higher priority task can delay a lower priority task by at most ft*., since the maximum overlap period of the execution of a higher priority task due to self suspension is restricted to bk.
Note that in a system where some of the tasks are nonpreemptable, the effect of self suspension is much more severe than that computed by Expr. 2.15. The reason for this is that every time a processor self suspends itself, it loses the processor. It may be blocked by a non-preemptive lower priority task after the completion of self suspension. Thus, in a non-proomptablo scenario, a task incurs delays due to self-suspension of itself and its higher priority tasks and the delay caused due to non-proomptablo lower priority tasks. Obviously, a task can not got delayed duo to the self suspension of a lower priority non-proomptablo task.
The RMA task schedulability condition of Liu and Layland (Expr. 2.10) needs to change when wo consider the effect of self suspension of tasks. To consider the effect of self suspensions in Expr. 2.10, we need to substitute a-i by (a-i + bti). If wo consider the effect of self suspension on task completion time, the Lohoczky criterion (Expr. 2.12) would also have to bo generalized:
i—1
ei + bti + y2\—]*ek<pi ...(2.16)
iS Pk
We have so far implicitly assumed that a task undergoes at most a single self suspension. However, if a task undergoes multiple self suspensions, then the expression 2.16 wo derived above would need to bo changed. Wo leave this as an exorcise for the reader.
Example 14: Consider the following set of periodic real-time tasks: T\ = x =10 msec, p[=50 msec), T2 = («2=25 msec, p2=150 msec). T3 = (fi3=50 msec, p3=200 msec). Assume that the self suspension times of T\,T2, and T3 are 3 milli Seconds, 3 milli Seconds, and 5 milli Seconds, respectively. Determine whether the tasks would meet their respective deadlines, if scheduled using RMA.
Solution: The tasks are already ordered in descending order of their priorities. By using the generalized Lehoczky’s condition given by Expr. 2.16 we get:
For T\ to be schedulable: (10 + 3)wiser. < 50wiser. Therefore T\ would meet its first deadline.
For T2 to be schedulable: (25 + 6 + 10 * 3)wisec < 150wiser. Therefore, T2 meets its first deadline.
For T3 to be schedulable: (50 + 11 + (10 * 4 + 25 * 2))wiser < 200ms««. This inequality is also satisfied. Therefore,
T3 would also meet its first deadline.
It can therefore be concluded that the given task set is schedulable under RMA even when self suspension of tasks is considered. n
Self Suspension with Context Switching Overhead
Let us examine the effect of context switches on the generalized Lehoczky’s test (Expr. 2.16) for schedulability of a task set, that takes self suspension by tasks into account. In a fixed priority proomptablo system, each task preempts at most one other task if there is no self suspension. Therefore, each task suffers at most two context switches — one context switch when it starts and another when it completes. It is easy to realize that any time when a task self-suspends, it causes at most two additional context switches. Using a similar reasoning, we can determine that when each task is allowed to self-suspend twice, additional four context switching overheads are incurred. Let us denote the maximum context switch time as c. The effect of a single self-suspension of tasks is to effectively increase the execution time of each task I; in the worst case from to +4*c. Thus, context switching overhead in the presence of a single self-suspension of tasks can be taken care of by replacing the execution time of a task I; by («; +4*c) in Expr. 2.16. We can easily extend this argument to consider two, three, or more self suspensions.
Issues in Using RMA in Practical Situations
While applying RMA to practical problems, a few interesting issues come up. The first issue that we discuss arises due to the fact that RMA does not consider task criticalitios. The other issues that we discuss are coping up with limited number of priority levels that commercial operating systems supports, and handling of aperiodic and sporadic
Handling Critical Tasks with Long Periods
A situation that real-time system designers often have to deal with while developing practical applications, is handling applications for which the task criticalities are different from task priorities. Consider the situation where a very critical task has a higher period than some task having a lower criticality. In this case, the highly critical task would be assigned lower priority than a low criticality task. As a result, the critical task might at times miss its deadline due to a simple transient overload of a low critical (but high priority) task. If we simply raised the priority of a critical task to high levels, then the RMA schedulability results would not hold and determining the schedulability of a set of tasks would become extremely difficult.
A solution to this problem was proposed by Sha and Raj Kumar [4]. Sha and Raj Kumar’s solution is known as the period transformation technique. In this technique, a critical task is logically divided into many small subtasks. Let Tj be a critical task that is split into к subtasks. Let each of these subtasks have period Similarly,
tho deadline and worst case execution times of these subtasks will be j- and jf- respectively. The net effect when a task T-i is split into к subtasks: {Tii, is to effectively raise the priority of Tj.
Each subtask of the critical task Tj would be represented by T.^ =< >. Though we talked of a critical
task being split up into к parts, this is done virtually at a conceptual level, rather than making any changes physically to the task itself. The period transformation technique effectively raises the priority of a critical task to higher values without making the RMA analysis results totally invalid. However, due to the raising of the priority of the critical task, RMA schodulability results do not hold accurately. The culprit is the fact that the utilization due to all the higher priority tasks is in fact k*(e; /к)/(р.;/к)=к*е; /p.;, whereas their actual utilization is щ /р^. Therefore, even when tasks appear to be unschedulable after task splitting as indicated by the RMA schodulability analysis results, they may actually be schodulablo.