COMP 314 - U2C5

Operating System Concepts, Seventh Edition

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COMP 314 – Unit 2, Section 2, Chapter 5 Basic Concept (153) o Objective is to have some process running at all times to maximize the CPU utilization. o Several processes are kept in memory at one time, and when one process has to wait (e.g. for an I/O operation) another takes over the CPU. o CPU-I/O Burst Cycle (154) Process execution consists of a cycle of CPU execution and I/O wait. Processes alternate between these two states. Processes start with a CPU burst, followed by an I/O burst, and so on. Eventually the CPU burst ends with a system request to terminate execution. Bursts greatly vary between processes and systems, but they tend to follow a similar pattern. The curve is characterized by a exponential or hyperexponential burst, with a large number of short CPU bursts and a small number of long CPU bursts. An I/O-bound program typically has many short CPU bursts. A CPU-bound program might have a few long CPU bursts. The distribution of bursts can be important in selecting the proper scheduling algorithm. (155) o CPU Scheduler Whenever the CPU becomes idle the short-term scheduler (or CPU scheduler) must select a process from memory that is ready to execute and allocates the CPU to that process. o Pre-emptive Scheduling CPU-scheduling decisions may take place under the following four circumstances: 1. When a process switches from the running state to the waiting state (e.g. I/O request). 2. When a process switches from the running state to the ready state (e.g. interrupt occurs). 3. When a process switches from the waiting state to the ready state (e.g. completion of I/O). 4. When a process terminates. For situations 1 and 4, there is no choice in scheduling. A new process has to be selected if ready. This is considered nonpreemtive or cooperative. Under nonpreemtive scheduling, once the CPU has been allocated to a process, the process keeps the CPU until it releases the CPU either by terminating or by switching to the waiting state. Cooperative scheduling is the only method that can be used on certain hardware platforms, because it does not require the special hardware (for example, a timer) needed for preemtive. Preemtive scheduling incurs a cost associated with access to shared data. (156) If one process is pre-empted so that the second process can run whilst the first is in the middle of updating shared data, then the second process will be access inconsistent data. o A mechanism for coordinating the shared data is necessary. During the processing of a system call, the kernel may be busy with an activity on behalf of a process. If the pre-empting process wants to use the same kernel data, then there is a conflict. o
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

COMP 314 - U2C5 - COMP 314 Unit 2, Section 2, Chapter 5...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online