Answered step by step
Verified Expert Solution
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 (
Assume the following pseudocode is run by two threads at approximately the same time on a
single processor machine.
dosomething; takes T unit time to execute T is less than C
mutexlock;
dosomethingelse; takes no time to execute
mutexunlock;
exit; takes no time to execute
Assume also that a simple spin lock is used. The time required for acquiring this lock
mutexlock is A unit time and the time required for releasing it mutexunlock 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 ie time slice quantum C
a What would be the total completion time of the two threads in the best possible case?
points
b What would be the total completion time of the two threads in the worst possible case?
points
Hint: In both answers, the completion time is equal to a numerical value plus T 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started