Thursday, July 16, 2009

Operating system 4



2.Process Sheduling
Scheduling is a key concept in
computer multitasking and multiprocessing operating system design, and in real-time operating system design. In modern operating systems, there are typically many more processes running than there are CPUs available to run them. Scheduling refers to the way processes are assigned to run on the available CPUs. This assignment is carried out by software known as a scheduler.

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.
-Process migration between the various queues.

Representation of Process Scheduling







B-Schedulers



Types of operating system schedulers




-Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue.

-Mid-term Scheduler

The mid-term scheduler, present in all systems with
virtual memory, temporarily removes processes from main memory and places them on secondary memory (such as a disk drive) or vice versa. This is commonly referred to as "swapping out" or "swapping in" (also incorrectly as "paging out" or "paging in"). The mid-term scheduler may decide to swap out a process which has not been active for some time, or a process which has a low priority, or a process which is page faulting frequently, or a process which is taking up a large amount of memory in order to free up main memory for other processes, swapping the process back in later when more memory is available, or when the process has been unblocked and is no longer waiting for a resource.

-Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU.


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 Swicth
-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.

No comments: