Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4 . Assume the following pseudocode is run by two threads at approximately the same time on a single processor machine. do _ something (

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

Please help me evaluate this integral. 8 2 2 v - v

Answered: 1 week ago

Question

4. Identify the challenges facing todays organizations

Answered: 1 week ago