Skip to content
Official PYQ · 2015

GATE CS 2015 Set 1 Q46 — CPU Scheduling

Explain with AI
Consider a uniprocessor system executing three tasks T1,T2T_{1}, T_{2} and T3T_{3} each of which is composed of an infinite sequence of jobs (or instances) which arrive periodically at intervals of 3,73, 7 and 2020 milliseconds, respectively. The priority of each task is the inverse of its period, and the available tasks are scheduled in order of priority, which is the highest priority task scheduled first. Each instance of T1,T2T_{1}, T_{2} and T3T_{3} requires an execution time of 1,21, 2 and 44 milliseconds, respectively. Given that all tasks initially arrive at the beginning of the 1st1^{\text{st}} millisecond and task preemptions are allowed, the first instance of T3T_{3} completes its execution at the end of_____________________milliseconds.
View worked solution

Answer: 12

The priority of each task is inversely proportional to its period. Thus, the priority order (from highest to lowest) is:

Priority(T1)>Priority(T2)>Priority(T3)\text{Priority}(T_1) > \text{Priority}(T_2) > \text{Priority}(T_3)

The task parameters are:

  • T1T_1: Period P1=3P_1 = 3 ms, Execution time C1=1C_1 = 1 ms
  • T2T_2: Period P2=7P_2 = 7 ms, Execution time C2=2C_2 = 2 ms
  • T3T_3: Period P3=20P_3 = 20 ms, Execution time C3=4C_3 = 4 ms

Tracing the execution timeline from t=0t = 0:

  1. [0 to 1 ms]: T1T_1 (1st instance) runs and completes.
  2. [1 to 3 ms]: T2T_2 (1st instance) runs and completes.
  3. [3 to 4 ms]: T1T_1 (2nd instance) arrives at t=3t = 3, preempts other tasks, runs, and completes.
  4. [4 to 6 ms]: T3T_3 (1st instance) runs for 22 ms (requires 22 ms more).
  5. [6 to 7 ms]: T1T_1 (3rd instance) arrives at t=6t = 6, preempts T3T_3, runs, and completes.
  6. [7 to 9 ms]: T2T_2 (2nd instance) arrives at t=7t = 7, preempts T3T_3, runs, and completes.
  7. [9 to 10 ms]: T1T_1 (4th instance) arrives at t=9t = 9, preempts T3T_3, runs, and completes.
  8. [10 to 12 ms]: T3T_3 resumes and runs for its remaining 22 ms, completing at t=12t = 12 ms.

Thus, the first instance of T3T_3 completes its execution at the end of 12 milliseconds.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore CPU Scheduling questions