Method and system for robust futexes
First Claim
Patent Images
1. A method of managing futex primitives, the method comprising:
- Providing a private data structure in user-space, the private data structure being private to a first computer process and comprising at least one futex, wherein each futex serves as a lock on a resource provided by a computer system;
Registering the private data structure by the first computer process;
Linking a pending entry data structure to the private data structure;
Setting a pending entry flag in the pending entry data structure, wherein the pending entry flag indicates that the first computer process is about to acquire a selected futex;
Acquiring the selected futex from a plurality of futexes;
Linking the selected futex to the private data structure after acquiring the selected futex;
Detecting a termination of the first computer process;
Searching the private data structure and the pending entry data structure for a status of the selected futex, wherein at least one other computer process is waiting for the selected futex;
Setting a first flag for the selected futex indicating that the first computer process terminated prior to releasing the selected futex if the status indicates that the selected futex is held by the first computer process or if the pending entry flag is set;
Releasing the selected futex if the first flag is set for the selected futex; and
Notifying the at least one other computer process, and if the first flag is set for the selected futex, the at least one other computer process resolves race conditions and verifies a consistency of data associated with the resource locked by the selected futex.
1 Assignment
0 Petitions
Accused Products
Abstract
An embodiment relates to a method of managing primitives. The method includes providing a data structure available in user-space where the data structure comprises at least one futex. The method also includes detecting a termination of the process and searching the data structure for status of the at least one futex. The method further includes releasing the at least one futex in response to status of the at least one futex being held and setting a flag for at least one futex. The method further includes notifying at least one process waiting for the released at least one futex.
10 Citations
12 Claims
-
1. A method of managing futex primitives, the method comprising:
-
Providing a private data structure in user-space, the private data structure being private to a first computer process and comprising at least one futex, wherein each futex serves as a lock on a resource provided by a computer system; Registering the private data structure by the first computer process; Linking a pending entry data structure to the private data structure; Setting a pending entry flag in the pending entry data structure, wherein the pending entry flag indicates that the first computer process is about to acquire a selected futex; Acquiring the selected futex from a plurality of futexes; Linking the selected futex to the private data structure after acquiring the selected futex; Detecting a termination of the first computer process; Searching the private data structure and the pending entry data structure for a status of the selected futex, wherein at least one other computer process is waiting for the selected futex; Setting a first flag for the selected futex indicating that the first computer process terminated prior to releasing the selected futex if the status indicates that the selected futex is held by the first computer process or if the pending entry flag is set; Releasing the selected futex if the first flag is set for the selected futex; and Notifying the at least one other computer process, and if the first flag is set for the selected futex, the at least one other computer process resolves race conditions and verifies a consistency of data associated with the resource locked by the selected futex. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. A system for managing futex primitives, the system comprising:
-
a private data structure configured to store futexes designated as being held by a first computer process, wherein the private data structure is registered by the first computer process and is private to the first computer process, and each of the futexes serves as a lock on a resource provided by a computer system; a pending entry data structure configured to store a flag and linked to the private data structure, wherein the private and pending entry data structures are in user space; and a futex module configured to; set a pending entry flag in the pending entry data structure in response to the first computer process acquiring a selected robust futex from a plurality of robust futexes, wherein the pending entry flag indicates that the first computer process is about to acquire the selected robust futex, link the selected robust futex to the private data structure after the first computer process acquires the selected robust futex, detect a termination of the first computer process, search the private data structure and the pending entry data structure for a status of the selected robust futex, wherein at least one other computer process is waiting for the selected futex, set a first flag indicating that the first computer process terminated prior to releasing the selected robust futex, if the selected robust futex is found in the private data structure or if the pending entry flag is set, release the selected robust futex if the first flag is set for the selected robust futex, and notify the at least one other computer process, and if the first flag is set for the selected robust futex, the at least one other computer process resolves race conditions and verifies a consistency of data associated with the resource locked by the selected robust futex. - View Dependent Claims (10, 11, 12)
-
Specification