Professional Documents
Culture Documents
4.1 Scheduling - Objectives, Concept, Criteria, CPU and I/O Burst Cycle. Objectives
4.1 Scheduling - Objectives, Concept, Criteria, CPU and I/O Burst Cycle. Objectives
3. Turnaround time –
For a particular process, an important criteria is how long it takes
to execute that process. The time elapsed from the time of
submission of a process to the time of completion is known as the
turnaround time. Turn-around time is the sum of times spent
waiting to get into memory, waiting in ready queue, executing in
CPU, and waiting for I/O.
4. Waiting time –
A scheduling algorithm does not affect the time required to
complete the process once it starts execution. It only affects the
waiting time of a process i.e. time spent by a process waiting in
the ready queue.
5. Response time –
In an interactive system, turn-around time is not the best criteria.
A process may produce some output fairly early and continue
computing new results while previous results are being output to
the user. Thus, another criteria is the time taken from
submission of the process of request until the first response is
produced. This measure is called response time.
Resources are allocated according Resources are used and then held
to the cycles for a limited time. by the process until it gets
terminated.
Pre-emptive Scheduling Non-Pre-emptive Scheduling
With this scheme, the process that requests the CPU first is allocated the
CPU first.
The implementation of the FCFS policy is easily managed with FIFO queue.
When a process enters the ready queue, its PCB (Process Control Block) is
linked onto the tail of the queue.
When the CPU is free, it is allocated to the process at the head of the queue.
The running process is then removed from the queue.
FCFS scheduling is non-pre-emptive, very simple, can be implemented with
a FIFO queue, Not a good choice when there are variable burst times (CPU
bound and I/O bound), drawback: causes short processes to wait for longer
ones.
When the CPU is available, it is assigned to the process that has the
smallest next CPU burst.
If the two processes have the same length or amount of next CPU burst,
FCFS scheduling is used to break the tie.
A more appropriate term for this scheduling method would be the shortest
next CPU burst algorithm because scheduling depends on the length of the
next CPU burst of a process rather than its total length.
SJF works based on burst times (not total job time), difficult to get this
information, must approximate it for short term scheduling, used frequently
for long term scheduling, pre-emptive (SJF) or non-pre-emptive (SRTF),
Special case of priority scheduling.
Priority Scheduling
A priority is associated with each process and the CPU is allocated to the
process with the highest priority, Equal priority processes are scheduled in
FCFS order.
We can be provided that low numbers represent high priority or low
numbers represent low priority, According to the question, we need to
assume anyone of the above.
Priority scheduling can be either pre-emptive or non-pre-emptive.
A pre-emptive priority scheduling algorithm will pre-empt the CPU, if the
priority of the newly arrived process is higher than the priority of the
currently running process.
A non-pre-emptive priority scheduling algorithm will simply put the new
process at the head of the ready queue.
Process Table
Let’s take time quantum = 4 ms. Then the resulting RR schedule is as Follows
P1 waits for the 6 ms (10 – 4), P2 waits for 4 ms and P3 waits for 7 ms.
Thus,
Average waiting time
Multiple-Processor Scheduling
Real-Time Scheduling
Real-time computing is divided into two types. Hard real-time systems are required to
complete a critical task within a guaranteed amount of time. Generally, a process is
submitted along with a statement of the amount of time in which it needs to complete
or perform I/O. The scheduler then either admits the process, guaranteeing that the
process will complete on time, or rejects the request as impossible. This is known as
resource reservation.
Soft real-time computing is less restrictive. It requires that critical processes receive
priority over less fortunate ones. Implementing soft real-time functionality requires
careful design of the scheduler and related aspects of the operating system. First, the
system must have priority scheduling, and real-time processes must have the highest
priority. The priority of real-time processes must not degrade over time, even though
the priority of non-real-time processes may. Second, the dispatch latency must be
small. The smaller the latency, the faster a real-time process can start executing once it
is runnable. The high-priority process would be waiting for a lower-priority one to
finish. This situation is known as priority inversion. In fact, a chain of processes
could all be accessing resources that the high-priority process needs. This problem can
be solved via the priority-inheritance protocol, in which all these processes (the ones
accessing resources that the high-priority process needs) inherit the high priority until
they are done with the resource in question. When they are finished, their priority
reverts to its original value.