Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions