Sunday, August 9, 2009

Different cpu scheduling algorithms



CPU Scheduling of Batch Processes
-Submitted with a good estimate of their resource needs, via job control statements
-Upper limits the OS is expected to enforce
-Generally expected that the OS will give preferential treatment to processes with lower resource needs.
-Resource estimates may also include the specification of an initial priority for a job


For batch processesscheduling occurs at 2 levels:Long-term and short term
Job Scheduling (long term)


-Job scheduling involves deciding which job (job step) to admit into the system as a process. A job is a program which has been submitted to the system, but which has not been loaded into memory.
-Initial resource estimates play an important role of scheduling at the job level. A job can not be loaded until sufficient resources are available.


A “Job”

1) typically consists of multiple steps

2) Job control statements provide information about the resource needs of each step. Including program to execute, maximum memory requirements, and cpu time limits, and user information

3) Waiting jobs are stored in one or more job queues, ordered by priority or class, which is determined by their announced resource needs.

4) System processes called initiators, examine the job queues and selects jobs when the system is ready for more work.

5) Jobs are admitted only when sufficient resources are available to begin the first “step”. Also each additional step is admitted only when resources are available.

6) Once a step has been admitted, it holds all of its resources until it is complete. A timer is set to ensure that it does not exceed its planned processor time.

Short term scheduling

-When the processor (CPU) is available, a process from the ready queue(s) is selected according to some type of algorithm.
-The process is then given control of the CPU and continues running until:


-The process terminates
-The process voluntarily suspends itself (sleep)
-The process requests an I/O transfer or other service for which it must wait
-The process is stopped because it has exceeded its processor time quantum (maximum CPU time for the entire job, or step!)
-IF preemption is allowed: a higher priority process becomes ready. (preemption is usually not used in a batch environment.)


No comments: