home tutorials faq contact
CS tutorials Share you information

Next: Address Translation Up: Nachos Machine Previous: Interrupt Management

Real-Time Clock Interrupts

Nachos provides a Timer object that simulates a real time clock, generating interrupts at regular intervals. It is implemented using the same event driven interrupt mechanism described above. Timer supports the following operations:
Timer(VoidFunctionPtr timerHandler, int callArg, bool doRandom)
The Timer constructor creates a real-time clock that interrupts every TimerTicks (100) time units. When the timer goes off, the Nachos simulator invokes procedure timerHandler, passing it callArg as an argument.

To add a bit of non-determinism to the system, argument doRandom specifies that the time between interrupts should be taken from a uniform interval between 1 and 2 * TimerTicks .

The real-time clock can be used to provide preemption.

Note that starting Nachos with the ``-rs'' option creates a timer object that interrupts at random intervals and preempts the currently running thread.

Nachos
Tutorials
Roadmap
Source Code

Introduction
Threads
Interrupts
Synchronization
System Calls
Exception Handling
Multiprogramming
File System
Networking

Tutorials
Lab 1 Tutorial
Lab 2 Tutorial
Lab 3 Tutorial
Lab 4 Tutorial
Lab 5 Tutorial


© 1999-2008 - All rights reserved. CS tutorials™ and the logo are registered trademarks of CS tutorials.