Question
Consider a uniprocessor system executing three tasks , and , each of which is composed of an infinite sequence of jobs (or instances) which arrive periodically at intervals of , and 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 , and requires an execution time of , and milliseconds, respectively. Given that all tasks initially arrive at the beginning of the millisecond and task preemptions are allowed, the first instance of completes its execution at the end of _____ milliseconds.
Official answer and solution
- Official answer
- 12
- From
- Official GATE 2015 answer key
Solution
Trace rate-monotonic scheduling cycle-by-cycle using static priorities assigned inversely to task periods.
-
Task parameters and priorities:
- Task : period , computation time . Priority: Highest.
- Task : period , computation time . Priority: Medium.
- Task : period , computation time . Priority: Lowest.
All three tasks arrive at .
-
Execution timeline:
- Time : runs for and completes its first instance. (Remaining: needs , needs .)
- Time : runs for and completes its first instance. (Remaining: needs .)
- At : arrives (instance 2). Priority .
- Time : runs for and completes instance 2.
- Time : runs for . ( has execution remaining.)
- At : arrives (instance 3). Preempts .
- Time : runs for and completes instance 3.
- At : arrives (instance 2). Priority .
- Time : runs for and completes instance 2.
- At : arrives (instance 4). Priority .
- Time : runs for and completes instance 4.
- At : No higher priority tasks are pending. Next arrival is at .
- Time : resumes and executes its remaining , finishing at .
Hence, the first instance of completes its execution at the end of milliseconds.
12
Forgetting the preemption by T2 at t = 7 ms when tracing the timeline.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2015 Computer Science and Information Technology (CS) Session 1
- Question
- 56 of 65, printed as CS Q.46
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.