03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

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.

Figure 2.6<br />

The kernel executive contains support for device drivers so that a user program can issue a<br />

request to device driver code running kernel-side, in either the kernel executive or kernel<br />

server. Such requests typically initiate a device operation, or tell the driver that the<br />

requesting program is waiting for something to happen on the device.<br />

Drivers also process device interrupts and then tell the user (or kernel) program that an<br />

earlier request is complete. Interrupt handling works at two levels.<br />

� First-level handling is done by an interrupt service routine (ISR). ISRs must be short,<br />

and can't do very much, because they could occur at any time, even in the middle of a<br />

kernel server operation. Usually, they simply acknowledge the device that raised the<br />

interrupt and then set a flag to request the kernel to run a delayed function call (DFC)<br />

for second-level processing.<br />

� The kernel schedules the DFC when it is in a more convenient state – immediately, if<br />

user-mode code was executing when the interrupt occurred; otherwise, when the kernel<br />

would have otherwise crossed the privilege boundary back to user code. DFCs can use<br />

most kernel APIs. DFCs typically do a small amount of processing and then post to a<br />

user thread to indicate that an I/O request has completed.<br />

2.8 Timers<br />

The kernel supports a tick interrupt that is used to drive round robin scheduling of equal<br />

priority threads. It runs at 64 Hz on ARM, unless that frequency is inconvenient for specific<br />

hardware, and at 10 Hz on the PC-based emulator.<br />

The tick interrupt can also be accessed (via User::After() and RTimer::After()<br />

function calls) by user programs. The tick interrupt suspends during power-off, so that if you<br />

request a timer to expire after 5 s, and then turn the machine off 2 s later, the timer event will<br />

occur 3 s after you turn the machine back on again – or even later, if you immediately turn<br />

the machine back off!<br />

The kernel also supports a date/time clock, which you can access using User::At() and<br />

RTimer:At(). This timer expires at exactly the time requested. If the machine was turned<br />

off when the timer expires, it is turned on. This behavior makes it a suitable time for alarms,<br />

as the system will power up and can then alert the user.<br />

2.9 Memory<br />

System memory is managed by the memory management unit (MMU).

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

Saved successfully!

Ooh no, something went wrong!