Question: Using Java - A writer prepares his book. He works with two processes; the write and the edit. When he is in the write phase
Using Java A writer prepares his book. He works with two processes; the write and the edit. When he is in the write phase is prevented to go to the edit phase by using a lock mechanism. The same with the edit stage. Prepare a program that provides these possibilities using the executor framework.
With this framework it is needed to prepare the runnable objects and leave the executor to run them.
Two tasks classeswriteOn,writeOff are introduced and are used for the executor. A mutex is used by the basic class Book for mutual exclusion. A condition can be used to suspend a task.
The output will be alternately: Write On now, Write Off now. writdeitjava
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
