Question: A = 5 , B = 1 5 , C = 4 5 0 0 4 . Assume the following pseudocode is run by two

A=5, B=15, C=4500
4. Assume the following pseudocode is run by two threads at approximately the same time on a
single processor machine.
do_something(); // takes T unit time to execute (T is less than C)
mutex_lock();
do_something_else(); // takes no time to execute
mutex_unlock();
exit(); // takes no time to execute
Assume also that a simple spin lock is used. The time required for acquiring this lock
(mutex_lock) is A unit time and the time required for releasing it (mutex_unlock) is also A unit
time. Context switch time is B unit time. A thread works at most C unit time before the context
switch happens (i.e., time slice (quantum)= C).
a) What would be the total completion time of the two threads in the best possible case?
(10 points)
b) What would be the total completion time of the two threads in the worst possible case?
(10 points)
Hint: In both answers, the completion time is equal to a numerical value plus 2T (you do not know hence
do not need to specify the value of T).
Note: In your answer, please

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!