Race Conditions

This is a modification of Exercise 2 at the end of Chapter 3 of the text. Run race.java and verify that there are no race conditions for M=1000. Explain why you think this is true. Introduce time-slicing with a Scheduler object. Experimentally determine the largest time-slice value passed to the Scheduler object's constructor that will consistently cause incorrect output due to a race condition for M=1000. Report and explain your findings.

Next, start with a fixed time-slice of 10 milliseconds using the Scheduler and find the smallest value of M that will consistently cause incorrect output due to a race condition. Report and explain your findings.

Finally, answer Exercise 5 at the end of Chapter 3 of the text: Identify the race condition(s) that could occur in Class 3.8 if there were more than one producer thread and/or consumer thread.