Clocks
Clocks are also called timers. The clock software takes the form of a device driver though a clock is neither a blocking device nor a character based device. The clock software is the clock driver. The exact function of the clock driver may vary depending on operating system. Generally, the functions of the clock driver include the following.
S.N. | Task | Description |
---|---|---|
1 | Maintaining the time of the day | The clock driver implements the time of day or the real time clock function.It requires incrementing a counter at each clock tick. |
2 | Preventing processes from running too long | As a process is started, the scheduler initializes the quantum counter in clock ticks for the process. The clock driver decrements the quantum counter by 1, at every clock interrupt. When the counter gets to zero , clock driver calls the scheduler to set up another process. Thus clock driver helps in preventing processes from running longer than time slice allowed. |
3 | Accounting for CPU usage | Another function performed by clock driver is doing CPU accounting. CPU accounting implies telling how long the process has run. |
4 | Providing watchdog timers for parts of the system itself | Watchdog timers are the timers set by certain parts of the system. For example, to use a floppy disk, the system must turn on the motor and then wait about 500msec for it to comes up to speed. |