Operating System

Only available on StudyMode
  • Download(s) : 31
  • Published : July 23, 2010
Open Document
Text Preview

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 • Turnaround time, waiting time and response time can be low for the same reasons above • No prioritization occurs, thus this system has trouble meeting process deadlines. • The lack of prioritization does permit every process to eventually complete, hence no starvation. 2. Shortest-Job-First Scheduling (SJF)

• Shortest Job First scheduling algorithm is a nonpreemptive scheduling algorithm that chooses the job that will execute the shortest amount of time. • Maintain the ready queue in order of increasing job lengths. When a job comes in, insert it in the ready queue based on its length. When current process is done, pick the one at the head of the queue and run it.

3. Priority Scheduling
• In priority scheduling, processes are allocated to the CPU on the basis of an externally assigned priority. The key to the performance of priority scheduling is choosing priorities for the processes. • Scheduling method where at all times the highest priority process is assigned the resource. • Allows CPU to be given preferentially to important processes. • Scheduler adjusts dispatcher priorities to achieve the desired overall priorities for the processes, e.g. one process gets 90% of the CPU.

4. Round-Robin Scheduling (RR)
• Round Robin scheduling is a scheduling method where each process gets a small quantity of time to run and preempted for the next process gets to run. • This is called time-sharing and gives the effect of all the processes running at the same time. • Run process for one time slice, then move to back of queue. Each process gets equal share of the CPU. 5. Multiple-Processor Scheduling

• CPU scheduling more complex when multiple CPUs are available due to load sharing. • Each processor schedules itself, dealt with a single processor. • Homogeneous processors within a multiprocessor (CPUs must be the same). •...
tracking img