Question: *Only main Java program is sufficient Problem Statement You are to develop a Java program to simulate the creation and execution of prioritized processes. You

 *Only main Java program is sufficient Problem Statement You are to
*Only main Java program is sufficient

Problem Statement You are to develop a Java program to simulate the creation and execution of prioritized processes. You will need to implement the following data types to support the simulation: A node type to represent a process. The node will contain a process id, a priority and a time slice (in milliseconds). The time slice indicates how long the process will "run" (i.e. sleep). A Min-Heap to store the process nodes so that a node with the lowest priority number is at the top of the heap ready to go when the next process is chosen. (NOTE: in many priority-based systems, priority O is the highest priority. IE the lower the number, the higher the priority). Because all of the threads in your program need to access this heap data structure, you must synchronize access to the operations on the heap that must not be interrupted before completion. A runnable/thread type to "consume"/retrieve a node off the top of the heap. The thread will simulate execution by sleeping for the duration of the time slice. When a process has completed its "execution," the thread reports the process id, its priority value, and the time when it completed. Use a single line for the report, and make sure that the time is precise enough to see sub-second execution times. If there is no work available on the heap, the thread must go to sleep for some pre-determined idle time in milliseconds. A second runnable/thread type to create and add processes to the heap. Let this thread wake up at random periodic intervals and add some new processes into the heap occasionally. [ this thread should wake up at least 3 times and add processes. It should not run forever Your main program will create a single heap. Your main program should spawn 2 instances of your consumer threads. The main program should pass a reference to the shared heap to all of its threads upon creation. Your consumer threads will pull the next available process off the heap and do their work. Your main program should spawn the thread that adds processes to the heap. Your program can detect that the producer thread is complete, and can then monitor the heap until it is empty. It must then notify the other idle consumer threads to exit. Other Requirements: Your program must be written in Java. Please use Netbeans (version 11+) or Intellij (114) to create your project. Problem Statement You are to develop a Java program to simulate the creation and execution of prioritized processes. You will need to implement the following data types to support the simulation: A node type to represent a process. The node will contain a process id, a priority and a time slice (in milliseconds). The time slice indicates how long the process will "run" (i.e. sleep). A Min-Heap to store the process nodes so that a node with the lowest priority number is at the top of the heap ready to go when the next process is chosen. (NOTE: in many priority-based systems, priority O is the highest priority. IE the lower the number, the higher the priority). Because all of the threads in your program need to access this heap data structure, you must synchronize access to the operations on the heap that must not be interrupted before completion. A runnable/thread type to "consume"/retrieve a node off the top of the heap. The thread will simulate execution by sleeping for the duration of the time slice. When a process has completed its "execution," the thread reports the process id, its priority value, and the time when it completed. Use a single line for the report, and make sure that the time is precise enough to see sub-second execution times. If there is no work available on the heap, the thread must go to sleep for some pre-determined idle time in milliseconds. A second runnable/thread type to create and add processes to the heap. Let this thread wake up at random periodic intervals and add some new processes into the heap occasionally. [ this thread should wake up at least 3 times and add processes. It should not run forever Your main program will create a single heap. Your main program should spawn 2 instances of your consumer threads. The main program should pass a reference to the shared heap to all of its threads upon creation. Your consumer threads will pull the next available process off the heap and do their work. Your main program should spawn the thread that adds processes to the heap. Your program can detect that the producer thread is complete, and can then monitor the heap until it is empty. It must then notify the other idle consumer threads to exit. Other Requirements: Your program must be written in Java. Please use Netbeans (version 11+) or Intellij (114) to create your project

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!