Browse Prior Art Database

Simulation of Multiple Timers using One Actual Timer

IP.com Disclosure Number: IPCOM000115108D
Original Publication Date: 1995-Mar-01
Included in the Prior Art Database: 2005-Mar-30
Document File: 4 page(s) / 78K

Publishing Venue

IBM

Related People

Adams, PS: AUTHOR [+3]

Abstract

Often during the execution of a program a component may request a wait for a given period (e.g., 0.5 of a second) before continuing. The least processor intensive way of doing this on PC computers is by using a hardware timer, which will cause an interrupt when the given period has elapsed. There are only a finite number of these hardware timers, which consequently places an upper limit on the number of applications and threads that can be using them at any one time. A good example of this is the Windows environment which will only allow 32 timers (Win 3.1) to be set at any one time. If an application needs a timer and there are none available it will either have to wait for one to become free or terminate with an error, neither of these scenarios being very desirable.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 52% of the total text.

Simulation of Multiple Timers using One Actual Timer

      Often during the execution of a program a component may request
a wait for a given period (e.g., 0.5 of a second) before continuing.
The least processor intensive way of doing this on PC computers is by
using a hardware timer, which will cause an interrupt when the given
period has elapsed.  There are only a finite number of these hardware
timers, which consequently places an upper limit on the number of
applications and threads that can be using them at any one time.  A
good example of this is the Windows environment which will only allow
32 timers (Win 3.1) to be set at any one time.  If an application
needs a timer and there are none available it will either have to
wait for one to become free or terminate with an error, neither of
these scenarios being very desirable.  This becomes a particularly
acute problem when trying to implement a threading model under
Windows, as each thread that is started can request a wait for
specific time periods and this facility must be guaranteed
irrespective of the number of threads that are already running and/or
waiting for a time period.  The restriction of Windows that only a
finite numbers of timers may be used therefore means that the
threading system cannot directly use a timer for each wait and so
must resort to another, more processor intensive solution much as a
loop that yields until the given period of time is over.

      The proposed solution requires only one actual timer to be used
and will simulate as many virtual timers as are required (restricted
only by the amount of memory resource on the machine).  This is
achieved by all timer calls being routed via a controlling software
layer.  This layer does not sit in yield loops but uses the one timer
interrupt to maintain all requested timers.  This is achieved by the
timer simulation layer maintaining a list of current outstanding
timer requests.  This list is ordered by time, the earliest timeout
b...