Assume an operating system follows First Come First Serve (FCFS) process scheduling algorithm. In the FCFS scheduling, processes are allocated to the CPU for execution as per their arrival sequence. Write a menu-driven program in Java to implement FCFS scheduling algorithm using a queue. Users can execute as many processes as they wish. Your program will follow the menu options to insert a new process in the queue, allocate the first process waiting in the queue to the CPU for execution, and to print appropriate messages depending on the situations. You can use relevant Java built-in classes in your code. The sample inputs/ outputs are given below: Sample inputs and outputs: (User’s inputs are shown in bold) Press 1 to insert a new process to the process queue Press 2 to allocate a process to the CPU for execution Press 3 to terminate the program Enter your choice: 2 Sorry, no process is available in the process queue Enter your choice:
Comments
Leave a comment