What is process scheduling
The procedure to schedule the process to execute on CPU is called process scheduling.
In a single processor system, one process can run at time.One process can run and other have to wait. Now, in multi-processor system, multiple process run at one time. The main purpose of multi-processing system is less the utilization of CPU.
Scheduling is basic function of operating system. CPU is important resource of OS. Most noteworthy, Scheduling use to know which process run first and which one after that.
Queue is the structure for holding element. Consequently, Queue provide additional insertion, inspection and extraction for element. For scheduling different types of queues use.
The process enter into the computer system put into queue on the disk is job queue. Then, the process in the job queue wait for the call of CPU.
The process from job queue is then send to ready queue for execution.The queue of process in the main memory is called ready queue. Probably, The ready queue is generally create in linked-list.
The process that are waiting for allocation of certain I/O devices for I/O operations are kept in waiting queue.
When multiple process are execute, the OS schedule the process.The part that schedules the process is called scheduler.
Types of Scheduler
Various types of scheduler may be use in OS.There are three types of schedulers.
- Long term scheduling
- Short term scheduling
- Medium term scheduling
Long term scheduling
Probably, Long term scheduler is Job Scheduler. It select job user program from job pool on the disk and load into main memory .The long term scheduler control the number of process in memory .The long term scheduler also provide jobs. Such as, I/O bound and processor bound job. It decide which next process select for execution. For this purpose, the long term scheduler spend comparative a long time for making decision.
Short term scheduling
Short term scheduler retrieve a process from ready queue and allocate CPU to process .The process state is change from ready to running. If an interrupt or time-out occurs during execution, the scheduler places the running process back into the ready queue and makes it ready. Hence,A process may execute for only a few milliseconds, and then next process is select from ready queue for execution.
Medium term scheduler
The medium term schedule is also known as swap .In this type of schedule, swapper is used to exchange (or swap) processes between main memory and secondary disk.Probably, multiprocessing systems use swapping technique. Sometimes,a process that in job queue on disk is too long and cannot fit in memory. Consequently, then swapper removes another process from ready queue to make room for it .If a process is wait for complete of short term I/O operation, then it is not swapped out .