Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

12. Three Tasks, ‘A’, ‘B’ and ‘C’ with task ‘A’ being the highest priority and t

ID: 3590956 • Letter: 1

Question

12. Three Tasks, ‘A’, ‘B’ and ‘C’ with task ‘A’ being the highest priority and task ‘C’ being the lowest, require to set up 3 differential timers as follows:
• At t = 15s task ‘A’ sets up a timer to expire in 15s and execute function f(a).
• At t = 20s task ‘C’ sets up a timer to expire in 9s and execute function f(c).
• At t = 25s task ‘B’ sets up a timer to expire in 6s and execute function f(b).
Select ALL answers that are correct:

A) At t= 26 secs the timer objects in the list are from tasks B, A and C (in the order stated, where B is at the head of the queue, A is in the middle and C is the end of the queue) and their time remaining values for these timers are 3 secs for task C timer, 1 sec for task A timer and 1 sec for task B timer.

B) At t= 16 secs the timer object in the list is from task A and its time remaining value is 14 secs.

C) At t= 21 secs the timer objects in the list are from tasks C and A (in the order stated, where C is at the head of the queue and A is the end of the queue) and their time remaining values for these timers are 8 secs and 9 secs respectively.

D) At t= 21 secs the timer objects in the list are from tasks C and A (in the order stated, where C is at the head of the queue and A is the end of the queue) and their time remaining values for these timers are 8 secs and 1 sec respectively.

E) At t= 21 secs the timer objects in the list are from tasks C and A (in the order stated, where C is at the head of the queue and A is the end of the queue) and their time remaining values for these timers are 7 secs and 2 secs respectively.

F) At t= 26 secs the timer objects in the list are from tasks C, A and B (in the order stated, so C is at the head of the queue, A is in the middle and B is the end of the queue) and their time remaining values for these timers are 2 secs for each timer.

Explanation / Answer

Differential Timer count maintains the lowest count of the timer at the head of the list. Instead of storing all the timer counts in sequence and performing multiple decrements, differential counter stores the difference between two consecutive counter timeouts. For example, if there are three timers: 14, 8, and 4 in the same sequence. The differential timer stores three entries, first entry is the head which is 4(least), second entry is also 4 (which indicates that the second entry needs 4 seconds to timeout after the first entry's timeout i.e difference between 4 & 8), and lastly the third entry is set to 6 (difference between 8 and 14).

Here at t=15s task A creates a timer of 15s so Entry in the differential counter will be:

head -> 15 (Task A)

At t=16 s, the head count will decrease by 1. So,

head -> 14 (Task A)

At t=20s, the value of differential timer will be:

head -> 10 (Task A)

Now at the same time Task C sets the timer to expire in 9 sec so since 9 < 10, It will be stored at the head of the list and the next entry will be 1(=10-9).

head -> 9 (Task C), 1 (Task A)

At t=21s,

head -> 8 (Task C), 1 (Task A)

At t=25s, the differential timer will have the values:

head -> 4 (Task C), 1 (Task A)

Now Task B sets upa timer of 6s, which is greater than 4 so it does not come at the head. Also the second entry here in the timer is 1s, which means it will take total 5s (4+1). So the timer of Task B goes in the third position and its value will be 6-5=1.

head -> 4 (Task C), 1 (Task A), 1 (Task B)

At t=26s,

head -> 3 (Task C), 1 (Task A), 1 (Task B)

Based on this the correct options are: A,B and D