Login| Sign Up| Help| Contact|

Patent Searching and Data


Title:
A RESOURCE MANAGEMENT METHOD
Document Type and Number:
WIPO Patent Application WO/2002/097622
Kind Code:
A2
Abstract:
A mechanism is invoked when a run queue is looking for a thread to dispatch and there is not a thread currently available. The mechanism checks to see if another logical processor on the same physical processor is running a thread. If another logical processor on the same physical processor is running a thread, the logical processor reduces its priority, allowing the other active processor to consume all of the resources for the physical processor. The hardware comprises a timer which periodically wakes up the low priority logical thread. Thus, when a thread becomes ready to dispatch, the logical processor can raise its priority and run a thread.

Inventors:
OLSZEWSKI BRET RONALD
ROMERO LILIAN
SRINIVAS MYSORE SATHYANARAYANA
Application Number:
PCT/GB2002/002349
Publication Date:
December 05, 2002
Filing Date:
May 20, 2002
Export Citation:
Click for automatic bibliography generation   Help
Assignee:
IBM (US)
IBM UK (GB)
International Classes:
G06F9/50; (IPC1-7): G06F9/46
Foreign References:
EP0827071A21998-03-04
Other References:
LO ET AL: "SOFTWARE-DIRECTED REGISTER DEALLOCATION FOR SIMULTANEOUS MULTITHREADED PROCESSORS" IEEE TRANSACTIONS ON PARALLEL AND DISTRIBUTED SYSTEMS, IEEE INC, NEW YORK, US, vol. 10, no. 9, September 1999 (1999-09), pages 922-933, XP000865380 ISSN: 1045-9219
ZILLES C B ET AL: "The use of multithreading for exception handling" MICRO-32. PROCEEDINGS OF THE 32ND. ANNUAL ACM/IEEE INTERNATIONAL SYMPOSIUM ON MICROARCHITECTURE. HAIFA, ISRAEL, NOV. 16 - 18, 1999, PROCEEDINGS OF THE ANNUAL ACM/IEEE INTERNATIONAL SYMPOSIUM ON MICROARCHITECTURE, LOS ALAMITOS, CA: IEEE COMP. SOC, US, 16 November 1999 (1999-11-16), pages 219-229, XP010364931 ISBN: 0-7695-0437-X
WALLACE S ET AL: "Threaded multiple path execution" COMPUTER ARCHITECTURE, 1998. PROCEEDINGS. THE 25TH ANNUAL INTERNATIONAL SYMPOSIUM ON BARCELONA, SPAIN 27 JUNE-1 JULY 1998, LOS ALAMITOS, CA, USA,IEEE COMPUT. SOC, US, 27 June 1998 (1998-06-27), pages 238-249, XP010291395 ISBN: 0-8186-8491-7
FARCY A ET AL: "IMPROVING SINGLE-PROCESS PERFORMANCE WITH MULTITHREADED PROCESSORS" PROCEEDINGS OF THE 1996 INTERNATIONAL CONFERENCE ON SUPERCOMPUTING. PHILADELPHIA, MAY 25 - 28, 1996, PROCEEDINGS OF THE INTERNATIONAL CONFERENCE ON SUPERCOMPUTING, NEW YORK, ACM, US, vol. CONF. 10, 25 May 1996 (1996-05-25), pages 350-357, XP000683043 ISBN: 0-89791-803-7
Attorney, Agent or Firm:
Burt, Roger James (Intellectual Property Law Hursley Par, Winchester Hampshire SO21 2JN, GB)
Moss, Robert Douglas (Intellectual Property Law Hursley Par, Winchester Hampshire SO21 2JN, GB)
Download PDF:
Claims:
CIAIMS
1. A method for managing resources of a physical processor, comprising: determining whether a first logical processor located on the physical processor is idle; in response to determining that the first logical processor is idle, determining whether a second logical processor located on the physical processor is busy; and in response to determining that the second logical processor is busy, transferring resources associated with the physical processor to the second logical processor..
2. The method of claim 1, in which the step of determining whether the first logical processor is idle further comprises: determining whether the first logical processor is executing a current thread; and in response to determining that the first logical processor is not executing a current thread, determining whether a first run queue associated with the first logical processor is empty, in which the first logical processor is idle if the first run queue is empty.
3. The method of claim 2, further comprising: in response to determining that the first run queue is not empty, executing a thread from the run queue.
4. The method of claim 1, in which the first logical processor is not idle if the first logical processor is executing a current thread.
5. The method of any preceding claim, further comprising: in response to determining that the second logical processor is not busy, determining whether a thread is available in a second run queue associated with a third logical processor located on a second physical processor.
6. The method of claim 5, further comprising: in response to determining that a thread is available in the second run queue, executing on the first logical processor a thread from the second run queue.
7. The method of any preceding claim, in which the step of transferring resources associated with the physical processor, further comprises: lowering the priority of the first logical processor.
8. An apparatus for managing resources of a physical processor, comprising: means for determining whether a first logical processor located on the physical processor is idle; means, responsive to determining that the first logical processor is idle, for determining whether a second logical processor located on the physical processor is busy; and means, responsive to determining that the second logical processor is busy, for transferring resources associated with the physical processor to the second logical processor.
9. A computer program product for managing resources of a physical processor, said computer program product comprising computer program instructions for performing the steps of: determining whether a first logical processor located on the physical processor is idle; in response to determining that the first logical processor is idle, determining whether a second logical processor located on the physical processor is busy; and in response to determining that the second logical processor is busy, transferring resources associated with the physical processor to the second logical processor.
Description:
A RESOURCE MANAGEMENT METHOD Field of the Invention The present invention relates to multiprocessing systems and, in particular, to multithreading on multiprocessing systems.

Background of the Invention In a symmetric multiprocessing (SMP) operating system, multiple central processor units are active at the same time. Certain types of applications involving independent threads or processes of execution lend themselves to multiprocessing. For example, in an order processing system, each order may be entered independently of the other orders. When running workloads, a number of variables influence. the total throughput of the system. One variable is the distribution of memory between threads of execution and memory available. Another variable is the affinity of threads to processors (dispatching). Normally, optimal performance is obtained by having the maximum number of threads running to achieve 100% central processor unit (CPU) utilization and to have high affinity.

Hardware multithreading (HMT) allows two or more logical contexts, also referred to as logical processors, to exist on each physical processor. HMT allows each physical processor to alternate between multiple threads, thus increasing the number of threads that are currently running. When a thread is dispatched to a logical processor, the thread runs as if it is the only thread running on the physical processor.

However, the physical processor is actually able to run one thread for each logical processor. For example, a system with twenty-four physical processors and two logical processors per physical processors actually functions as a system with forty-eight processors. Current implementations of HMT usually involve sharing of some resources between the logical processors on the physical processor. The benefit is that when one logical processor is waiting for something, such as with memory latency, the other logical processor can perform processing functions.

Another variant of multithreading is called simultaneous multithreading (SMT). In SMT, the resources of the physical processor are shared but the threads actually execute concurrently. For example, one thread may perform a"load"from memory at the same time another thread performs a"multiply". The number of program threads that are ready to

run at any point in time is referred to as the multiprogramming level.

Even with HMT, the switch back and forth between logical processors is rapid enough to give software the impression that the multiprogramming level is increased to the number of logical processors per physical processor.

However, the gain in throughput by adding logical processors may be much less than the increase that would be expected by adding a corresponding number of physical processors. In fact, for a system with two logical processors per physical processor, throughput may only increase on the order of ten percent.

In Advanced Interactive eXecutive (AIX), (AIX is a registered trademark of International Business Machines Corporation), the processor management system implements HMT with one run queue for each logical processor. A run queue is a place where ready threads wait to run. When a logical processor becomes idle and there are no threads waiting in the run queue, the processor checks for threads to"steal,"or acquire from another logical processor's run queue. This stealing process allows the system to balance utilization of the various run queues. However, moving a thread between physical processors is expensive, particularly with respect to cache resources.

The AIX implementation of HMT increases the number of run queues to the number of logical processors. Thus, the system tends to have fewer threads with HMT per run queue than without HMT, unless the multiprogramming level is increased. If the multiprogramming level is increased, the amount of memory consumed by threads increases, reducing the amount of memory left for caching data. Thus, the increased number of threads increases the working set, which tends to increase costly cache misses. In other words, the size of the cache is fixed and therefore increasing the number of threads in a running state at any one time increases the likelihood that data will not be found in the cache.

Therefore, increasing the multiprogramming level results in a performance overhead. Furthermore, an imbalance in the number of processes on run queues results in processes moving around between physical processors, and this also has a negative effect on cache behaviour.

DISCLOSURE OF THE INVENTION It is an advantage of the present invention to provide a mechanism for allowing an operating system to dynamically increase and decrease the

active number of run queues on the hardware without changing the multiprogramming level.

The present invention takes advantage of the fact that two or more logical processors may exist on one physical processor. A mechanism is invoked when a run queue is looking for a thread to dispatch and there is not a thread currently available for that logical processor. The mechanism checks to see if another logical processor on the same physical processor is running a thread. If another logical processor on the same physical processor is running a thread, the logical processor reduces its priority, allowing the other active logical processor to consume all of the resources of the physical processor. The hardware may have a "fairness"mechanisms to ensure that a low priority logical processor is not"starved"of CPU time forever. The hardware comprises a timer which will periodically wake up the low priority logical thread. Thus, when a thread becomes ready to dispatch, the logical processor can raise its priority and run a thread. The present invention allows the operating system to dynamically increase and decrease the active number of run queues on the hardware, thus improving the average processor dispatch affinity without changing the multiprogramming level.

According to a first aspect, the present invention provides a method for managing resources of a physical processor, comprising: determining whether a first logical processor located on the physical processor is idle; in response to determining that the first logical processor is idle, determining whether a second logical processor located on the physical processor is busy; and in response to determining that the second logical processor is busy, transferring resources associated with the physical processor to the second logical processor.

Preferably, the step of determining whether the first logical processor is idle further comprises: determining whether the first logical processor is executing a current thread; and in response to determining that the first logical processor is not executing a current thread, determining whether a first run queue associated with the first logical processor is empty in which the first logical processor is idle if the first run queue is empty. If the first-. run queue is not empty, a thread from the run queue is executed. If the first logical processor is executing a current thread, then the first logical processor is not idle.

In a preferred embodiment, the method further comprises the step of: in response to determining that the second logical processor is not busy,

determining whether a thread is available in a second run queue associated with a third logical processor located on a second physical processor. If it is determined that a thread is available in the second run queue, on the first logical processor, a thread is executed from the second run queue.

Aptly, the step of transferring resources associated with the physical processor, further comprises: lowering the priority of the first logical processor. Preferably, the priority is lowered for a predetermined time period and after the predetermined period of time, the priority of the first logical processor is raised. Once the priority has been raised, the method further comprises the step of dispatching a job to the first logical processor.

According to a second aspect, the present invention provides an apparatus for managing resources of a physical processor, comprising: means for determining whether a first logical processor located on the physical processor is idle; means, responsive to determining that the first logical processor is idle, for determining whether a second logical processor located on the physical processor is busy ; and means, responsive to determining that the second logical processor is busy, for transferring resources associated with the physical processor to the second logical processor.

Preferably, the means for determining whether the first logical processor is idle further comprises: means for determining whether the first logical processor is executing a current thread; and in response to determining that the first logical processor is not executing a current thread, means for determining whether a first run queue associated with the first logical processor is empty. Preferably, the first logical processor is idle if the first run queue is empty. More preferably, the apparatus further comprises means for executing a thread from the run queue if the first run queue is not empty. If the first logical processor is executing a current thread, then the first logical processor is not idle.

In a preferred embodiment, the apparatus further comprises: means, responsive to determining that the second logical processor is not busy, for determining whether a thread is available in a second run queue associated with a third logical processor located on a second physical processor. If it is determined that a thread is available in the second

run queue, on the first logical processor, a thread is executed from the second run queue.

Aptly, the transferring means further comprises: means for lowering the priority of the first logical processor, in which the priority is lowered for a predetermined time period. The apparatus further comprises means for raising the priority of the first logical processor after the predetermined period of time. The apparatus further comprises means, responsive to the raised priority, for dispatching a job to the first logical processor.

According to a third aspect, the present invention provides a computer program product for managing resources of a physical processor, said computer program product comprising computer program instructions for performing the steps of: determining whether a first logical processor located on the physical processor is idle; in response to determining that the first logical processor is idle, determining whether a second logical processor located on the physical processor is busy ; and in response to determining that the second logical processor is busy, transferring resources associated with the physical processor to the second logical processor.

BRIEF DESCRIPTION OF THE DRAWINGS The present invention will now be described, by way of example only, with reference to preferred embodiments thereof, as illustrated in the following drawings, in which: Figure 1 is a block diagram of an illustrative embodiment of a data processing system with which the present invention may advantageously be utilized ; Figure 2 is a block diagram illustrating hardware multithreading in a multiprocessing system in accordance with a preferred embodiment of the present invention ; and Figure 3 is a flowchart illustrating the operation of a logical processor in a multiprocessing system in accordance with a preferred embodiment of the present invention.

DETAILED DESCRIPTION OF THE INVENTION Referring now to the drawings and in particular to Figure 1, there is depicted a block diagram of an illustrative embodiment of a data processing system with which the present invention may be utilized. As shown, data processing system 100 comprises processor cards llla-llln.

Each of processor cards llla-llln comprises a processor and a cache memory. For example, processor card llla comprises processor 112a and cache memory 113a, and processor card llln comprises processor 112n and cache memory 113n.

Processor cards llla-llln are connected to main bus 115. Main bus 115 supports a system planar 120 that comprises processor cards llla-llln and memory cards 123. The system planar also comprises data switch 121 and memory controller/cache 122. Memory controller/cache 122 supports memory cards 123 that comprises local memory 116 having multiple dual in-line memory modules (DIMMs).

Data switch 121 connects to bus bridge 117 and bus bridge 118 located within a native I/O (NIO) planar 124. As shown, bus bridge 118 connects to peripheral components interconnect (PCI) bridges 125 and 126 via system bus 119. PCI bridge 125 connects to a variety of I/O devices via PCI bus 128. As shown, hard disk 136 may be connected to PCI bus 128 via small computer system interface (SCSI) host adapter 130. A graphics adapter 131 may be directly or indirectly connected to PCI bus 128. PCI bridge 126 provides connections for external data streams through network adapter 134 and adapter card slots 135a-135n via PCI bus 127.

An industry standard architecture (ISA) bus 129 connects to PCI bus 128 via ISA bridge 132. ISA bridge 132 provides interconnection capabilities through NIO controller 133 having serial connections Serial 1 and Serial 2. A floppy drive connection 137, keyboard connection 138, and mouse connection 139 are provided by NIO controller 133 to allow data processing system 100 to accept data input from a user via a corresponding input device. In addition, non-volatile RAM (NVRAM) 140 provides a non-volatile memory for preserving certain types of data from system disruptions or system failures, such as power supply problems. A system firmware 141 is also connected to ISA bus 129 for implementing the initial Basic Input/Output System (BIOS) functions. A service processor 144 connects to ISA bus 129 to provide functionality for system diagnostics or system servicing.

The operating system (OS) is stored on hard disk 136, which may also provide storage for additional application software for execution by data processing system. NVRAM 140 is used to store system variables and error information for field replaceable unit (FRU) isolation. During system startup, the bootstrap program loads the operating system and initiates execution of the operating system. To load the operating system, the bootstrap program first locates an operating system kernel type from hard disk 136, loads the OS into memory, and jumps to an initial address provided by the operating system kernel. Typically, the operating system is loaded into random-access memory (RAM) within the data processing system. Once loaded and initialized, the operating system controls the execution of programs and may provide services such as resource allocation, scheduling, input/output control, and data management.

The present invention may be executed in a variety of data processing systems utilizing a number of different hardware configurations and software such as bootstrap programs and operating systems. The data processing system 100 may be, for example, a stand-alone system or part of a network such as a local-area network (LAN) or a wide-area network (WAN).

The preferred embodiment of the present invention, as described below, is implemented within a data processing system 100 with hardware multithreading (HMT). HMT allows two or more logical contexts, also referred to as logical processors, to exist on each processor. The processor management system implements one run queue for each logical processor. A run queue is a place where ready threads wait to run. When a processor becomes idle and there are no threads waiting in the run queue, the processor checks for threads to"steal"and run. This stealing process allows the system to balance utilization of the various run queues.

With reference to Figure 2, a block diagram is shown illustrating hardware multithreading in a multiprocessing system in accordance with a preferred embodiment of the present invention. The multiprocessing system comprises physical processor 0 202 and physical processor 1 204. In the example, physical processor 0 202 runs logical processor 0 212 and logical processor 1 214. Similarly, physical processor 1 204 runs logical processor 2 216 and logical processor 3 218. Furthermore, logical processor 0 212 runs a current thread 222; logical processor 1 214 is idle with no current thread running; logical processor 2 216 runs thread 226 and logical processor 3 218 runs current thread 228.

The processor management system implements run queue 230 for logical processor 0, run queue 240 for logical processor 1, run queue 250 for logical processor 2, and run queue 260 for logical processor 3. Run queue 230 comprises threads 232,234,236; run queue 240 is empty; run queue 250 comprises threads 252,254,256; and, run queue 260 comprises thread 262.

Since logical processor 1 214 has no current job (that is, thread) running and the run queue is empty, logical processor 1 may steal a job from another logical processor. For example, logical processor 1 may steal thread 252 from logical processor 2. However, moving a thread between physical processors is expensive, particularly with respect to cache resources.

In accordance with a preferred embodiment of the present invention, a mechanism is invoked when run queue 240 is looking for a thread to dispatch and there is not a thread currently available. The mechanism checks to see if another logical processor on the same physical processor, i. e. logical processor 0 212, is running a thread. Since logical processor 0 212 is running thread 222, logical processor 1 214 reduces its priority, allowing logical processor 0 to consume all of the resources for physical processor 0 202.

Additionally, the system can have a"fairness"mechanisms to ensure that a low priority logical processor is not starved'of CPU time indefinitely. Preferably, the system also comprises a timer which will periodically wake up a low priority logical thread. Thus, with reference to Figure 2, when a thread becomes ready to dispatch, logical processor 1 can raise its priority and run a thread.

Turning now to Figure 3, a flowchart is shown illustrating the operation of a logical processor in a multiprocessing system in accordance with a preferred embodiment of the present invention. The process begins and a determination is made as to whether an exit condition exists (step 302). An exit condition may be, for example, a shutdown of the system.

If an exit condition exists, the process ends.

If an exit condition does not exist in step 302, a determination is made as to whether the logical processor is idle (step 304). If the logical processor is not idle, the process returns to step 302 to determine whether an exit condition exists. If the logical processor is idle in step 304, a determination is made as to whether a job exists in the local run queue (step 306). If a job exists in the local run queue,

the process takes a job and runs it (step 308). Then, the process returns to step 302 to determine whether an exit condition exists.

If a job does not exist in the local run queue in step 306, a determination is made as to whether another logical processor on the same physical processor is busy (step 310). In other words, the process determines whether a current thread is running in another logical processor on the physical processor. If another logical processor on the same physical processor is busy, the logical processor lowers its priority for a predetermined time period (step 312) and the process returns to step 302 to determine whether an exit condition exists. By lowering the priority, the logical processor becomes dormant or"quiesces". Therefore another logical processor on the same physical processor having a higher priority may then run on the physical processor and consume resources, such as cache, of the physical processor.

If another logical processor is not busy. on the same physical processor in step 310, a determination is made as to whether a job is available to run in yet another run queue (step 314). If a job is available to run in another run queue, the logical processor takes a job and runs it (step 316). If a job is not available to run in another run queue in step 314, the process returns to step 302 to determine whether an exit condition exists.

Thus, the present invention takes advantage of the fact that two or more logical processors exist on one physical processor. A mechanism is invoked when a run queue is looking for a thread to dispatch and there is not a thread currently available. The mechanism checks to see if another logical processor on the same physical processor is running a thread. If another logical processor on the same physical processor is running a thread, the logical processor reduces its priority, allowing the other active processor to consume all of the resources for the physical processor. Preferably, the hardware comprises a timer which will periodically wake up the low priority logical thread. Thus, when a thread becomes ready to dispatch, the logical processor can raise its priority and run a thread. The present invention allows the operating system to dynamically increase and decrease the active number of run queues on the hardware, thus improving the average processor dispatch affinity without changing the multiprogramming level.