Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Write an original code that follows the requirements of this assignment. Thanks image text in transcribed
image text in transcribed
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

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions

Question

What is the double-coincidence of wants?

Answered: 1 week ago