Method and apparatus for serializing access to multithreading unsafe resources
First Claim
1. A computer-implemented method for synchronizing multithreaded processes within a multitasking computer system so that multiple threads can safely access a multithreading unsafe resource, said method comprising the computer-implemented steps of:
- (a) creating a baton object for each thread that desires access to a multithreading unsafe resource, each of the baton objects contending for a baton associated with the multithreading unsafe resource, wherein the multithreading unsafe resource may only be accessed by a particular thread when such thread'"'"'s associated baton object holds the baton;
(b) causing a first one of the baton objects to hold the baton before the thread associated with the first baton object is permitted to access the multithreading unsafe resource;
(c) subsequent to said causing step (b), permitting the thread associated with the first baton object to access the multithreading unsafe resource; and
(d) releasing the baton from the baton object once the access by the thread associated with the first baton object is completed,whereby when the first baton object holds the baton, other baton objects are prevented from holding the baton and their associated threads are prevented from accessing the multithreading unsafe resource.
1 Assignment
0 Petitions
Accused Products
Abstract
An improved technique for serializing access to multithreading unsafe resources is described. A baton manager is used to manage the serializing of accesses to a multithreading unsafe resource. For a thread to access the multithreading unsafe resource, the thread must first obtain a baton from the baton manager. Then, once the thread has finished accessing the multithreading unsafe resource, the thread releases the baton to the baton manager. Hence, by using the baton manager to manage the baton, accesses to multithreading unsafe resources are serialized while program crashes or deadlocks are minimized. The multithreading unsafe resource will typically have a plurality of baton objects associated therewith. The baton objects are objects of object-oriented programming. The baton manager will permit at most one of the baton objects for a given multithreading unsafe resource to own the baton at a time. The threads associated with the baton objects waiting to own the baton must wait until they receive the baton before they can access the multithreading unsafe resource.
-
Citations
27 Claims
-
1. A computer-implemented method for synchronizing multithreaded processes within a multitasking computer system so that multiple threads can safely access a multithreading unsafe resource, said method comprising the computer-implemented steps of:
-
(a) creating a baton object for each thread that desires access to a multithreading unsafe resource, each of the baton objects contending for a baton associated with the multithreading unsafe resource, wherein the multithreading unsafe resource may only be accessed by a particular thread when such thread'"'"'s associated baton object holds the baton; (b) causing a first one of the baton objects to hold the baton before the thread associated with the first baton object is permitted to access the multithreading unsafe resource; (c) subsequent to said causing step (b), permitting the thread associated with the first baton object to access the multithreading unsafe resource; and (d) releasing the baton from the baton object once the access by the thread associated with the first baton object is completed, whereby when the first baton object holds the baton, other baton objects are prevented from holding the baton and their associated threads are prevented from accessing the multithreading unsafe resource. - View Dependent Claims (2, 3, 4, 5, 6, 7, 24)
-
-
8. A computer-implemented method for synchronizing multithreaded processes so that multiple threads can safely access a multithreading unsafe algorithm, said method comprising the computer-implemented steps of:
-
(a) creating baton objects for each thread desiring access to a multithreading unsafe algorithm, each of the baton objects contending for a baton associated with the multithreading unsafe algorithm; (b) before one of the threads calls the multithreading unsafe algorithm, requiring the baton object associated with the one of the threads to grab the baton associated with the multithreading unsafe algorithm; (c) subsequent to said requiring step (b), permitting the thread associated with the baton object holding the baton to call the multithreading unsafe algorithm, wherein the multithreading unsafe algorithm may only be called by a particular thread when such thread'"'"'s associated baton object holds the baton; (d) returning from the multithreading unsafe algorithm; and (e) subsequent to said returning step (d), releasing the baton from the baton object that grabbed the baton in step (b); and whereby when a particular baton object holds the baton, other baton objects are prevented from holding the baton and the threads associated with the baton object that are prevented from holding the baton are prevented from accessing the multithreading unsafe algorithm. - View Dependent Claims (9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 25)
-
-
19. An apparatus for serializing access to a multithreading unsafe resource, said apparatus comprising:
-
executable computer code including access requests to the multithreading unsafe resource; a computer system and an operating system which both support multithreading, said computer system in conjunction with said operating system being arranged to execute said executable computer code in a multithreaded manner; and a baton manager, operatively connected to said computer system and said operating system and the multithreading unsafe resource, for serializing access of the multithreading unsafe resource by said computer system and said operating system during the execution of said executable computer code so that at any given point in time only a single thread accesses the multithreading unsafe resource, wherein said baton manager uses at least one baton object to manage ownership of a mutually exclusive lock, the baton objects being associated with at most one thread and the mutually exclusive lock being arranged to insure that the accesses to the multithreading unsafe resource are serialized. - View Dependent Claims (20, 21, 26)
-
-
22. A computer program product, comprising:
-
a computer usable medium having computer readable code embodied therein for serializing access to multithreading unsafe resources, and wherein said computer readable code comprises; first computer readable program code devices configured to cause a computer to effect creating a baton object associated with at most one thread, the baton object being configured to facilitate accessing a multithreading unsafe resource wherein the multithreading unsafe resource may only be accessed by the thread associated with the baton object when the baton object holds the baton; second computer readable program code devices configured to cause a computer to effect grabbing a baton by the baton object before accessing the multithreading unsafe resource; third computer readable program code devices configured to cause a computer to effect accessing the multithreading unsafe resource; and fourth computer readable program code devices configured to cause a computer to effect releasing the baton from the baton object after the accessing of the multithreading unsafe resource is complete; and whereby when the baton object holds the baton, threads not associated with the baton object are prevented from accessing the multithreading unsafe resource. - View Dependent Claims (23, 27)
-
Specification