Question: process scheduler in an operating system is responsible for managing and controlling the execution of these multiple processes. The primary function of a process scheduler

process scheduler in an operating system is responsible for managing and controlling the
execution of these multiple processes. The primary function of a process scheduler is to
determines the order in which processes are executed on the CPU. It selects processes
from the ready queue and allocates CPU time to each process based on a scheduling
algorithms. For instance, the Round-Robin (RR) algorithm works as follows:
Each process is given an equal time slot (quantum ) to run in the CPU then it is interrupted
in circular order ?1. Therefore,
the number of time slots for a processes i= total execution time of processes i/quantum length
Suppose that the processes arrive at time 0 milliseconds(ms) in the order: P1,P2,P3 as in
the following table with execution time of each process and the quantum time is 4ms.
A normal process does not have a privilege, whereas a primary process does. This privilege consists
of a number(order) that specifies the number of consecutive CPU occurrences (time slots) that the
process may receive each time it executes in the queue
The scheduling will work as following (assuming the time slot/quantum time is 4ms):
Therefore, P1 needs 24/4=6 time slots to execute in CPU where each slot is 4ms. P2 needs
3 slots and P3 needs one slot.
Operation system scheduler can be evaluated by turnaround time and waiting time.
Turnaround time is the amou can be calculated as following:
turnaround time = completion time - arrival time
Waiting time is the amount of time a process has been waiting to get CPU which can be
calculated as following
waiting time= turnaround time - execution time
According to the information above turnaround time and waiting time can be calculated
for each process as below (time measured in ms):
Problem:
Write a program to simulate the work of processes scheduler by using RR algorithm wher
the structure of the input files as follows:
First line in the inputfile represents a process quantum size.
Other lines represent process type, arrival time, order for primary process (if exist),
and execute time.
Example 1 :
Input File
Output Sample
Round-Robin Scheduler ************************************************
The processes will run in order as the following:
P1 P2 P2 P3 P1 P2 P1 P1 P1 P1
Additional requirements:
Normal Process Class: This class represents the process where it has process type
ID , execute time and a completion time which can be set whenever the process
ID shouldbe unique and the class create it for each process (use static variable).
Provide the required methods accordingly.
. Primary process class: Has the same features exactly as the normal process but it
has order variable that represent the number of consecutive slots in the execution
schedule. Provide the required methods accordingly
Two lists of processes, represents the work of the scheduler. It has mainly
Two lists of processes, one of the list will be as a record of the processes while the ofther is to work on to
Quantum size
Clock, which is a simple counter to represent timing to run the list of
processes
the top (index 0) of the list
RunRR method: to represent the job of RR scheduler. You may need to
add more methods/lists to serve/help this method.
printPreformance() method: to display evaluation/performance of the
4cheduler like turnaround and waiting time. Check the sample of output. 4. RRTester Class: This class will read data of the processes from input file and add them to
a list. Then create RRSchedule object to execute the list of the processes.
The following code provides part of the RRTester Class
class RRTester {
public static void main(String[] args){
ArrayList= An operating system is the most important software that runs on a computer (Examples of OS: Windows, Linux, MAC, IOS, and Android). Processes of an Operating System refer to running programs or programs that are executing. There are 2 types of processes normal and primary process. In an operating system, multiple processes can run concurrently on a computer system. A process scheduler in an operating system is responsible for managing and controlling the execution of these multiple processes. The primary function of a process scheduler is to determines the order in which processes are executed on the CPU. It selects processes from the ready queue and allocates CPU time to each process based on a scheduling algorithms. For instance, the Round-Robin (RR) algorithm works as follows: Each processis given an equal time slot (quantum ) to run in the CPU then it is interrupted in circular order1. Therefore, the number of time slots for a processes i = total execution time of processes i / quantum length S
process scheduler in an operating system is

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 Programming Questions!