Scheduling is a fundamental operating systems function. Almost all computer resources are scheduled before use. CPU is one of the primary computer resources uses scheduling to design the processes in an operating system. The operating system can make the computer more productive by switching the CPU among processes called CPU scheduler.
a) Explain what is CPU scheduler? State FOUR (4) goals of the CPU scheduler in an operating system.
CPU scheduler is to selects from among the processes in memory ready to execute and allocates the CPU to one of them. CPU scheduling decisions may take place when a process:
• Switches from running to waiting state (by sleep). • Switches from running to ready state (by yield). • Switches from waiting to ready (by an interrupt). • Terminates (by exit).
Four goals of the CPU scheduler: 1. Utilization and efficiency – to keep the CPU as busy as possible all of the time with useful work. 2. Turnaround time - from the time of submission to time of completion, minimize the time batch users must wait for output. 3. Response time - time from submission till the first response is produced. A scheduler should minimize response time for interactive users. 4. Fairness – to make sure each process gets a fair share of the CPU and no process can suffer indefinite postponement.
b) Briefly describe some important concepts related to scheduling algorithms that exist in several operating systems below:
1. First-Come, First-Served Scheduling (FCFS) In First Come First Served the job that has been waiting the longest is served next, simply queues processes in the order that they arrive in the ready queue. • Since context switches only occur upon process termination, and no reorganization of the process queue is required, scheduling overhead is minimal. • Throughput can be low, since long processes can hog the CPU •