Precise accounting of processor time for multi-threaded time-critical applications
AssigneeInternational Business Machines Corporation
InventorKelvin D. Nilsen
Life of this patent
Estimating the term…
Abstract
Methods and apparatus for processor time accounting for a thread executing in a multi-threaded environment are disclosed. A thread executing in an operating system receives from an operating system an allotment of time for use of a processor, and performs timed computations using the processor. Iteratively or after completing the computations, the thread determines an amount of time used by the thread based on a thread utilization counter initialized by the operating. The thread makes this determination through a user-level library function call rather than a call to the operating. The thread obtains an amount of time remaining in the allotment of time by comparing the thread utilization counter to a current CPU time using a user-level library function call.
Claims20
A method of processor time accounting for a thread executing on a processor in a multi-threaded environment, the method comprising:
- receiving from an operating system an allotment of time for use, by the thread, of the processor;
- performing, by the thread, timed computations using the processor;
- determining an amount of time used by the thread based on a thread utilization counter that is initialized by the operating system and is incremented in proportion to the number of machine cycles executed by the thread, wherein the determination is made through a user-level library function call;
- and
- obtaining an amount of time remaining in the allotment of time for use by the thread by comparing the thread utilization counter to a current processor time allotment limit value through a user-level library function call.
An apparatus for processor time accounting for a thread executing in a multi-threaded environment, the apparatus comprising a computer processor, a computer memory operatively coupled to the computer processor, the computer memory having disposed within it computer program instructions that, when executed by the computer processor, cause the apparatus to carry out the steps of:
- receiving from an operating system an allotment of time for use, by the thread, of the processor;
- performing, by the thread, timed computations using the processor;
- determining an amount of time used by the thread based on a thread utilization counter that is initialized by the operating system and is incremented in proportion to the number of machine cycles executed by the thread, wherein the determination is made through a user-level library function call;
- and
- obtaining an amount of time remaining in the allotment of time for use by the thread by comparing the thread utilization counter to a current processor time allotment limit value through a user-level library function call.
A computer program product for processor time accounting for a thread executing in a multi-threaded environment, the computer program product disposed upon a non-transitory computer readable medium, the computer program product comprising computer program instructions that, when executed, cause a computer to carry out the steps of:
- receiving from an operating system an allotment of time for use, by the thread, of the processor;
- performing, by the thread, timed computations using the processor;
- determining an amount of time used by the thread based on a thread utilization counter that is initialized by the operating system and is incremented in proportion to the number of machine cycles executed by the thread, wherein the determination is made through a user-level library function call;
- and
- obtaining an amount of time remaining in the allotment of time for use by the thread by comparing the thread utilization counter to a current processor time allotment limit value through a user-level library function call.
Dependencies are inferred from the claim text.