GATE | GATE-CS-2015 (Set 1) | Question 65

Consider a uniprocessor system executing three tasks T1, T2 and T3, each of which is composed of an infinite sequence of jobs (or instances) which arrive periodically at intervals of 3, 7 and 20 milliseconds, respectively. The priority of each task is the inverse of its period and the available tasks are scheduled in order of priority, with the highest priority task scheduled first. Each instance of T1, T2 and T3 requires an execution time of 1, 2 and 4 milliseconds, respectively. Given that all tasks initially arrive at the beginning of the 1st milliseconds and task preemptions are allowed, the first instance of T3 completes its execution at the end of ______________ milliseconds.
(A) 5
(B) 10
(C) 12
(D) 15

Answer: (C)

Explanation: Periods of T1, T2 and T3 are 3ms, 7ms and 20ms.

Since priority is inverse of period, T1 is the highest priority task, then T2 and finally T3

Every instance of T1 requires 1ms, that of T2 requires 2ms and that of T3 requires 4ms

Initially all T1, T2 and T3 are ready to get processor, T1 is preferred

Second instances of T1, T2, and T3 shall arrive at 3, 7, and 20 respectively.

Third instance of T1, T2 and T3 shall arrive at 6, 14, and 40 respectively.

Time-Interval  Tasks   
 0-1            T1     
 1-2            T2      
 2-3            T2     
 3-4            T1  [Second Instance of T1 arrives] 
 4-5            T3     
 5-6            T3     
 6-7            T1  [Third Instance of T1 arrives]                        
                    [Therefore T3 is preempted] 
 7-8            T2  [Second instance of T2 arrives]                            
 8-9            T2
 9-10           T1  [Fourth Instance of T1 arrives]                          
10-11           T3
11-12           T3 [First Instance of T3 completed]

Quiz of this Question

My Personal Notes arrow_drop_up

Improved By : Stranger1