Process Scheduling

|

The assignment of physical processors to processes allows processors to accomplish work. The problem of determining when processors should be assigned and to which processes is called processor scheduling or CPU scheduling.

When more than one process is runable, the operating system must decide which one first. The part of the operating system concerned with this decision is called the scheduler, and algorithm it uses is called the scheduling algorithm.

Goals of Scheduling (objectives)
In this section we try to answer following question: What the scheduler try to achieve?
Many objectives must be considered in the design of a scheduling discipline. In particular, a scheduler should consider fairness, efficiency, response time, turnaround time, throughput, etc., Some of these goals depends on the system one is using for example batch system, interactive system or real-time system, etc. but there are also some goals that are desirable in all systems.
a.)Scheduling Queues
  • Job queue – set of all processes in the system
  • Ready queue – set of all processes residing in main memory, ready and waiting to execute
  • Device queues – set of processes waiting for an I/O device
  • Processes migrate among the various queues

Ready Queue And Various I/O Device Queues

b.) Schedulers

  • Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue.
  • Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU.
  • Mid term scheduler

Addition of Medium Term Scheduling

  • Short-term scheduler is invoked very frequently (milliseconds) Þ (must be fast)
  • Long-term scheduler is invoked very infrequently (seconds, minutes) Þ (may be slow)
  • The long-term scheduler controls the degree of multiprogramming
  • Processes can be described as either:
    - I/O-bound process – spends more time doing I/O than computations, many short CPU bursts
    - CPU-bound process – spends more time doing computations; few very long CPU bursts

c.) Context Switch

  • When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process
  • Context-switch time is overhead; the system does no useful work while switching
  • Time dependent on hardware support

CPU switch form process0 to Process1

0 comments:

Post a Comment