Techniques for accessing a shared resource using an improved synchronization mechanism
First Claim
1. A method for accessing a shared resource of a computerized system, the method comprising:
- running a first portion of a first thread within the computerized system, the first portion (i) requesting a lock on the shared resource and (ii) directing the computerized system to make operations of a second thread visible in a correct order, the correct order preventing an exclusion failure, the first portion of the thread representing at least instructions that perform the steps of requesting and directing;
making operations of the second thread visible in the correct order in response to the first portion of the first thread running within the computerized system, the second thread visible to at least one other processor; and
running a second portion of the first thread within the computerized system to determine whether the first thread has obtained the lock on the shared resource, the second portion of the thread representing at least one instruction that performs the step of determining whether the first thread has obtained the lock on the shared resource;
wherein running the first portion of the first thread includes;
performing a store operation which stores a lock request value in a memory variable which is accessible by both the first and second threads;
performing a memory barrier operation which guarantees execution of the store operation before a next operation; and
performing, as the next operation, a system call which directs the computerized system to make operations of the second thread visible in the correct order;
wherein performing the system call includes;
executing operating system code to change protection of a page of memory of the computerized system.
3 Assignments
0 Petitions
Accused Products
Abstract
A technique for accessing a shared resource of a computerized system involves running a first portion of a first thread within the computerized system, the first portion (i) requesting a lock on the shared resource and (ii) directing the computerized system to make operations of a second thread visible in a correct order. The technique further involves making operations of the second thread visible in the correct order in response to the first portion of the first thread running within the computerized system, and running a second portion of the first thread within the computerized system to determine whether the first thread has obtained the lock on the shared resource. Such a technique alleviates the need for using a MEMBAR instruction in the second thread.
-
Citations
15 Claims
-
1. A method for accessing a shared resource of a computerized system, the method comprising:
-
running a first portion of a first thread within the computerized system, the first portion (i) requesting a lock on the shared resource and (ii) directing the computerized system to make operations of a second thread visible in a correct order, the correct order preventing an exclusion failure, the first portion of the thread representing at least instructions that perform the steps of requesting and directing; making operations of the second thread visible in the correct order in response to the first portion of the first thread running within the computerized system, the second thread visible to at least one other processor; and running a second portion of the first thread within the computerized system to determine whether the first thread has obtained the lock on the shared resource, the second portion of the thread representing at least one instruction that performs the step of determining whether the first thread has obtained the lock on the shared resource; wherein running the first portion of the first thread includes; performing a store operation which stores a lock request value in a memory variable which is accessible by both the first and second threads; performing a memory barrier operation which guarantees execution of the store operation before a next operation; and performing, as the next operation, a system call which directs the computerized system to make operations of the second thread visible in the correct order; wherein performing the system call includes; executing operating system code to change protection of a page of memory of the computerized system. - View Dependent Claims (2, 3, 4, 5)
-
-
6. A computerized system, comprising:
-
an interface configured to provide external access to the computerized system; a shared resource; and control circuitry coupled to the interface and the share resource, the control circuitry, when accessing the shared resource, being configured to; run a first portion of a first thread within the computerized system, the first portion (i) requesting a lock on the shared resource and (ii) directing the computerized system to make operations of a second thread visible in a correct order, the correct order preventing an exclusion failure, the first portion of the thread representing at least instructions that perform the steps of requesting and directing; make operations of the second thread visible in the correct order in response to the first portion of the first thread running within the computerized system, the second thread visible to at least one other processor; and run a second portion of the first thread within the computerized system to determine whether the first thread has obtained the lock on the shared resource, the second portion of the thread representing at least one instruction that performs the step of determining whether the first thread has obtained the lock on the shared resource; wherein the control circuitry, when running the first portion of the first thread, is configured to; perform a store operation which stores a lock request value in a memory variable which is accessible by both the first and second threads; perform a memory baffler operation which guarantees execution of the store operation before a next operation; and perform, as the next operation, the system call which directs the computerized system to make operations of the second thread visible in the correct order; wherein the control circuitry, when performing the system call, is configured to; execute operating system code to change protection of a page of memory of the computerized system. - View Dependent Claims (7, 8, 9, 10)
-
-
11. A computer program product that includes a computer readable medium having instructions stored thereon for accessing a shared resource of a computerized system, such that the instructions, when carried out by the computerized system, causes the computerized system to:
-
run a first portion of a first thread within the computerized system, the first portion (i) requesting a lock on the shared resource and (ii) directing the computerized system to make operations of a second thread visible in a correct order, the correct order preventing an exclusion failure, the first portion of the thread representing at least instructions that perform the steps of requesting and directing; make operations of the second thread visible in the correct order in response to the first portion of the first thread running within the computerized system, the second thread visible to at least one other processor; and run a second portion of the first thread within the computerized system to determine whether the first thread has obtained the lock on the shared resource, the second portion of the thread representing at least one instruction that performs the step of determining whether the first thread has obtained the lock on the shared resource; wherein running the first portion of the first thread includes; performing a store operation which stores a lock request value in a memory variable which is accessible by both the first and second threads;
performing a memory barrier operation which guarantees execution of the store operation before a next operation; andperforming, as the next operation, the system call which directs the computerized system to make operations of the second thread visible in the correct order; wherein performing the system call includes; executing operating system code to change protection of a page of memory of the computerized system. - View Dependent Claims (12, 13, 14, 15)
-
Specification