RESOURCE GOVERNOR & STRUCTURE THEREFOR
The present invention relates to a resource governor and structure therefor and, more particularly although not exclusively, to a resource governor and structure particularly suited for a symmetric multiprocessing (SMP) computer environment.
BACKGROUND
Conventional computer operating system environments such as Windows 98, Windows NT and Unix are structured to be multi-tasked, multi-threaded systems whereby the processing tasks of the underlying hardware which the operating system resource manages are managed so as to provide efficient, time shared usage of the execution cycles of the underlying CPU or CPU's.
Typically these existing systems are not particularly fine grained and it is frequently observed, for example where such systems utilise the spinlock method of resolving resource requests, that they reach a point of diminishing returns as the task load increases on the underlying CPU's.
More broadly the structure of existing systems tends to lead to a dramatic growth in resource conflicts as system load increases .
A typical computing system spends a significant amount of time resolving resource contentions which occur within the system during operation.
With reference to Fig. 1 and Fig. 2 a typical prior art computer system 201 will have a number of tasks or other resources in a work pool 202 from which resource consumers such as first worker 203, second worker 204 and third worker 205 take tasks/resources for execution/consumption and subsequent return to work pool 202 after execution/ consumption.
Because all of the workers are taking work from the one pool directly resource contentions occur which require resolution before useful work can be done.
With reference to Fig. 2, as reflected in graph 207, it can be seen that underlying CPU utilisation in this example, is devoted 90% or more to resolving resource contention
(lightly shaded area 208 in graph 207) and 10% or less to what might be termed "useful" work or activity (cross-hatched area 209 in graph 207) . It is an object of the present invention to overcome or ameliorate one or more of the abovementioned disadvantages or at least provide a useful alternative.
SUMMARY OF INVENTION
The resource governor and structure therefor of the present invention, as to be described below, is not to be confused with a task scheduler or a task scheduler algorithm. In embodiments of the resource governor of the present invention, as to be described below, the resource governor is implemented as a special purpose task. This task, itself, may be the subject of a task scheduler under the ultimate control of and, for example, called by the operating system specific to any platform upon which the resource governor may be implemented. The resource governor and any structure by which it is implemented is not a task scheduler. A task scheduler does not resolve resource conflicts and, indeed, as a result of scheduling a task for execution may cause a resource conflict to occur when that task runs.
Accordingly, in one broad form of the invention there is provided a method of allocation of usable resources to resource consumers in a computer system, said computer system having a plurality of usable resources available for work or to be worked on and one or more resource consumers capable of consuming said usable resources; said method comprising:
(a) instituting a special purpose task as a resource governor;
(b) said resource governor distributing said usable resources to said resource consumers;
(c) said resource governor receiving used resources from said resource consumers . Preferably said usable resources include tasks, unused objects, a unit of network bandwidth or a designated unit of an input/output operation.
Preferably each said resource consumer includes an input buffer. Preferably each said resource consumer device includes an output buffer.
More preferably said input buffer is a non- locking buffer.
More preferably said output buffer is a non- locking buffer.
Even more preferably said input buffer is a ring buffer.
Even more preferably said output buffer is a ring buffer.
In a further broad form of the invention there is provided a method of allocation of tasks to execution devices in a computer system; said computer system having a plurality of tasks for execution and one or more execution devices capable of executing said tasks; said method comprising:
(a) instituting a special purpose task as a task allocator;
(b) said task allocator distributing said tasks for execution to said execution devices; (c) said task allocator receiving from said execution devices said executed tasks . Preferably each said execution device includes an input buffer.
Preferably each said execution device includes an output buffer.
More preferably said input buffer is a non- locking buffer.
More preferably said output buffer is a non- locking buffer. Even more preferably said input buffer is a ring buffer. Even more preferably said output buffer is a ring buffer.
In yet a further broad form of the invention there is provided a structure suitable for use in conjunction with a resource governor, said structure comprising a resource consumer having at least one input buffer and from which said resource consumer takes usable resources for use.
Preferably said resource consumer accepts resources for use of a predefined type from said at least one input buffer.
Preferably said resource consumer obtains said usable resources for use only from said at least one input buffer.
Preferably said at least one input buffer receives resources of only said predefined type. Preferably said resource consumer experiences no contention for execution of said usable resources for use.
Preferably said structure further includes an output buffer into which said resource consumer places said usable resources following execution by said resource consumer. Preferably said at least one input buffer is a nonlocking buffer.
Preferably said output buffer is a non-locking buffer. More preferably said input buffer is a ring buffer. More preferably said output buffer is a ring buffer.
BRIEF DESCRIPTION OF DRAWINGS
Embodiments of the present invention will now be described with reference to the accompanying drawings wherein: Fig. 1 is a block diagram of a resource distribution arrangement for a prior art system;
Fig. 2 graphically illustrates behaviour which can be experienced by the system of Fig. 1 under high load;
Fig. 3A is a block diagram of a structure according to a first preferred embodiment of the present invention;
Fig. 3B is a block diagram of a structure according to a second preferred embodiment of the present invention; Fig. 4 is a block diagram of a resource governor arrangement according to a further preferred embodiment of the invention;
Fig. 5 is a block diagram of a task governor according to a further embodiment of the invention; Figs. 6 A-H illustrate detailed operation of the governor of Fig . 5 ;
Fig. 7 illustrates graphically the behaviour of the system of Fig. 5 for large system loads;
Fig. 8 is a block diagram of a transaction processing system to which an embodiment of the present invention has been applied; and
Fig. 9 is a block diagram of a further system to which an embodiment of the present invention has been applied
DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS
With reference to Fig. 3A there is illustrated a resource consumer 210 according to a first preferred embodiment of the invention comprising a resource consumer device 211 which accepts resources for consumption via input
buffer 212. The arrangement is such that resource consumer device 211 can take only one defined resource at a time from input buffer 212 thereby providing an inherently contention- free structure for consumption of resources by resource consumer device 211.
With reference to Fig. 3B a resource consumer 215 according to a second embodiment of the invention is illustrated comprising, in this instance, a resource consumer device 216 which receives resources for consumption from input buffer 217 and then, after consumption of resources, outputs the consumed resources to output buffer 218.
In use for the embodiments of both Fig. 3A and Fig. 3B resources for consumption are fed to the input buffers 212, 217 and from whence, in order of delivery into buffer 212, 217 the resources are taken by respective consumer devices 211, 216. In this way no contentions occur within the consumer devices 211, 216 because the consumer devices can operate simply on the basis of working on (consuming) one resource at a time and, in the case of the second embodiment of Fig. 3B, simply placing an executed or consumed resource into output buffer 218 before looking to, and preferably only to, input buffer 217 for the next resource for consumption by resource consumer 216.
In the context of computer systems "resources" can be any definable unit of work which can be worked upon by a resource consumer. So, for example, the resource can be a task for execution by the resource consumer which, itself, can be a CPU or thread of a computer system. A resource can also be a data block or other definable unit of data which requires work to be performed on it. More broadly, a resource can be a unit of network bandwidth or a definable input/output operation. With reference to Fig. 4 the arrangements of Fig. 3A or 3B and, more specifically in this instance, the arrangement of Fig. 3B can be applied via the intermediary of a resource governor or resource allocator to a system of resource allocation which allows allocation and consumption of resources without the consuming devices becoming involved in the allocation process. Stated another way, in this embodiment, the resource consumers do not need to have their execution interrupted for the purpose of resource allocation or resolution of contention. In the arrangement of Fig. 4 the consumers are numbered as for the second embodiment of Fig. 3B with the first resource consumer and its components incorporating the suffix a, the second resource consumer and its components the suffix b and so on .
In this instance a plurality of resources 219 await allocation in resource pool 220. The resources 219 are allocated for consumption by consumers 215a, 215b exclusively by a special purpose thread or task known as the resource governor 221.
The resource governor 221 allocates resources to buffers 217a, b ... consecutively, providing there is room in the buffers to take the resources for consumption. The resource governor 221 also receives from output buffers 218a, b ... consumed resources which are either re-allocated to an input buffer or are returned to the resource pool 220.
Because the resource governor 221 is the only entity which supplies resources to input buffers 217a, b ... and receives consumed resources from output buffers 218a, b ... there is no locking required and no resource contention.
The combination of the single purpose resource governor 221 with the buffering arrangement illustrated in Fig. 4 means that the resource consumers 215a, b ... do not become involved in resource contention issues and can devote themselves exclusively to resource consumption in the form of what might generally be termed useful work.
With reference to Fig. 5 a particular example of an application of the arrangement of Fig. 4 is illustrated where the resources 219 are tasks for execution by a multi-tasking
computer system. In this instance the resource pool 220 comprises tasks which are dormant in the system. When dormant tasks become active the governor 221 removes them from the pool 220 and puts them into the next available input buffer 217a, b ....
The resource consumers 215a, b ... remove tasks from their respective input buffers 217a, b ..., execute them and then place them into output buffers 218a, b ... following which the governor 221 removes these tasks from the output buffers. This particular embodiment exhibits the property that the resource scheduling overhead varies linearly with the number of consumers 215a, b ... available to do work and not with the total amount of work to be done.
Figs. 6A to 6H provide a particular example of the arrangement of Fig. 4 and, more particularly, the arrangement of Fig. 5 where the resources comprise tasks in the form of additions of integers which need to be performed by consumers or workers which, in this case, are simple adder devices.
Again, like components are numbered as for Fig. 4 and Fig. 5.
In this instance the resource pool 220 comprises a structure of the type described with reference to Fig. 3B where the consumer takes the form of an addition requestor 222 having an input ring buffer 223 into which completed
additions are placed and an output ring buffer 224 into which addition operations 225 are placed for working on by consumers, in this instance in the form of adders 215a, 215b.
Governor 221 accepts addition operation 225 (the addition of integers 1 and 2) (Fig. 6B) . The governor 221 then puts the addition operation 225 into the input ring buffer 217a of first adder 216a (Fig. 6C) .
First adder 216a then takes the addition operation 225 from input ring buffer 217a and performs the addition (to produce the result integer 3) as shown in Fig. 6D.
Having completed the addition operation ("the work") first adder 216a then inserts the (completed) addition operation 225 into output ring buffer 218a as shown in Fig. 6E. Governor 221 then takes the (completed) addition operation 225 from the output ring buffer 218a and puts it into the input ring buffer 223 of (addition) resource pool 220 as shown in Fig. 6F.
Figs. 6G and 6H show the application of the basic sequence just described with reference to Figs. 6A through to
6F where there are multiple addition operations 225a, b, c, d
... p for execution by one or other of first adder 215a or second adder 215b.
The arrows in Fig. 6H indicate the direction of insertion into respective input buffers and removal from the respective output buffers.
It will be appreciated that this basic arrangement can be scaled to handle a significantly larger number of addition operations by adjusting the size (length) of the various buffers with reference to the rate at which the adders can perform addition operations and the governor can put and get addition operations. In all instances it will be observed that the additions are allocated by the special purpose governor 221. It will also be observed that, each adder is not concerned with resource allocation or resource conflict resolution. By virtue of the buffering arrangement illustrated each adder is devoted to performing sequentially the work which it is defined to do, in this instance addition, so long as addition operations are available for removal from an input buffer of that adder .
With reference to Fig. 7 experiments have indicated that an expected behaviour of a computer system where resources are governed utilising the methods and structure previously described the characteristic curve of system load (tasks) graphed against work done by the system initially rises steeply as per portion 226, then plateaus at plateau point
227 before falling away gradually in accordance with portion 228. This characteristic can be interpreted that, under heavy task load, the system overhead associated with scheduling of tasks grows gradually with increasing number of tasks . A saturation point is ultimately reached (not shown) as will occur with any real -world system which is bounded by resource constraints, be they number of CPU's, CPU execution speed, memory resources etc.
With reference to Fig. 8 a further example of the application of the governor arrangement and the buffering arrangement described with reference to Figs. 3 and 4 is illustrated. Again, like components are numbered as for the description with reference to Fig. 4.
In this instance there is a resource pool in the form of task pool 220 from which tasks are scheduled exclusively by resource governor 221. In this instance system 230 is a transaction processing system and has available to it disk storage 231 which is written to and read from via an I/O subsystem 232 which is communicated with exclusively by a special purpose task termed the delta writer 215c which is devoted to writing transactions to disk storage 231.
In one embodiment the delta writer 215c is a particular resource consumer for the transaction processing system 230.
The other resource consumers are first CPU 215a and second CPU 215b, each adapted to consume all other kinds of tasks derived from task pool 220.
The special purpose governor task 221 is programmed to be aware of the special purpose delta writer 215c and allocates all transactions requiring a disk write to the input buffer 217c of delta writer 215c. Having performed the disk I/O portion via I/O subsystem 232 the executed transaction write tasks are placed in output ring buffer 218c from which governor 221 can then remove these executed tasks for reallocation or return to task pool 220.
Thus the CPU's 215a, 215b are not required to be involved in time consuming disk I/O operations. Furthermore contentions for resources including disk I/O resources are removed from the transaction processing system 230 by use of the single special purpose governor 221 (which may itself be a task) which is designated as the sole task permitted to place resources for consumption into the input ring buffers 217a, b, c and remove consumed resources from the output buffers 218a, b, c and also to exclusively take resources from and place resources back into task pool 220.
With reference to Fig. 9 there is shown a further embodiment of the invention where a single resource consumer accesses more than one input buffer.
In this instance the resource consumer comprises a multiple input buffer resource consumer 240. Like components are numbered as for the task implementation of Fig. 5.
In this instance there is a first input buffer 217al and a second input buffer 217a2.
First input buffer 217al receives resources for consumption in the form of tasks from task governor 221.
Second input buffer 217a2 receives resources for consumption in the form of particular data structures in the form of unused or available objects supplied by a garbage collector or cleaner task 241.
The resource consumer device 216a, in this instance, is a CPU programmed to recognise and request, as required or needed, different types of resources for consumption including, in this instance, tasks from input buffer 217al and unused or available objects from second input buffer 217a2.
As for earlier embodiments no resource contention is experienced by CPU 216a nor is it required, during resource consumption, to resolve conflicts or contentions. When a resource for consumption of type "task" is required by CPU 216a it is programmed to obtain resources for consumption of that type only from first input buffer 217al. Similarly it is programmed to recognise resources for consumption of type
"objects" and is programmed to obtain those, when it requires, exclusively from second input buffer 217a2.
The above describes only some embodiments of the present invention and modifications, obvious to those skilled in the art, can be made thereto without departing from the scope and spirit of the present invention.
In particular, the structures previously described have broad application within computer systems and can, for example, include the situation where a computer system will apply multiple applications of the structure of Fig. 4.