Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

15 Points Class X holds a data buffer, and has synchronized methods C (for consuming from buffer) and S (for supplying to buffer). Consider an

image text in transcribed

image text in transcribed

15 Points Class X holds a data buffer, and has synchronized methods C (for consuming from buffer) and S (for supplying to buffer). Consider an instance of class X, consumer threads T1 and T2, and supplier thread T3, and the following sequence of actions on - Thread T1 enters method C, and at some point issues a , because T3 hasn't supplied yet - Subsequently, thread T2 enters method C, and at some point issues a , because T3 hasn't supplied yet - Finally, thread T3 enters method S, fills in the supply, issues a finishes and exits S Assume that T3's supply is sufficient for only one of the consumers, and that once T3 has finished executing S as above, it is terminated (i.e. it will not return to S again). But T1 and T2 are insatiable and will want to keep coming back to method C for more. Assume that there is no attempt by the application to safely terminate either T1 or T2, i.e. they are allowed to keep running. List ONE plausible sequence of thread states that T1 and T2 might go through, starting from the time they issue a as described above, up to the time when there will not be any more state changes. For the purpose of this question, assume that there is an additional state, RUNNING, for when a thread is actually executing on the CPU. For each state change of each of T1 and T2, specify the cause of change of state. Enter your answer here

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

Students also viewed these Databases questions

Question

4. Identify cultural variations in communication style.

Answered: 1 week ago