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.

Introduction to kernel<br />

The kernel raises <strong>the</strong> processor execution level around<br />

critical regions of code to prevent interrupts that could<br />

o<strong>the</strong>rwise cause inconsistencies.<br />

Figure 4. Incorrect Linked List because of Context Switch<br />

Sleep and wakeup<br />

Processes go to sleep because <strong>the</strong>y are awaiting <strong>the</strong> occurrence of some event:<br />

- waiting for I/O completion from peripheral device<br />

- waiting for a process to exit<br />

- waiting for system resources to become available<br />

Sleeping processes do not consume CPU<br />

resources. Sleep on an event - sleep until<br />

event occurs, at which time <strong>the</strong>y wake up<br />

and enter ready-to-run.<br />

The kernel does not constantly check to see<br />

that a process is still sleeping but waits for<br />

<strong>the</strong> event to occur and awakens <strong>the</strong> process<br />

<strong>the</strong>n.<br />

The kernel must lock data structures:<br />

while (condition is true)<br />

sleep (event: <strong>the</strong> condition becomes false);<br />

set condition true;<br />

It unlocks <strong>the</strong> lock and awakens all processes<br />

asleep:<br />

set condition false;<br />

wakeup (event: <strong>the</strong> condition is false);<br />

Most kernel data structures occupy fixed-size<br />

tables.<br />

Figure 5.Multiple Processes Sleeping on a Lock<br />

System Administration<br />

Disk formatting, creating new file systems, repair of damaged file system, kernel debugging. The kernel does not<br />

recognize a separate class of administrative process! - superuser privileges<br />

86

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

Saved successfully!

Ooh no, something went wrong!