Write an original code that follows the requirements of this assignment. Thanks
Synchronization Problem: Suppose a processor can service only one process at any time instant but ha a buffer of size 6 associated with it. That is, at most 6 processes can wait for the processor while it is servicing a process. The following happen between the processor and processes: If there are no processes, the processor is idle. If a process arrives in the buffer and the buffer is full, then the process leaves the system and never returns If the processor is busy but buffer is not full, then the arriving process waits in one of the free spaces in the buffer. If the processor is idle, the process wakes up the processor to get service. Write a program to coordinate (synchronize) the processor and the processes. You can put the upper limit of stream of processes to 30 Hints: You could view each process as a separate Java thread. You may construct a new system scenario with a processor for threads to get service. (The processor can be viewed simply as an object having some state value as "busy You may set the system to have a buffer with 6 places. You can make all places be initially empty. Also, you may set the processor to be idle so that when the first thread comes in, it can wake the processor up. lf the processor was busy, then this thread has waited in the buffer. Entering threads will have to wait for the existing threads to be serviced. As far as which waiting thread will get service next is up to the JVM You should have methods to control the inflow, preferably random, of threads. That is, when a new thread would appear, should be random (threads should not appear in regular pre-defined intervals). Also, the service time should be random (that is, the processor cannot take fixed set mount of time for each thread). You could use thread sleeputility together with random numbers to implement these Typical output may look like the following. However, you are free to modify the print statements to show the synchronization. Make sure that your output conveys the same information as the sample output. Sample output (continued to next page): ENTERING SYSTEM: Thread (0) entering the system for service. PROCESSOR IS IDLE Thread is waking processor up and getting service. LEAVING SYSTEM: Thread loj service finished: leaving system