Every preemption of one task by another task potentially results in two context
ID: 3708718 • Letter: E
Question
Every preemption of one task by another task potentially results in two context switch activities: one switch from the lower-priority task and one switch back again when the preempting task completes. This means that each time a higher-priority task ?h preempts a lower-priority task ?l , the scheduler must perform the following actions:
-Save context of ?l
-Load context of ?h
-Let ?h execute until completion
-Save context of ?h for the next instance
-Load context of ?l
Assume that for all the tasks, the time to save the context is at most Csave and the time to load the context is Cload . Extend the original response time analysis formula for rate monotonic scheduling to consider context switches among tasks. Even for a task that is never preempted, its execution time must be added by Csave and Cload .
Explanation / Answer
Solution:
Suppose there are x processes with the preemption and z processes without the preemption.
and number of context switches between the preempted processes is y
then
the rate will be= x*y(Csave+Cload) + z*(Csave+Cload)
This will be the time for completion of all the processes.
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.