Plaque It!
Sponsored by: Flash of Genius |
[0001] The problem of resource management occurs in many different aspects of data processing systems. In the typical scenario, a resource manager such as may be implemented as part of a operating system must schedule access to various shared resources, including processing cycles of the central processing unit (CPU), disk drive bandwidth, access to shared network connections, and access to other peripheral devices.
[0002] Operating Systems (OS), and more particularly, schedulers that run in some is kernel mode of the OS are commonly employed to provide protected access to system resources, typically on some type of time-shared basis. This canonical time-sharing model has been used in computing systems for almost four decades. But in many applications, the need for access to different resources are in general are not completely independent of one another. As a result, situations develop where guaranteed access of one resource disrupts the state of another resource, thereby giving rise to scheduling conflicts.
[0003] For example, a task that runs a multimedia application may require sending real-time data across a network connection, and therefore demands a certain amount of network bandwidth to be reserved in the system. A traditional network connection scheduler may involve queuing of data packets. But the application task itself also needs to be granted enough CPU time in order to cause an adequate number of packets to be supplied to the queue. This comes at the expense of a significant number of processor cycles in both the user space task and the system space. Consequently, proper scheduling requires processing guarantees for both the application that generates the data, as well as the packet scheduler that is physically responsible for transmitting the packets over the network connection. The failure to adequately allocate resources to both tasks results in a less than optimum use of resources, and in a worst-case scenario, a dysfunctional system.
[0004] On the other hand, a task that primarily receives data from a network connection typically requires more processor-centric resources. A receiving process typically does not have much control on the number of packets arriving on its network connection. However, it certainly can control distribution processing of these packets in order to provide guaranteed service to various applications with different timing constraints.
[0005] Unfortunately, traditional operating systems in widespread use, such as Linux, typically do not provide real-time guarantees for processing. Rather, task processing is handled in such systems on an essentially priority interrupt driven basis. As an example, the arrival of a data packet in a receiving process generates a hardware interrupt. The hardware interrupt in turn causes the hardware to capture and stores data packets. A software interrupt mechanism, typically having a priority level that is lower than the hardware queuing process, performs receive protocol processing of the packets, to format them in a way that is acceptable for use by the application tasks. The application tasks then grab the packet from the system space for their own processing once they are scheduled to run.
[0006] While this priority interrupt-driven procedure involves a considerable amount of system level processing, there is little in the way of coordinating control of the different applications. In particular, lower level applications may be preempted by system level activities for processing the network packets. Moreover, this processing time in the system space is charged to the preempted process, which might not be the process that actually needs to eventually receive the received packets.
[0007] This arrangement leads to scheduling anomalies, priority inversion, and even overall decreased network throughput. In an extreme case, packets can arrive at a rate fast enough such that the system must spend all of its time serving the hardware interrupt process to grab and store the packets in the receive queue, but then finally dropping them when there are insufficient processor resources remaining to perform the protocol conversion function. Thus, all the inbound data is lost since the application is itself never scheduled to run.
[0008] Other operating systems such as VxWorks do allow for prioritization of tasks by an assigned priority level. When multiple tasks are pending, the task having the highest priority is selected and granted access first. The highest priority task is then allowed to run until it completes or enters a wait state. Once the higher priority task has been completed or is entering an idle state, the resource is then made available to a lower priority task.
[0009] This fixed priority scheme, while simple, also results in a number of difficulties. For example, if the higher priority state encounters a logical error condition, such as becoming stuck in an infinite processing loop, the controlling process will never finish the higher priority task. This has the effect of stalling or “crashing” the system.
[0010] Such a fixed priority scheme can work well in an instance in which the number of tasks is known in advance and the relative priorities can be determined, either analytically, empirically or through experimentation. However, in a more dynamic environment, where a new task may request access to the computing resources, there is the difficulty of assigning priorities for such new tasks. These will of course affect the running of lower priority processes if they are assigned a relatively highlevel priority. In turn, this can cause problems with legacy systems, requiring programmer intervention to re-assign process priorities.
[0011] For example, a given system may have been originally designed with a fixed-priority scheme and may work well in that mode. However, should it become desirable for the data processing system to perform new tasks, so that an additional process needs to be run so as to obtain throughput or timeliness guarantees, there then becomes a problem of reassigning priorities among the processes. This now typically requires intervention by the system designer in order to assure that system throughput remains at acceptable levels.
[0012] Another type of resource management approach involves a so-called “reservation system.” With this approach, available resources are assigned as a resource set, that comprise an essentially virtual operating system environment in which tasks run. The resource set defines a collection of data processing system resources that can be allocated for dedicated use by specific applications. The scheduling process then can assign each requesting task a certain fraction of the available resources during a particular time period, in effect making a “reservation” for that task to run in a guaranteed way.
[0013] For example, in the case of the network connection-servicing task, a reservation request may be made to reserve a certain percentage, such as 10 milliseconds (MS) of CPU time every 100 milliseconds available, and 2 mega-bits of the available access to a particular network connection every 250 milliseconds during recurring periodic intervals. An admission control process then arbitrates the request for a resource based on reservation requests received from multiple tasks running in the system.
[0014] The admission control process, or scheduling process, must ensure that the CPU or network-bandwidth needs of every resource set can be met on time. Hence, a scheduling policy may be implemented to determine which requesting task will be granted access to a particular resource at a particular time.
[0015] One certain policy is known as the so-called “deadline-monotonic scheduling” policy whereby the priority is assigned to a requesting process in an inverse proportion to a deadline associated by which a particular instance of a task must be completed. Other admission control policies can also be used, such as a so-called “rate-monotonic scheduling” policy, which assigns the priority of a process in an inverse proportion to its reservation period.
[0016] Another such policy is called “earliest deadline first” scheduling where the earliest absolute deadline of each currently active reservation is used to pick the highest priority task in the system. In this type of scheduling policy, the supervisory process assigns priority to a particular resource request if a condition can be satisfied such that a certain amount of resource access, C, can be provided within the certain amount of time, T, by a certain deadline time, D. The earliest deadline first scheduling policy thus seeks to satisfy an expression of the form
[0017] for the aggregate j processes; whereas the deadline-monotonic and rate-monotonic approaches seek to solve or satisfy the fixed-point equation:
[0018] Test terminates when a
[0019] or when a
[0020] The deadline-monotonic and rate-monotonic scheduling policies are considered fixed- or static-priority schemes. The deadline-monotonic policy is also an optimum fixed-priority scheduling policy. In other words, priorities are assigned to processes such that they are granted access based upon a particular desired completion time, D. As a result, the shorter the time available to complete a task, the greater the priority of process will ultimately be assigned. The rate-monotonic scheduling policy is considered to be a special case of the deadline-monotonic scheduling policy with D=T. The earliest deadline first scheduling policy is considered to be a “dynamic-priority scheduling policy”, where the priority of a task can change from instance to instance. When priorities or deadlines are equal, ties can be broken arbitrarily, but are normally broken in first-come-first-served order. This leads to weighted round-robin schemes when the Ts of all tasks are chosen to be identical. As a result, throughput guarantees can be obtained.
[0021] Also, in traditional operating systems, time-sharing activities are normally scheduled as background-priority activities with an aging mechanism which allows non-critical tasks waiting long to be treated preferentially, and non-critical tasks executing a lot to be treated at low preference.
[0022] The present invention relates to real-time scheduling of resources in a data processing system in which multiple tasks have different resource requirements. The multiple tasks must be scheduled to run concurrently; the tasks may typically be assigned to perform different activities. The present invention specifically seeks to provide guaranteed and timely processing for real-time applications that require or expect to be provided access to resources not only on a reservation basis, but also on a fixed-priority basis, running within the context of the same data processing system.
[0023] In connection with one aspect of the present invention, the tasks running in the system are prioritized on a reservation basis; other tasks are prioritized on a fixed priority basis. The reservation activities each have specified parameters for determining a priority allocation among other reservation activities. The reservation activities represent requests made by operating tasks for reservation of a certain capacity of a particular resource. In addition, fixed-priority activities are also allocated for in this same system. The fixed-priority activities each have a fixed-priority with respect to other fixed priority activities.
[0024] In connection with the present invention, the normal fixed-priority activities are collectively given a lower priority than at least one reservation activity. The end result is a system in which the fixed priority activities are never permitted to monopolize the available resources so that reservation activities may always be granted some access to the available resources. Critical activities are collectively given a higher priority than all reservation activities, such that their functions continue to behave as in a traditional operating system.
[0025] Not only are accommodations made for reservation-based activities as well as fixed priority activities in the hard reservation sense, but accommodation may also be made for possible soft reservations. In an instance where the available resource is not utilized 100% of the time, the designed consumption amount, C, has typically been met before expiration of a particular time period, T. Once this occurs, the process scheduler may enter a background mode whereby it may again assign the resource to a particular task prior to expiration of the period T.
[0026] In general, the invention therefore schedules reserved tasks such as may be controlled by an admission control process using a rate-monotonic or deadline-monotonic priority policy with a higher priority than fixed priority scheduled tasks such as may be defined by a simple priority scheme and/or a straight deadline monotonic admission control policy. Soft background tasks are then assigned a lower priority than either the reserved task or the fixed priority tasks such that they may run only when additional excess resource capacity is available.
[0027] These so-called soft reservation activities may, in addition, be scheduled at a background priority as a background activity after the reservation time has been consumed and the resource becomes available. However, this preferential class of soft activity is further assigned a preferential priority greater than at least one other background priority activity. As a result, the preferential soft activities, also called priority-reserved activities, are scheduled prior to the non-preferential background activities.
[0028] Another aspect of this invention is that tasks using a particular reservation can also be prioritized within the reservation. As a result, when a reservation is eligible to use the resource, the scheduling process chooses the highest priority activity bound to that reservation and eligible to execute on that resource. These priorities can be based on explicit fixed-priority values for non-periodic tasks or on deadline-monotonic or rate-monotonic policies for periodic tasks.
[0029] In connection with further aspects of the present invention, a resource kernel may be used to provide guaranteed access to resources for the reservation activities. The reservation activities may also be controlled through the use of resource sets defined within the context of a virtual machine. In particular, an operating system resource kernel may be defined that allocates a resource set representing a certain amount of available system resources to each particular task. The reservation activities may then be made for the resource sets by the tasks as a whole.
[0030] In connection with further aspects of the present invention, specified parameters for determining priority of the reservation activities may include resource consumption, C, a time period, T, associated with a scheduling process, and/or deadline time, D. Managed resources may include a number of data processing resources such as central processing unit (CPU) execution time, network bandwidth, disk access bandwidth, and/or other peripheral access bandwidths and/or times.
[0031] Yet other aspects of the present invention concern a default reserve allocation that may be made for the fixed-priority and background activities. In this manner, it can be known in advance that the fixed-priority and background activities will consume no more than a certain fraction of the available resources.
[0032] Another embodiment of the present invention may include a method for resource management in a data processing system such that multiple tasks having different resource requirements are scheduled to run concurrently with other tasks being assigned to different activities. In this implementation, a given reservation activity may have specified parameters for determining priority allocation among other reservation activities. However, a reservation activity itself may consist of a plurality of concurrent tasks executing within the single reservation activity. The collection of concurrent tasks may be collectively constrained by the parameters of the reservation activity itself.
[0033] In connection with yet another embodiment of the present invention, reservation activities may be assigned different priorities. As a result, one or more secondary level reservation activities, each having specified parameters for determining a reservation time based priority, may exist. The specified parameters for the secondary level activities will be collectively constrained by the specified parameters for the first-level reservation activity.
[0034] This concept of hierarchical reservation may be, of course, extended to two, three, or even a greater number of hierarchical reservation levels, with each lower-level reservation activity being constrained by the specified parameters for its associated higher-level activity.
[0035] It should also be understood that the critical activities, while given, may also be accommodated. Critical activities can include traditional operating system activities such as interrupt handlers and operating system processes. In this scenario, these critical activities may be granted a higher priority than the reservation activities. In an alternate scheme, a critical activity may be schedulable itself as a reservation activity. This approach provides for at least a guaranteed amount of the managed resource to be made available to any critical activity.
[0036] It should also be understood that reservation activities can also be scheduled at higher priority than normal activities using other traditional scheduling attributes such as dynamic priorities, such as those using the earliest deadline first policy.
[0037] In the special case where at most one task is bound to a reservation (or resource set), the attributes of the reservation can also be associated with the task directly.
[0038] The foregoing and other objects, features and advantages of the invention will be apparent from the following more particular description of preferred embodiments of the invention, as illustrated in the accompanying drawings in which like reference characters refer to the same parts throughout the different views. The drawings are not necessarily to scale, emphasis instead being placed upon illustrating the principles of the invention.
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045] The present invention relates to the problem of data processing system resource management where multiple activities with different throughput and timing constraints must be scheduled concurrently. Task assignment to a particular resource must be shared among other tasks and must be globally managed in a real-time basis. A resource kernel model is ideally used to manage tasks in such a system to provide timely, guaranteed, and protected access to system resources. The resource kernel model allows applications to specify only their own resource demands, leaving the operating system kernel to satisfy those demands using even hidden resource management schemes. The tasks, therefore, may specify parameters for their associated resource kernel and the operating system kernel itself then enforces maximum resource usage by specific tasks. The resource management scheme may then be based upon a resource reservation model.
[0046] In addition, other tasks in the system may be granted access to resources on a strictly priority basis.
[0047] As shown in
[0048] Such system resources, for example, may consist of central processing unit (CPU) time, disk access bandwidth
[0049] A number of entities that are called resource sets
[0050] The resource kernel
[0051] The key features of the resource kernel
[0052] Application programs or tasks run within one or more resource sets
[0053] One resource set
[0054] The admission-control policy is administered by the scheduler process
[0055] An additional parameter for the reservation model may also employ not only the net utilization of the resource, i.e., the computation time C allocated every T time units, but also a deadline D by which the resource must be consumed. Thus, in the example of the time period from time
[0056] The specified reservation parameters, including at least [C, T, and D] may be used as explicit parameters of the reservation model to be associated with each resource set. The semantics are such that each reservation be allocated at least C units of usage time every T units of absolute time. The C units of usage time will be guaranteed to be available for consumption before D units of time after the beginning of every periodic interval T. The guarantees start at absolute time at S and terminate at time S+L.
[0057] When a reservation uses up its allocation of C within an interval of time T, it is said to be depleted. A reservation which is not depleted is said to be an undepleted reservation. At the end of a duration T, the reservation will obtain a new quota of C and is said to be replenished. Such replenishment can occur T time-units from the previous replenishment or from previous resource usage(s). In the reservation model, the behavior of a reservation between depletion and replenishment can take one of three forms.
[0058] Hard reservations upon depletion cannot be scheduled until they are replenished. In other words, a hard reservation represents a resource reservation that will only consume a maximum of C units within a given time period T. While this appears to be wasteful, i.e., the time between D and the end of each interval T is not being utilized at all, this type of reservation can act as a building block model for implementing virtual resources.
[0059] A firm reservation upon depletion can be scheduled for execution only if no other undepleted reservation or unreserved threads are ready to run.
[0060] Finally, a soft reservation upon depletion can be scheduled for execution, along with other unreserved threads and/or depleted reservations. In effect, the soft reservations may then run in a time between the time D and the end of a reservation period T. As shown in the time line, a consumption time Z can be allocated during this time period associated between D and T for such soft reservations.
[0061] A system-call interface may be used by the tasks to invoke upon a request for reservation of a resource. The reservation call interface may include a create, request, modify, bind, set attribute, and other system calls. In particular, the create and request system calls can be used to initiate a reservation and then in turn request a resource on the particular reservation. A modify system call can be used to modify current reservation parameters for the particular resource set
[0062] The scheduler also supports resource requests that are allocated a fixed-priority attribute. Such processes are given access to the available resources on a fixed priority, potentially interrupt-driven basis, as is common in traditional multitasking operating systems such as Linux.
[0063]
[0064] The resource scheduler can operate correctly given the parameters C, D, and T, for a set of processes
[0065] As explained above, other processes may need to be handled in the same manner as in a legacy application by assigning priorities among multiple such tasks on a strict fixed-value basis. For example, a certain task
[0066] The resource reservation model in accordance with the present invention attempts to accommodate such a legacy system in a manner that provides for minimal disruption of the existing legacy fixed priority schemes, as well as for providing for a reservation-based model described above.
[0067]
[0068] In the preferred embodiment, the overall reservation scheme employs a fixed priority scheme to efficiently support legacy fixed priority scheduling. In other words, even reservation tasks are assigned a fixed priority which is equal to its period, T, or deadline, D, depending upon whether a rate-monotonic or deadline-monotonic scheme, is used respectively.
[0069] In the preferred embodiment, the deadline-monotonic model is selected. In this manner, the fixed-priority tasks are granted access to the available resources but will be preempted by reserved tasks. Thus, reservation tasks will always be granted their expected guaranteed access times. There is also a class of soft or background tasks that may be associated with preferential treatment. As such, these tasks may be given an attribute of ‘preferred’. The preferred tasks will be run before tasks having only the soft attribute. Multiple tasks can be bound to a resource set and can therefore contend for the same reservation inside the resource set.
[0070] Once a reservation has been created, a state
[0071] The reservation then begins to execute and consume resources in state
[0072] Upon expiration of the time C, a soft mode is entered in state
[0073] Finally, in state
[0074]
[0075] There may be certain default parameters associated with activities that are not aware of, or do not want to use, the reservation interface. The execution of such activities will be “charged” to a default resource set (or reservation) that is pre-defined in the operating system
[0076] An idle reserve resource set
[0077] The model has a number of advantages that are not associated with systems known in the prior art. For example, legacy applications may have been implemented in the past using simple fixed-priority (or dynamic-priority?) schemes. The invention provides a mechanism for supporting such fixed-priority schemes within the context of a reservation system.
[0078] For example, a resource set