Scheduling Queues in process management:

Below is a list of the most common types of queues and their purpose.


Job Queue: Each entering process goes into job queue. Processes in job queue reside on mass storage and awaits the allocation of main memory.


Ready Queue: The set of all processes that are in main memory and are waiting for CPU time, are kept in ready queue.


Waiting (Device) Queues: The set of processes waiting for allocation of certain I/O devices, are kept in waiting device queue.

Process Migration between Various Queues:

During its lifetime, a process begins in the job queue. It moves between the ready, waiting and possibly job queues and eventually finishes the task. This process of moving between various queues is known as process migration.

Scheduler:

When more than one processes can be executed, the operating system must decide which one to run first. The part of the operating system concerned with this decision is called the scheduler. The algorithm used by scheduler is called the scheduling algorithm.


The operating system must perform three different kinds of scheduling:

1. Long Term Scheduling:


It is also known as job scheduling. It selects a process when it should be brought from job queue into ready queue. Too many processes in memory slow down the machine. Too few means the machine is not being utilized efficiently.


The long-term scheduler is invoked fairly infrequently and can be fairly slow. Processes are added to the system much less frequently than processes are swapped between the ready queue and CPU. The long-term scheduler usually has to make a more difficult decision than the short-term scheduler.


The long-term scheduler controls the degree of multiprogramming i.e. the number of processes in memory. If there are too few .processes in memory, the system is under-utilized. If there are too many processes, the system may spend too much time swapping between process because of a lack of resources (memory,, disks, etc.).


2. Short Term Scheduling:


It is also known as CPU scheduling. It selects a process from ready queue and gives' control of CPU to the process.


The short-term, scheduler is invoked very frequently and must be very fast. Processes typically only hold the CPU for short periods of time. While the short-term scheduler is deciding which job to run next the system is not performing any useful work.


3. Medium Term Scheduling:


It is also possible for an operating system to perform medium term scheduling. The medium term scheduler can remove processes from memory. It swaps the processes between memory and secondary storage. It improves the performance of the system by reducing the degree of multiprogramming. A process can be swapped out of the memory to adjust another process in the memory.


Context Switch:


Whenever the CPU switches to another process, the system must save the state of the old process and load the saved state of the new process. If context switch does not occur, the new process may use the data from the old one. It is probably not the same data that was left behind when it was last on the CPU.


Whenever a context switch is performed, the CPU performs no useful work. This means that we would like the context switch to take as less as possible. The time that a context switch takes is dependent on whether there is some hardware available to support the switching (multiple sets of registers, etc.) As an operating system becomes more complex, the process needs to restore more information like memory management details etc.

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Blog Archive

Powered by Blogger.

- Copyright © 2013 Taqi Shah Blogspot -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -