Question
By programming in C: Create a CPU scheduler that runs a round-robin algorithm. Each client sends the server an integer named burst (that represents a
By programming in C:
Create a CPU scheduler that runs a round-robin algorithm. Each client sends the server an integer named burst (that represents a CPU burst) and the name of its private FIFO through the common FIFO, named commonFIFO. The common FIFO is made only one time, and will be opened for reading only one time before processing any client data. The server is asked for a number of clients and an integer time quantum named timeQuant. All processes arrive at the Ready Queue at time zero and are enqueued in the order they are submitted.
The server receives input from each of several clients. The server reads the input integer from a client, creates a node (a PCB) for the client, then enqueues the PCB to a queue named Ready. This is done for each client. Display the contents of the queue periodically.
After all client information has been read and stored in the nodes of the queue, processing can begin. The process represented by the process at the head of Ready will run until the process completes or the time quantum expires. If the process completes, the client will be notified of the completion time and the process is removed from the system. If the time quantum expires, the node will be enqueued to Ready and the remaining time for burst is stored back into that node (its PCB). The clock can be manipulated by adding one to the clock to represent handling one CPU burst at a time.
A clock value (a counter) records the current time.
When a clients burst is completed (equals 0), the value that is in clock is recorded, a turnaround time is calculated and both the clock value and the turnaround time are sent back to the client through its private FIFO. The server also reports when a client completes and the current clock time. When all clients have completed processing, the server reports the average turnaround time for the set of jobs.
Server Note:
commonFIFO is created and opened once.
When all clients have completed and results have been displayed, the server shuts down.
Client Note: The client program is one program that is run multiple times, thus, you will open multiple windows that run the client program.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started