Patent ID: 7328437

Claim:
A computer system for managing a lock, said computer system having a central processor unit and a memory both shared by first and second virtual machines, said computer system comprising: a first program function, executing within said first virtual machine, to acquire an available lock for shared data in said shared memory for said first virtual machine or a second program function executing within said first virtual machine by updating a lock structure in said shared memory, said lock structure listing said first virtual machine or said second program function as a holder of said lock and also listing said second virtual machine or a third program function, executing in said second virtual machine, as waiting for said lock and whether said second virtual machine is idle; responsive to said second program function requesting to release said lock, said first program function reading said lock structure to determine said second virtual machine or said third program function as waiting for said lock and whether said second virtual machine is idle, and if said second virtual machine is idle, said first virtual machine or said first program function sending an interrupt to said second virtual machine, and in response, a fourth program function, executing in said second virtual machine, reading said lock structure to determine that said lock is available and said second virtual machine or said third program function is waiting for said lock, and in response, said fourth program function acquiring said lock for said second virtual machine or said third program function by updating said lock structure, and if said second virtual machine is not idle, said first virtual machine not sending an interrupt to said second virtual machine to alert said second virtual machine of availability of said lock, and subsequently, said fourth program function, responsive to said third program function completing a work item that did not require said lock and without an interrupt being sent to said second virtual machine, reading said lock structure to determine that said lock is available and said second virtual machine or said third program function is waiting for said lock, and in response, acquiring the available lock for said second virtual machine or said third program function by updating said lock structure.