Real Time Systems: Assignment - 2 Name: Vithya M BITS ID: 2019HT01605 Session ID: Session1584817886264 (And
Real Time Systems: Assignment - 2 Name: Vithya M BITS ID: 2019HT01605 Session ID: Session1584817886264 (And
Real Time Systems: Assignment - 2 Name: Vithya M BITS ID: 2019HT01605 Session ID: Session1584817886264 (And
Assignment -2
Name: Vithya M
BITS ID: 2019HT01605
Session ID: session1584817886264 (and also in personal PC as was getting error session
Information not found for other 2 times)
Q1. Schedule the following task according to Rate monotonic algorithm. Implement
using user defined protocol. Use Cheddar simulator tool for the same.
T1 (5, 1), T2 (6, 1) T3 (8, 2) T4 (7, 2)
Rate Monotonic Algorithm: Task with smallest time period will have highest priority
Task Priority
T1 1
T2 2
T3 4
T4 3
Non-Pre-emptive:
The tasks are schedulable using Non pre-emptive Rate Monotonic Algorithm, but not
schedulable using Pre-emptive Rate monotonic algorithm.
Q2. (Use Cheddar simulator)Consider three periodic tasks, synchronous and with
deadlines on request: tasks T1, T2 and T3. They are defined as follow:
Assume a pre-emptive fixed priority scheduling policy and apply Rate Monotonic to
assign priorities. Assume that tasks T1 and T3 share a resource named S. T1 and T3
access to S in mutual exclusion:
a)In this time line, find when tasks T1 and T2 lock and unlock S. From this time line,
can we see priority inversions? Where?
Priority inversion occurs at time t=7; as T1 wants resource but the resource is already locked
by T3, So a low priority task is executed with high priority task waiting.
At time, t = 6 :T1 is released and executes for 1 unit time, at t=7 T1 requests for resource but
it is locked with T3 so T1 is pre-empted by T3. High priority job waits for low priority job to
execute (priority Inversion).
B) Identify the critical sections for the various tasks.
C) Change S protocol by Priority Inheritance Protocol (or PIP), and compute again the
scheduling simulation. With PIP, find task which blocks another with a higher priority,
runs its critical section with the blocked task priority. What can we see in this new
scheduling simulation about the shared resource? Say at which time the priorities of the
tasks change due to PIP.
Time t7: T1 requests for resource and is blocked, so T3 inherits the priority
Rate Monotonic Algorithm: Task with smallest time period will have highest priority
TASK FEASIBLE EXECUTION PRIORITY CRITICAL
INTERVAL TIME SECTION
J1 (6,10] 4 1 [R;3]
J2 (2,12] 6 2 [R;2.5]
J3 (0,14] 5 3 [R,2.5]
T3: J2 requests for resource but as it is locked with J3, J2 gets pre-empted and J3 continues
execution till completion. (High priority job pre-empted by low priority job – Priority
Inversion)
T7: J1 requests for resource but gets pre-empted as the resource is locked with J2 (priority
Inversion Point)
T17: J1 requests for resource but locked with J2, so gets pre-empted by J2 (priority
inversion)