System for scheduling programming units to a resource based on status variables indicating a lock or lock-wait state thereof
First Claim
Patent Images
1. A computer system comprising:
- a plurality of program units;
a shared resource which can be locked by any one of said program units;
a processor unit including at least one processor means for executing one of said program units;
control means for holding a status variable indicating that a corresponding one of said program units is in a lock-wait state when said program unit uses said shared resource, and for holding a lock variable indicating whether said shared resource is locked, said status variable holding an address of said lock variable when said corresponding program unit is in said lock-wait state; and
scheduling means including;
selecting means for selecting one of said program units as a candidate for allocation of said processor unit;
a status-variable pointer for holding an address of said status variable held by said control means;
means for allocating said processor unit to said program unit selected by said selecting means when said scheduling means does not have a status-variable pointer corresponding to said selected program unit;
referring means for referring to said status-variable pointer to obtain said address of said status variable corresponding to said selected program unit when said scheduling means has a status-variable pointer corresponding to said selected program unit;
first referring means for referring to said status variable in accordance with said address obtained by said referring means;
means for allocating said processor unit to said selected program unit when said status variable referred to by said first referring means indicates that said selected program unit is not in a lock-wait state;
second referring means for referring to said lock variable corresponding to said address held in said status variable referred to by said first referring means when said selected program unit is in a lock-wait state; and
means for allocating said processor unit to said selected program unit when said lock variable referred to by said second referring means indicates that said shared resource is unlocked.
2 Assignments
0 Petitions
Accused Products
Abstract
A computer system comprising a CPU and a scheduler. The CPU sets a predetermined value in the status variable corresponding to a thread when the thread starts waiting for a resource which it shares with other threads. The scheduler refers to the status variable, selects, with priority, a thread other than the thread waiting for the shared resource, and allocates the CPU to the thread thus selected.
102 Citations
6 Claims
-
1. A computer system comprising:
-
a plurality of program units; a shared resource which can be locked by any one of said program units; a processor unit including at least one processor means for executing one of said program units; control means for holding a status variable indicating that a corresponding one of said program units is in a lock-wait state when said program unit uses said shared resource, and for holding a lock variable indicating whether said shared resource is locked, said status variable holding an address of said lock variable when said corresponding program unit is in said lock-wait state; and scheduling means including; selecting means for selecting one of said program units as a candidate for allocation of said processor unit; a status-variable pointer for holding an address of said status variable held by said control means; means for allocating said processor unit to said program unit selected by said selecting means when said scheduling means does not have a status-variable pointer corresponding to said selected program unit; referring means for referring to said status-variable pointer to obtain said address of said status variable corresponding to said selected program unit when said scheduling means has a status-variable pointer corresponding to said selected program unit; first referring means for referring to said status variable in accordance with said address obtained by said referring means; means for allocating said processor unit to said selected program unit when said status variable referred to by said first referring means indicates that said selected program unit is not in a lock-wait state; second referring means for referring to said lock variable corresponding to said address held in said status variable referred to by said first referring means when said selected program unit is in a lock-wait state; and means for allocating said processor unit to said selected program unit when said lock variable referred to by said second referring means indicates that said shared resource is unlocked. - View Dependent Claims (2, 3, 4, 5)
-
-
6. A scheduling method for allocating a processor unit to a program unit in a computer system comprising a plurality of program units and a shared resource which can be locked by any one of the program units, said method comprising the steps of:
-
holding a status variable indicating that one of the program units is in a lock-wait state when using the shared resource, and for holding a lock variable indicating that the shared resource is locked when being used; setting an address of the lock variable to the status variable of any program unit that is in a lock-wait state; selecting one of the program units as a candidate for allocating the processor unit; holding an address of the status variable in a scheduler; allocating the processor unit to the selected program unit when the scheduler does not hold the address of the status variable corresponding to the selected program unit; obtaining the address of the status variable which corresponds to the selected program unit when the scheduler holds the address of the status variable corresponding to the selected program unit; referring to the status variable in accordance with the address obtained; allocating the processor unit to the selected program unit when the status variable referred to indicates that the selected program unit is not in a lock-wait state; referring to the lock variable corresponding to the address held in the status variable referred to; and allocating the processor unit to the selected program unit when the lock variable referred to indicates that the shared resource is unlocked.
-
Specification