13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

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.

16 Introduction Chapter 1processesA B C D Ebeforeresponseskernelservice callsdevicesprocessesA B C D Eafterresponseskernelservice callsdevicesFigure 1.7 Context switchNot only does the kernel have its own register contents and its own programcounter, but it also has special privileges that allow it to access transput devices. Theseprivileges must be turned off whenever a process is running. Privilege is usually conferredby the processor state, so a process has a different processor state from the kernel.Some computers provide only separate privileged and non-privileged states, whereas othershave several gradations between them. The ability to change from one state toanother requires special privilege.Since this is our first detailed example of the work that an operating system performs,we will say a word about how operating systems are constructed. In the earlydays of computers, operating systems were written as single large programs encompassinghundreds of thousands of lines of assembler instructions. Two trends have made thejob of writing operating systems less difficult. First, high-level languages have madeprogramming the operating system much easier. Second, the discipline of structured programminghas suggested a modular approach to writing large programs; this approachallows large problems to be decomposed into smaller pieces. The program that switchescontext can be seen as one such small piece. It could be a procedure written in a highlevellanguage like Modula. These pieces can often be arranged in layers, with eachlayer providing services to the ones above it. For example, one could build the layers asfollows:Context- and process-switch services (lowest layer)Device driversResource managers for space and timeService call interpreter (highest layer)

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

Saved successfully!

Ooh no, something went wrong!