written 3.1 years ago by |
There are multiple processes that want to execute at a time but only one process can be assigned to the CPU for its execution. From this, the question arises, among different processes which process has to be allowed first? For this, the solution we have is scheduling the processes.
Scheduling can be defined as the following a certain mechanism for process allocation to the CPU. There are different scheduling algorithms such as -
first come first serve, shortest job first, priority-based scheduling, shortest remaining time, round-robin scheduling, multiple-level queues scheduling.
However, there are specific characteristics that help us to design a good scheduler-
CPU Utilization: A scheduling algorithm should be busy as much as possible. The algorithm should make efficient use of the CPU.
, For example,: We know the program file is in secondary storage. To assign the program file to the CPU, firstly, it has to be loaded into the main memory (primary storage). The time taken to assign the process from the main memory to the CPU is far less than the time taken to shift the program file from secondary storage to the main memory. Meanwhile, in this shifting process, the CPU would be completing its job and is idle by waiting for executing the other process which results in not using the CPU efficiently.
Throughput: It is the amount of work completed in a unit of time. In other words, throughput is the number of processes executed in a unit of time. Therefore, the scheduling algorithm has to maximize the number of jobs processed per unit time.
Response time: It is the time taken to respond to a request. The scheduler has to minimize the response time as much as possible.
Turnaround time: It is the time between the process entering the ready queue and the process terminates i.e when it comes out of the CPU after its execution. Minimum turnaround time is one of the features of a good scheduler.
TAT = CT - AT [ turnaround_time = completion_time - arrival_time ]
Waiting time: It is the time a job waits for the resource allocation when several jobs are being executed in a multiprogramming system. The aim is to minimize the waiting time.
Fairness: The scheduler should give the process a fair chance to access the CPU. It should make sure no process would wait indefinitely resulting in starvation (Starvation is indefinite blocking phenomenon of the process because of certain features of the algorithm such as priority).