CS 3733 Operating Systems, Spring 2005 Class Assignment from March 2
Consider 2 producer processes that share an integer variable, count,
that is inialized to 0.
Each producer executes the code:
for (i=0;i<9;i++)
count++;
where i is a local variable (not shared).
- What are the possible values of count when both producers have
completed this code?
- Give a sequence of events (explaining when each process loses the CPU)
that gives the minimum possible value for count.
Do not hand this in, but extra credit will be given to the first student
that emails a correct solution to me.
David Tsai was the only one to submit a correct answer and received 5 extra
points on his first midterm exam.
The smallest possible value is 2 and any value from 2 to 20 is possible.