Os Deadlock

Submitted by: Submitted by

Views: 199

Words: 4006

Pages: 17

Category: Science and Technology

Date Submitted: 09/29/2013 12:26 AM

Report This Essay

5.1 Basic Concepts

* Almost all programs have some alternating cycle of CPU number crunching and waiting for I/O of some kind. ( Even a simple fetch from memory takes a long time relative to CPU speeds. )

* In a simple system running a single process, the time spent waiting for I/O is wasted, and those CPU cycles are lost forever.

* A scheduling system allows one process to use the CPU while another is waiting for I/O, thereby making full use of otherwise lost CPU cycles.

* The challenge is to make the overall system as "efficient" and "fair" as possible, subject to varying and often dynamic conditions, and where "efficient" and "fair" are somewhat subjective terms, often subject to shifting priority policies.

5.1.1 CPU-I/O Burst Cycle

* Almost all processes alternate between two states in a continuing cycle, as shown in Figure 5.1 below :

* A CPU burst of performing calculations, and

* An I/O burst, waiting for data transfer in or out of the system.

* CPU bursts vary from process to process, and from program to program, but an extensive study shows frequency patterns similar to that shown in Figure 5.2:

5.1.2 CPU Scheduler

* Whenever the CPU becomes idle, it is the job of the CPU Scheduler ( a.k.a. the short-term scheduler ) to select another process from the ready queue to run next.

* The storage structure for the ready queue and the algorithm used to select the next process are not necessarily a FIFO queue. There are several alternatives to choose from, as well as numerous adjustable parameters for each algorithm, which is the basic subject of this entire chapter.

5.1.3. Preemptive Scheduling

* CPU scheduling decisions take place under one of four conditions:

* When a process switches from the running state to the waiting state, such as for an I/O request or invocation of the wait( ) system call.

* When a process switches from the running state to the ready state, for example in response to an interrupt....