Hardware-enabled lock mediation for controlling access to a contested resource
AssigneeInternational Business Machines Corporation
InventorsChristopher J. Arges, Nathan D. Fontenot, Joel H. Schopp, Michael T. Strosaker
Life of this patent
Estimating the term…
Abstract
A computer implemented method for control access to a contested resource. When a lock acquisition request is received from a virtual machine, the partition management firmware determines whether the lock acquisition request is received within a preemption period of a time slice allocated to the virtual machine. If the lock acquisition request is received within the preemption period, the partition management firmware ends the time slice early, and performs a context switch.
Claims11
A computer implemented method for controlling access to a contested resource, the computer implemented method comprising:
- receiving a lock acquisition request from a virtual machine in a computer system, wherein the computer system is a computer and wherein the computer is hardware;
- determining, by the computer system, whether the lock acquisition request for a lock is received within a preemption period of a time slice of a defined duration allocated to the virtual machine;
- responsive to determining that the lock acquisition request is received within a preemption period, ending, by the computer system the time slice prior to a conclusion of the defined duration without granting the lock to the virtual machine;
- responsive to determining that the lock acquisition request is not received within the preemption period, setting a flag indicating that the virtual machine holds the lock;
- and to grant the lock to the virtual machine;
- responsive to an ending of the defined duration, determining whether the flag indicating that the virtual machine holds the lock is set;
- responsive to determining that the flag indicating that the virtual machine holds the lock is set, extending the time slice creating an extended time slice allocated to the virtual machine to a duration greater than the defined duration;
- and
- responsive to expiration of the extended time slice, to perform a context switch to a second virtual machine, wherein the context switch is performed by the partition management firmware.
A computer implemented method for controlling access to a contested resource, the method comprising:
- receiving a lock acquisition request from a first virtual machine for acquisition of a lock;
- determining whether the lock acquisition request is received within a preemption period of a time slice of a defined duration allocated to the first virtual machine;
- determining whether the lock is held by a second virtual machine;
- responsive to determining that the lock is not held by the second virtual machine, and responsive to determining that the lock acquisition request is not received within the preemption period, granting the lock to the first virtual machine, setting a flag indicating that the first virtual machine holds the lock;
- and
- granting the lock to the first virtual machine,
- responsive to the ending of a defined duration of a time slice allocated to the first virtual machine, determining whether the flag indicating that the first virtual machine holds the lock is set;
- responsive to determining that the flag indicating that the first virtual machine holds the lock is set, extending the time slice allocated to the first virtual machine to a duration greater than the defined duration;
- and
- responsive to expiration of the extended time slice, performing a context switch to the second virtual machine, wherein the context switch is performed by a partition management firmware.
A computer system, wherein the computer system is a computer and wherein the computer is hardware, the computer system comprising:
- a processor;
- a memory, wherein the memory has computer-implemented instructions encoded thereon for controlling access to a contested resource;
- a bus system connecting the memory to the processor,
- wherein the processor includes a hardware extension allowing a lock instruction in a guest operating system to conditionally trap to a partition management firmware, wherein the processor executes the computer-implemented instructions:
- to receive a lock acquisition request from a virtual machine;
- to determine whether the lock acquisition request for a lock is received within a preemption period of a time slice of a defined duration allocated to the virtual machine;
- responsive to determining that the lock acquisition request is received within the preemption period, to end the time slice prior to a conclusion of the defined duration without granting the lock to the virtual machine;
- responsive to determining that the lock acquisition request is not received within the preemption period, to set a flag indicating that the virtual machine holds the lock;
- and to grant the lock to the virtual machine;
- responsive to an ending of the defined duration, to determine whether the flag indicating that the virtual machine holds the lock is set;
- responsive to determining that the flag indicating that the virtual machine holds the lock is set, to extend the time slice creating an extended time slice allocated to the virtual machine to a duration greater than the defined duration;
- and
- responsive to expiration of the extended time slice, to perform a context switch to a second virtual machine, wherein the context switch is performed by the partition management firmware.
A computer program product for controlling access to a contested resource in a computer system, wherein the computer system is a computer and wherein the computer is hardware, the computer program product comprising:
- a computer-readable storage medium, not including signals and having computer-readable program code embodied therewith, the computer-readable program code comprising:
- computer-readable program code configured to receive a lock acquisition request from a virtual machine;
- computer-readable program code configured to determine whether the lock acquisition request for a lock is received within a preemption period of a time slice of a defined duration allocated to the virtual machine;
- computer-readable program code configured, responsive to determining that the lock acquisition request is received within the preemption period, to end the time slice prior to a conclusion of the defined duration without granting the lock to the virtual machine;
- computer-readable program code configured, responsive to determining that the lock acquisition request is not received within the preemption period, to set a flag indicating that the virtual machine holds the lock;
- and
- computer-readable program code configured, further responsive to determining that the lock acquisition request is not received within the preemption period, to grant the lock to the virtual machine;
- computer-readable program code configured, responsive to an ending of the defined duration, to determine whether the flag indicating that the virtual machine holds the lock is set;
- and
- computer-readable program code configured, responsive to determining that the flag indicating that the virtual machine holds the lock is set, to extend the time slice allocated to the virtual machine to a duration greater than the defined duration;
- and
- computer-readable program code configured, responsive to expiration of the extended time slice, to perform a context switch to a second virtual machine, wherein the context switch is performed by a partition management firmware.
Dependencies are inferred from the claim text.