16.05.2015 Views

Working with the Unix OS

Working with the Unix OS

Working with the Unix OS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Processes I<br />

- Makes sure all processes get a 'fair go'<br />

- If insufficient main memory, <strong>the</strong>n main memory processes swapped to a secondary memory device.<br />

- Two policies for this: Demand paging swapping<br />

- Usually called <strong>the</strong> 'swapper'<br />

Scheduler Module<br />

- Allocates <strong>the</strong> CPU to processes<br />

- Processes run till <strong>the</strong>y voluntarily give up <strong>the</strong> CPU (waiting on a device for example) or until <strong>the</strong> scheduler<br />

preempts <strong>the</strong>m when time's up.<br />

- Scheduler chooses <strong>the</strong> highest priority eligible process to run.<br />

Hardware Control<br />

- Responsible for handling interrupts and for communicating <strong>with</strong> <strong>the</strong> machine<br />

- Interrupts are handled by special functions in <strong>the</strong> kernel (as we have discuss recently)<br />

Inter-Process Communication<br />

- Asynchronous signaling of events<br />

- Synchronous transmission of<br />

messages between processes<br />

The Structure of Processes<br />

The process table entry and <strong>the</strong> u area are<br />

part of <strong>the</strong> context of a process.<br />

Process states<br />

1. executing in user mode<br />

2. executing in kernel mode<br />

3. is ready to run, resides in main<br />

memory<br />

4. is sleeping, resides in main memory<br />

5. is ready to run, waiting on swapper<br />

6. is sleeping, waiting on swapper<br />

7. is returning from kernel to user mode,<br />

but kernel preempts it<br />

8. is newly created, process exists, but is<br />

not ready to run, nor is it sleeping<br />

executed <strong>the</strong> exit system call, is a<br />

zombie, but contains an exit code and<br />

timing statistics<br />

Figure 6. Process State<br />

Transition Diagram<br />

Process table fields<br />

- state field<br />

- locate process and its u area<br />

- process size<br />

- user identifiers (UIDs)<br />

- process identifiers (PIDs)<br />

- event descriptor<br />

99<br />

- scheduling parameters<br />

- signal field<br />

- various timers

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!