Académique Documents
Professionnel Documents
Culture Documents
Several definitions of process : A program in execution An asynchronous activity The entity to which processors are assigned The dispatchable unit
Process states
A process goes through a series of discrete process
Process states
During process state transition, 2 types of list are
Process states
Ready list Consists of ready processes Is maintained in priority order The next process to receive the CPU is the first process in the list
Process states
Blocked list Consists of blocked process Normally unordered Processes will become unblocked in the order in which the events they are waiting for occur
Ready
Blocked
Wakeup
Interrupt
An event that change the sequence in which a
processor execute instructions Prevents a process from monopolizing the system OS sets interrupting clock/interval timer to allow user to run in a specific time interval.
If process does not free CPU in interval time,
interrupting clock generates an interrupt that cause OS to regain control OS turn the previously running process to ready, and makes the first process on the ready list running
Long-term scheduling
determines : which and when certain programs are admitted to the system for execution which and when certain programs should be exited runs relatively infrequently, when a decision must be
Long-term scheduling
once a new process is accepted (and partially created)
initially fully available to the new process, it may be admitted to the tail of the Ready queue. If not all resources are immediately available, the new process may be instantiated in the Blocked-Suspended queue until those resources are provided.
Medium-term scheduling
determines when processes are to be suspended and
resumed The medium-term scheduler runs more frequently, deciding which processs pages to swap to and from the swapping device: typically once a second.
Medium-term scheduling
the success of the medium-term scheduler is based on
the degree of multiprogramming that it can maintain, by keeping as many processes runnable as possible. more processes can remain executable if we reduce the resident set size of all processes. makes decisions as to :
which pages of which processes need stay resident, and
other processes.
Short-term scheduling
determines which of the ready processes can have CPU
resources, and for how long. also called as the dispatcher executes most frequently(every few hundredths of a second) making fine-grained decisions as to which process to move to Running next.
Short-term scheduling
is invoked whenever an event occurs
provides the opportunity, or requires, the interruption
of the current process and the new (or continued) execution of another process.
Scheduling algorithms:
First in first out(FIFO)
Round robin scheduling (RR) Shortest job first (SJF) Shortest remaining time (SRT) Priority (P) Multilevel queue (MLQ) Multilevel feedback queue (MLFQ)
time on the ready queue Process that has the CPU will run until complete Non preemptive scheduling algo.
to priority but processes with the same priority are dispatched FIFO
FIFO
Ready list
CPU
Dispatch
Completion
Running
Block
Timerrunout
Ready
Blocked
Wakeup
Round Robin(RR)
Process are dispatched FIFO but are given a limited
amount of CPU time(time-slice or quantum) If a process does not complete before its CPU time expires, the CPU is preempted and given to the next waiting process The preempted process is placed at the back of the ready list
Round Robin(RR)
Advantage: Effective in timesharing environments in which the system needs to guarantee reasonable response times for interactive users
Round Robin(RR)
Ready list Completion
CPU
Preemption
(does not complete before CPU time expires)
completion is selected to run next, including new arrivals A running process may be preempted by a new process with a shorter estimated run-time
Priority
A priority is associated with each process
The CPU is allocated to the process with the highest
Priority
Internally defined priorities use some measurable
ratio of average I/O burst time to average CPU burst time etc.
Priority
External priorities are set by criteria that are external
funds being paid for computer use, the department sponsoring work and other often political factors.
Priority
Priority scheduling can be : preemptive or non preemptive.
Priority
A preemptive priority scheduling algorithm will
preempt the CPU if the priority of the newly arrived process is higher than the priority of the currently running process.
Priority
A non preemptive priority scheduling algorithm will
simply put the newly arrived process at the head of the ready queue.
Priority
Disadvantage : indefinite blocking or process starvation. This can be solved by a technique called aging wherein we gradually increase the priority of a long waiting process.
Multilevel Queue
Partitions the ready queue into several separate
queues. The processes are permanently assigned to one queue based on some property of the process. Eg :
Interactive process
Batch process
Multilevel Queue
Each queue has its own scheduling algorithm.
In addition, there must be scheduling between the
Multilevel Queue
Ready Queue 1
System Processes SJF
Interactive Processes RR
Ready Queue 3
Batch Processes FIFO
priority level. A job that is ready to run can only be on a single queue.
given time:
a job with higher priority (i.e., a job on a higherqueue) is
behavior. Eg:
If, for example, a job repeatedly release the CPU while
waiting for input from the keyboard, MLFQ will keep its priority high. If a job uses the CPU intensively, MLFQ will reduce its priority.
they run, and thus use the history of the job to predict its future behavior.
Priority 1
Priority 2
Queue 3, FIFO
Priority 3