Scheduling WJEC Revision

Scheduling is the method by which CPU time is allocated in a multi-access system. Because the CPU can work much faster than any peripheral, it is important to keep the CPU as active as possible, therefore scheduling is used to increase the efficient use of the CPU time.

e.g. A multiprogramming system has a number of jobs (user programs and data) stored in memory. Each job is allocated a small amount of processing time (time slice) in turn. The scheduler is that part of the operating system which decides which job is to be processed next.

A simple illustration

Suppose there are 3 jobs which each require three equal time requirements – CPU (active) then use of a peripheral (active) then CPU (active) again… The top of the diagram shows how the three jobs would be tackled in a simple serial fashion, with each job waiting for the previous job to finish.

It takes 9 time slices to complete the three jobs.

The scheduler could allocate the CPU time so that the three jobs are completed faster:

It now takes only 6 time slices to complete the three jobs. Whenever there is a break in the execution of a job (eg an interrupt occurs or the job requires use of a peripheral), the scheduler is used to decide which job should continue processing next. The decision is normally based on job priorities, and the scheduler normally maintains a job queue for this purpose. Jobs with high priorities may 'jump' the queue.

Scheduling Policies

A scheduling policy should try to: • Process as many jobs as possible in as little time as possible. • Balance resource use. e.g. if a printer is idle, a high priority could be given to a job that uses the printer. • Avoid pushing low priority jobs to the back of the queue indefinitely. This can be achieved by giving jobs a higher priority based on how long they have been in the queue. • Maximise the number of interactive users receiving acceptable response times (the time between issuing a request to a computer and receiving a response).

There are three basic states a program/process can be in while stored in the scheduler queue:

READY – A process is waiting to continue execution (processing) by the CPU RUNNING – A process is being executed (processed) by the CPU BLOCKED – A process is waiting for an event, e.g. waiting for an input/output operation with a slow peripheral. When the peripheral becomes available, the status returns to READY

Several processes may be READY at any one time. Only one process will be RUNNING at any one time. Several processes may be BLOCKED at any one time.

computer science


QR Code
QR Code scheduling_wjec_revision (generated for current page)