Introduction to Operating Systems: Unit II(a): Process Management

CPU Scheduling

Process Management - Introduction to Operating Systems

In a multiprogramming environment, usually more programs to be executed than could possibly be run time at one time. In CPU scheduling it switches from one process to another process. CPU resource management is commonly known as scheduling.

CPU Scheduling

• In a multiprogramming environment, usually more programs to be executed than could possibly be run time at one time. In CPU scheduling it switches from one process to another process. CPU resource management is commonly known as scheduling.

• Objective of the multiprogramming is to increases the CPU utilization.

• User program contains combination of CPU burst cycle and I/O burst cycles. Process starts with CPU burst cycle then I/O burst cycle again CPU burst cycle again I/O burst cycle. In this way the process completes its executions. Process will terminates after final CPU burst cycle completions.

Program execution sequence: CPU burst cycle → I/O burst cycle → CPU burst cycle → I/O burst cycle → CPU burst cycle → Program terminates.

• A CPU bound process tends to use the processor time that the system allocates for it. An I/O bound process tends to use the processor only briefly before generating an I/O request. The CPU bound processes spend most of their time using the processor.

CPU Scheduler

• CPU scheduler is also called as short scheduler. System programmers use parameters like program size, resources required for program and any other special devices are needed to determine scheduling policies.

• Scheduling mechanism is the part of the process manager that handles the removal of the running process from the CPU and the selection of another process on the basis of a particular strategy.

•  Scheduler is responsible for multiplexing processes on the CPU:

Preemptive and Non-preemptive Scheduling

• The scheduling policy determines when it is time for process to be removed from the CPU and which ready process should be allocated the CPU next. The scheduling mechanism is composed of several different parts, depending on exactly how it is implemented in any particular operating system.

• CPU scheduling is divided into two types: Preemptive scheduling and non-preemptive scheduling.

• Preemptive scheduling: A scheduling method that interrupts the processing of a process and transfers the CPU to another process is called a preemptive CPU scheduling. The process switches from running state to the ready state and waiting the ready state state to the ready state.

• Non-preemptive scheduling:Non-preemptive operation usually proceeds towards completion uninterrupted. Once the system has assigned a processor to a process, the system cannot remove that processor from the process. The process switches from running state to the waiting state and termination of process.

• Preemptive scheduling increases the cost and it has higher overheads. This scheduling method is useful only in the high priority processes require rapid

response.

• Non-preemptive scheduling is simple to implement. It requires some hardware platform. This method is attractive because of its simplicity. Windows 3.1 and Apple Macintosh operating system uses this scheduling method.

Difference between Preemptive and Non-preemptive Scheduling

CPU Scheduling Criteria

•  Depending on the system, CPU scheduling criteria will change.

1. Throughput: CPU scheduling should attempt to service the maximum number of processes per unit time. The higher is the number, the more work is done by the system.

2. Waiting time: The average period of time a process spends waiting. Process is normally in the ready queue in waiting time.

3. Turnaround time: Turnaround time start from process submission to completion of process.

Turnaround time = Burst time + Waiting time

4. Response time: It is the time from the submission of a request until the first response is produced.

5.CPU utilization: It is average function of time during which the processor is busy.

6. Fairness: Avoid the process from the starvation. All the processes mu given equal opportunity to execute.

7. Priority: If the operating system assigns priorities to processes, the scheduling mechanism should favor the higher priority processes.

8. Predictability: A given process always should run in about the same amount of time under similar system loads.

• Depending upon the nature of operations the scheduling policy may differ. The CPU utilization and throughput are the system centered parameters. Fairness is snit affect by user and system.

Dispatcher

• Using dispatcher, CPU selects the process from the short term scheduler. Functions of the dispatcher is as follows :

1. Switching context

2. Switching to user mode

3. Jump to proper location in the user program for restarting that program.

• Dispatcher is a small program that switches the processor from one process to another.

• Dispatch Latency: It is time taken by dispatcher to stop running one process and start other process running is called as dispatch latency.

Introduction to Operating Systems: Unit II(a): Process Management : Tag: : Process Management - Introduction to Operating Systems - CPU Scheduling