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 RoundRobin 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 Therefore,
the number of time slots for a processes total execution time of processes quantum length
Suppose that the processes arrive at time millisecondsms in the order: as in
the following table with execution time of each process and the quantum time is
A normal process does not have a privilege, whereas a primary process does. This privilege consists
of a numberorder 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 slotquantum time is :
Therefore, P needs time slots to execute in CPU where each slot is P needs
slots and P 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 :
Input File
Output Sample
RoundRobin Scheduler
The processes will run in order as the following:
P P P P P P P P P P
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 of the list
RunRR method: to represent the job of RR scheduler. You may need to
add more methodslists to servehelp this method.
printPreformance method: to display evaluationperformance of the
cheduler like turnaround and waiting time. Check the sample of output. 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 mainString 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 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 RoundRobin RR algorithm works as follows: Each processis given an equal time slot quantum to run in the CPU then it is interrupted in circular order Therefore, the number of time slots for a processes i total execution time of processes i quantum length S
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
