Difference between revisions of "Timers"

From COMP15212 Wiki
pc>Yuron
gravatar W81054ch [userbureaucratinterface-adminsysopPHRhYmxlIGNsYXNzPSJ0d3BvcHVwIj48dHI+PHRkIGNsYXNzPSJ0d3BvcHVwLWVudHJ5dGl0bGUiPkdyb3Vwczo8L3RkPjx0ZD51c2VyPGJyIC8+YnVyZWF1Y3JhdDxiciAvPmludGVyZmFjZS1hZG1pbjxiciAvPnN5c29wPGJyIC8+PC90ZD48L3RyPjwvdGFibGU+] (talk | contribs)
m (1 revision imported)
 
(No difference)

Latest revision as of 12:07, 13 August 2019

Depends on Peripheral devices

A timer is quite a simple hardware device; a typical computer will have several timers available. Although they have no physical input or output wires, timers are still classed as I/O devices and are handled in a similar manner. Although a timer may be read explicitly, they typically do most of their work by providing interrupts.

Timers can have different characteristics. As far as this course unit is concerned there may be two useful forms of timer:

  • Free running – continuously operating, providing interrupts at regularly spaced (typically preprogrammed) intervals. A typical use would be tracking & measuring elapsed time or maintaining the ‘time-of-day’.
  • One shot – provides a single interrupt after a preprogrammed delay.
    May be used for time-slicing – particularly if each process may be given a different length time-slice according (for example) to its priority.

At some resolution, the latter can be provided by the former by counting pulses, if need be.

Typical timer jobs

  • Maintaining a simple, software clock
  • Rescheduling sleeping processes
  • Monitoring performance/behaviour; profiling
    e.g. noting the time spent ‘idle’ for top etc.
  • Pre-emptive time-slicing (when applicable)

A real-time embedded system may also contain a special watchdog timer which is there to reset the system if it appears to have crashed.


Also refer to: Operating System Concepts, 10th Edition: Chapter 1.4.3, 12.3.3, pages 26-27, 505-506


Articles on IO
Cacheability • Device Drivers • Direct Memory Access (DMA) • IO • Interprocess Communication • Interrupt Controller • Interrupt Service Routines (ISRs) • Interrupts • Libraries • Peripheral devices • Pipes • Queues • Queues Extra • Resources • Shell • Sockets • Spooling and Buffering • Starvation • Streams • System Calls • Thrashing • Timers • Using Peripherals • Virtualisation • Write Buffer