Download presentation
Presentation is loading. Please wait.
Published byLenard Evans Modified over 6 years ago
1
Presented By : Arun Kumar Jindal (MT11003) Srishti Gupta (MT 11012)
Generalized Rate – Monotonic Scheduling Theory : A Framework for Developing Real Systems -Lui Sha, Ragunathan RajKumar and Shirish S. Sathaye Presented By : Arun Kumar Jindal (MT11003) Srishti Gupta (MT 11012)
2
Topics to be covered Introduction GRMS : Overview
Theoretical Extensions for applying GRMS to a distributed system. Comprehensive Example that illustrates task scheduling within subsystems as well as end to end scheduling in a large real time system.
3
INTRODUCTION
4
Some Definitions Real-time systems Schedulability
Soft RTS : Meet timing constraints most of the time, it is not necessary that every time constraint be met. Some deadline miss is tolerated Hard RTS: Meet all time constraints exactly, Every resource management system must work in the correct order to meet time constraints. No deadline miss is allowed. Schedulability Degree of resource utilization at or below which the timing requirements of tasks can be ensured (Ref: Generalized Rate-Monotonic Scheduling Theory:A Framework for Developing Real Time Systems – Lui Sha, Ragunathan RajKumar and Shirish S. Sathaye)
5
GRMS : Overview
6
Generalized Rate Monotonic Theory (GRMS)
Tool which manages system concurrency and timing constraints Ensures that as long as system utilization of all tasks lie below a certain bound and appropriate scheduling algorithms are used, all tasks can complete their deadlines Used in high level projects like Space station program systems , European Space Agency on-board OS
7
System Model Each node in the network is a multiprocessor
Each processor has CPU, memory and an OS The processors communicate over a shared backplane bus An operator may send commands to nodes whenever required since signal processor is connected to sensor The signals from signal processors are sent to tracking processors to track the motion of the objects Ref: Technical report, Distributed Sytem design by Sha, Sathaye
8
Overview of GRMS Theory
Periodic task (t i ) Computation time ( C i ) Period ( Ti ) Independent Tasks: Tasks which do not interact or synchronize with each other Real time systems consist of both periodic and aperiodic tasks
9
Why do we need scheduling ??
Each computation (task) we want to execute needs resources Resources: processor, memory segments, communication, I/O devices etc.) The computation must be executed in particular order (relative to each other and/or relative to time) We need to determine the ordering which would yield best possible resource utilization Scheduling: assignment of processor to computations; Allocation: assignment of other resources to computations;
12
A. Scheduling independent tasks
Theorem 1: A set of n independent periodic tasks scheduled by the rate-monotonic algorithm will always meet their deadlines for all tasks start times, if Ci is the execution time and Ti is the period of task ti Ci / Ti is the utilization of the resource by task ti
13
Example Task t1: C1 = 20; T1 = 100; D1 = 100 Task t2: C2 = 30; T2 = 145; D2 = 145 Is this task set schedulable ? The total utilization of task t1 and t2 is 0.2(20/100) (30/145) ~= 0.41 which is less than the bound 2*(2^(1/2) - 1) = 2*( ) = 0.828 Ans : YES !
14
The bound on utilization converges to ln 2=0
The bound on utilization converges to ln 2=0.69 as n becomes very large Average schedulable utilization is 88% The remaining utilization is used by the background tasks having low priority To see if the tasks scheduled on a resource with utilization greater than the above bound can meet their deadlines, we use exact schedulability test based on critical zone theorem
15
[Applies to any static priority scheduling assignment]
Theorem 2: For a set of independent periodic tasks, if a task τ meets its first deadline Di ≤Ti , when all the higher priority tasks are started at the same time, then it can meet all its future deadlines with any task start times [Applies to any static priority scheduling assignment] Let tasks t 1 ….. t n-1 have higher priorities than t n . At time t, the cumulative demand on CPU time by these n tasks is ( Ref : Technical report on distributed design, Sha and Sathaye)
16
( Ref : Technical report on distributed design, Sha and Sathaye)
17
The total utilization of tasks t1 and t2 is 0.41, which is less than 0.828, the bound for two tasks given by Theorem 1. Hence, these two tasks are schedulable. However, the utilization of these three tasks as given by Theorem 1 is 0.86, which exceeds 0.779, the bound, as given by Theorem 1 for the three tasks. Therefore, we need to apply the completion time test to determine the schedulability of task t3
18
( Ref : Technical report on distributed design, Sha and Sathaye)
19
B. Task Synchronization
Till now we discussed the scheduling of independent tasks. However in real time systems the tasks interact with each other. GRMS can also be applied to real time tasks that interact with each other. Common Synchronization primitives : Semaphores, Locks etc. Direct application of synchronization mechanisms lead to an indefinite period of Priority Inversion.
20
Priority Inversion Priority Inversion occurs when a high priority task is prevented from executing by a low priority task.
21
Example of priority Inversion
22
Example (cont.)
23
Methods to control priority Inversion
24
Priority Inheritance Protocol
25
Rules of Priority Inheritance Protocol
26
Rules of Priority Inheritance Protocol
Allocation Rule: When a job J requests a resource R at time t , (a) if R is free, R is allocated to J until J releases the resource, and (b) if R is not free, the request is denied and J is blocked.
27
Rules of Priority Inheritance Protocol
Rule # 3. Priority-Inheritance Rule: When the requesting job J becomes blocked, the job Jl which blocks J inherits the current priority π(t ) of J . The job Jl executes at its inherited priority π(t ) until it releases R; at that time, the priority of Jl returns to its priority πl (t ) at the time t when it acquires the resource R.
28
Example of Priority Inheritance Protocol
29
Example of Priority Inheritance Protocol
9/20/2018
30
Priority Ceiling Protocol
Priority Ceiling Protocol extends the Priority Inheritance Protocol. Prevents deadlocks. Further reduces the blocking time.
31
Notations
32
Assumptions in Priority Ceiling Protocol
Assigned Priorities of all jobs are fixed. Resources required by all jobs are known a priori before the execution of any job begins.
33
Rules of Priority Ceiling Protocol
Rule # 1. Scheduling Rule: (a) At its release time t , the current priority π(t ) of every job J is equal to its assigned priority. The job remains at this priority except under the condition stated in rule 3. (b) Every ready job J is scheduled preemptively and in a priority-driven manner at its current priority π(t ).
34
Rules of Priority Ceiling Protocol
Allocation Rule: Whenever a job J requests a resource R at time t , one of the following two conditions occurs: (a) R is held by another job. J ’s request fails and J becomes blocked. (b) R is free. If J ’s priority π(t ) is higher than the current priority ceiling βˆ (t ), R is allocated to J . (ii) If J ’s priority π(t ) is not higher than the ceiling βˆ (t ) of the system, R is allocated to J only if J is the job holding the resource(s) whose priority ceiling is equal to βˆ (t ); otherwise, J ’s request is denied, and J becomes blocked.
35
Rules of Priority Ceiling Protocol
Rule # 3. Priority-Inheritance Rule: When J becomes blocked, the job Jl which blocks J inherits the current priority π(t ) of J . Jl executes at its inherited priority until the time when it releases every resource whose priority ceiling is equal to or higher than π(t ); at that time, the priority of Jl returns to its priority πl (t ) at the time t when it was granted the resource(s).
36
Example of Priority Ceiling Protocol
37
Example of Priority Ceiling Protocol
38
C. Transient Overload
42
Theoretical Extensions for applying GRMS to a distributed system.
43
Distributed System Extensions for GRMS
Difference between Centralized and Distributed Systems Centralized : Has a scheduler which controls all the applications . All the requests are immediately known. Eg. Bank application where bank is the central authority which controls all the branches Distributed : No central authority control (self-contained) Eg . Internet
45
A. Extensions in Schedulability concepts
In a communication network, the delay incurred by a message in reaching its destination is the sum of transmission delay and propagation delay. Transmission delay: Time to push all the message bits onto the network wire. Delay caused by data-rate of the link. The delay depends on the packet length and not on the distance between the nodes Delay=N/R where N=no of bits , R-rate of transmission
46
Propagation delay : Time between the end of message transmission and its arrival at its destination.
Delay= D/S where D=Distance b/w nodes , S=Speed Satisfaction of the end-to-end deadline of the message can be found using the relation End-to-End deadline >= Transmission Deadline + Propagation Delay
47
B. Preemption Control Preemption is the most basic concept in priority-based preemptive scheduling. It has been assumed that increasing preemptability always leads to a minimization of priority inversion. However, this is not true in a distributed system. In a distributed system, there can be special situations when a particular preemption increases the delay experienced by lower priority connections.
48
We call such situations over-preemption, whose effect is to reduce the schedulable utilization of the network. To overcome the effect of over-preemption, a preemption control protocol(phase control, rate control) is needed.
49
Pair of slotted rings operate in both the directions called as Flink (Forward link) and Rlink (Reverse link) Fixed length slots are generated by slot generators of corresponding links Slot generation functions can be embedded within the station at the end of the links (eg S1 in above figure)
50
Each station is able to transmit and receive messages on both link (Rlink , Flink)
Each message uses exactly one slot The selection of the link for the transmission depends on the physical location of the destination Reservation for a slot on the Flink is made on the Rlink via a request and vice-versa A single bit tells whether the slot is used or free and has a request bit per slot Multiple priority levels are supported, each represented by separate access queue
51
A station wishing to transmit at a particular priority on Flink, issues a request in the slot on Rlink by setting the proper request bit It also places its own request into its access queue at appropriate priority level. Each station on seeing a request, enqueues it in its access queue The station on seeing a free slot, discards the top request from highest priority non empty queue and serves the request. If the top request is station’s request, it transmits in the slot on the Flink and removes the request from the access queue
52
Example to show over-preemption
Consider a dual-network with three stations, S1, S2 and S3. Let the slot generation function be embedded in S1. Let the propagation delay between S1 and S2 be 10 slots and between S2 and S3 be 1 slot. Let S1 and S3 be transmitting as follows : S1 has a low priority connection that uses 100 slots every 10,000 slots and S3 has a medium priority connection that wants to transmit in 1 slot every 10 slots. Slots labeled L are used by S1 and M by S3. Let S2 is a high priority connection that need to transmit in 1 slot every 4 slots.
53
S1 has released an empty slot so that S3 may transmit once every 10 slots as it requires
Now let S2 start a new high-priority connection that needs to transmit in 1 slot every 4 slots. Since S2's request has higher priority, it preempts S3's request in the access queue of S1. The first of the slots released by S1 for S2 will take 20 units of time(round trip delay). Until this time, S2 uses slots for S3, but it is not enough. S2 is not schedulable, and the preemption of S3's request is over-preemption.
54
Preventing over-preemption condition
Phase control We need to prevent station S2 from using slots released for station S3. S2 should delay its slot use for 20 slot times after its first request. After this time, slots released for S2 will reach S2 Rate control During the 20-unit delay, 5 cells are buffered at S2. After the delay, only 1 slot in every 4 slots will be released for use by S2 but if S2 attempts to transmit all 5 slots, S3 will again be disrupted Hence, S2 should only transmit one slot every 4 after the round-trip delay of 20 slot times.
55
C. System Consistency Stations in a distributed system may have incomplete or delayed information of the system state. This may lead to inconsistent views of the system state
56
Sb enters its own request Rb
Sb is prevented by higher priority request Ra by stations Sa On the request stream, Ra precedes Rb The transmission queue of Sc will have Ra preceding Rb which is inconsistent with the queue of Station Sb
57
A system is said to be consistent if and only if the order of the same entries in different station queue is consistent with each other For example, if request R1 and request R2 both exist in queue Qa and queue Qb if R1 is ahead of R2 in Qa, then R1 must also be ahead of R2 in Qb
58
Inconsistency can be avoided by the following rule
A station is not permitted to enter its request in its own queue until it has successfully made the request on the link. This makes the entries in each queue consistent with the ordering of requests on the link For example, station Sb cannot enter its request in its queue until it can make a request on the link.
59
Comprehensive Example that illustrates task scheduling within subsystems as well as end to end scheduling in a large real time system.
60
Distributed System
61
Application Characteristics
The unit of time in this example is milliseconds. The sensor takes an observation every 40 ms. Signal processing task processes the signal and averages it every 4 cycles before sending it to the tracking processor. Tracking processor has a task with a period of 160. After the task executes, it sends the result to the control processor.
62
Application Characteristics
Task 3 on the control processor that uses the tracking information has a computation requirement of 30 and a period of 160. In addition, the end-to-end latency of the pipeline of data flow from the sensor to the control processor should be no more than 785. The control processor also has additional periodic and aperiodic tasks which must be scheduled. Tracking and control processors send status information across the network to a user inter- face node and periodically receive commands.
63
Task Set on the Control Processor
Aperiodic event handling with an average execution time of 10 and an average interarrival time of 100. We create a sporadic server task as follows: Task 1: C1 = 20; T1 = 100; A periodic task for handling local feedback control with a computation requirement and a given period. Task 2: C2 = 78; T2 = 150;
64
Task Set on the Control Processor
A periodic task that utilizes the tracking information received. Again the com- putation time and period are given. Task 3: C3 = 30; T3 = 160; A periodic task responsible for reporting status across the network with a given computation time and period. Task 4: C4 = 10; T4 = 300; Tasks 1 and 2 are in one allocation unit and Tasks 3 and 4 are in another unit. Note that the scheduling of tasks in a processor is independent of allocation units.
65
Tasks on the Control Processor
66
Assigning Message & Task Deadlines
Using Rate Monotonic Priority Assignment we assume that the end-to-end delay is the sum of the period for each resource.
67
Total Delay using Rate Monotonic Scheduling
Delay in collecting 4 sensor samples (4*40) = 160 Transferring the message on the bus = 160 Executing in the tracking processor = 160 Re-sending message on the bus = 160 Executing in the control processor = 160 Worst case end to end delay = 800 Max allowable latency = 785 (Hence deadline monotonic scheduling should be used for at least some of the resources in the path.
68
Deadline Monotonic Scheduling
It is advisable to give a full period delay for global resources such as the bus or the network since their workload is more susceptible to frequent changes. Since there are two bus transfers involved we attempt to assign a full period to each. We also attempt to assign a full period to the signal and tracking processors. Hence, the required completion time of the control processor task 3 should be no greater than 785 – 4* (160) = 145.
69
Scheduling Tasks on Control Processor
Let tasks 1, 2, and 3 share several data structures guarded by semaphores S1, S2, and S3. Suppose the duration of critical sections accessing shared data structures are bounded by 10. Suppose the priority ceiling protocol is used. By Theorem 3, higher priority tasks are blocked at most once for 10 by lower priority tasks.
70
Task 3 under Rate Monotonic Assignment
t0 = C1 + C2 + C3 = = 128 t1 = W3(t0) = 2C1 + C2 + C3 = = 148 W3(t1) = 2C1 + C2 + C3 = 148 =t1 Result : Task 3 completes at 148, deadline was 145.
71
Task 3 under Deadline Monotonic Priority Assignment
This makes the priority of task 3 higher than the priority of task 2.
72
Task 1 Under the above priority assignment :
Task 1 can be blocked by lower priority tasks for 10 , i.e., B1 = 10. The schedulability test for task 1 : C1 / T1 + B1 / T1 = = 0.3 <= 1(2-1) = 1.0 Hence Task 1 is schedulable.
73
Task 3 Task 3 is the second highest priority task.
Since 3 has a deadline shorter than its period, the schedulability test for 3 can be checked . Let E3 = T3 – D3 In the schedulability test of task 3, the utilization of task 2 does not appear, since 2 has a lower priority and does not preempt 3. Because task 2 has a lower priority, its critical section can delay task 3 by 10 . Therefore B3 = 10.
74
Task 3 C1/T1 + C3/T3 + E3/T3 + B3/T3 = = <= 2(√2 – 1) = 0.828 Hence task 3 is schedulable.
75
Task 2 From the view point of the rate monotonic assignment, the deadline monotonic assignment is a "priority inversion". Therefore in the schedulability test for task 2, the effect of blocking has to include task 3’s execution time. The blocking time is B2 = C3+0. The zero indicates that there can be no lower priority task blocking task 2.
76
Task2 C1/T1 + C2/T2 + B2/T2 = = 0.92 > 2(√2 – 1) = 0.828 Hence the task 2 fails the schedulability test as per theorem 4.
77
Task 4 C1/T1 + C2/T2 + C3/T3 + C4/T4 = = > 4(21/4 – 1) = 0.757 Hence the task 4 fails the schedulability test as per theorem 4.
78
Task 2 & 4 under completion time test
Since task 1 and task 3 must execute at least once before task 2 can begin executing, the completion time of 2 can be no less than 128. t0 = C1 + C2 + B2 = = 128 However, task 1 is initiated one additional time in the interval (0,128). Taking this additional execution into consideration, W2(128) = 148.
79
Task 2 & 4 under completion time test
t1 = W2(t0) = 2C1 + C2 + B2 = = 148 Since W2(148)=148 and thus the minimum time at which W2(t) = t is 148. Hence task 2 is schedulable. W2(t1) = 2C1 + C2 + B2 = = 148 =t1 Similarly we check for Task 4 and it turns out to be schedulable.
80
References Generalized Rate-Monotonic Scheduling Theory:A Framework for Developing Real Time Systems – Lui Sha, Ragunathan RajKumar and Shirish S. Sathhaye Rate Monotonic Theory for Real-Time Scheduling – Mani Srivastava Real Time Systems by Jane W.S.Liu Wikipedia
81
THANK YOU
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.