TimeLinux1

Thursday, May 19, 2011

CPU Scheduling Notes

cpu scheduling:
-the objective of multiprogramming is to maximize cpu utilization.
-to do this a process is run on the cpu until it must wait.
-during the wait time, another process is picked up from a pool of processes in memory to run on the cpu.
-this picking action is done by the cpu-scheduler.
-in real terms it is the kernel threads not processes that are being scheduled.
-thus process scheduling and thread scheduling are often used interchangeably.
-the queue of processes in memory that are ready to run is called 'ready-queue'.
-note: the ready-queue (that the scheduler chooses from) is not necessarily a fifo queue.
-the entries in the ready-queue are pcb (process control blocks) of processes.
-scheduling can be either preemptive or cooperative.
-in cooperative scheduling a process keeps running until it must wait or it completes its task.
-cooperative scheduling is also called as non-preemptive scheduling.
-in preemptive  scheduling a process runs when it changes from either running or waiting state to ready state.
-most contemporary os these days use preemptive scheduling.
-preemptive scheduling is more complex, requires kernel and hardware support.
-once the scheduler has selected a process to run, another component the dispatcher comes into play.
-the dispatcher transfers the control of cpu from the outgoing to the incoming process.

-on systems that support threads, the scheduling is done at the thread level.
-further, the scheduling is only done for the kernel threads, not user threads.
-user threads are managed and served by thread library and the kernel is unaware of them.

-on systems with multiple cpus, the scheduling is done on each cpu individually.
-this way each cpu can share some of the kernel and user processes and is called 'symmetric multiprocessing' (smp).
-most modern os like linux, unix, windows are smp systems.
-on systems with multiple cores and multiple cpus, the cores can handle distinct threads.
-multicore systems consume less power than multiprocess systems.
-virtualized systems behave as multiprocessor systems in terms of scheduling.
-there the vm software presents virtual cpus to each vm env.
-linux, unix and windows all use priority based preemptive scheduling.
-linux had non-preemptive scheduling prior to kernel 2.6.
-since 2.6, the kernel was made fully preemptive.

No comments:

Post a Comment