Sharing lock mechanism between protocol layers
AssigneeInternational Business Machines Corporation
InventorsRobert S. Blackmore, Su-Hsuan Huang, Chulho Kim, Richard R. Treumann, Hanhong Xue
Life of this patent
Estimating the term…
Abstract
Shared locks are employed for controlling a thread which extends across more than one protocol layer in a data processing system. The use of a counter is used as part of a data structure which makes it possible to implement shared locks across multiple layers. The use of shared locks avoids the processing overhead usually associated with lock acquisition and release. The thread which is controlled may be initiated in either an upper layer protocol or in a lower layer.
Claims9
A method for controlling a thread performing at least one atomic operation in a data processing system, wherein the thread extends across at least two protocol layers for processing at least one event in each protocol layer, said method comprising the steps of:
- initializing, by one of said at least two protocol layers, a lock with an associated at least one locking function defined in a first layer of said at least two protocol layers, wherein said at least one locking function of said lock is visible by an interface to said at least two protocol layers without making the implementation of the lock visible;
- responsive to said thread called from a user, acquiring said lock, by said thread, by calling said at least one locking function from within said first layer;
- preprocessing said at least one event by said thread within said first layer;
- calling, by said thread, a second layer of said at least two protocol layers;
- determining, by said thread from within said second layer, whether a status for said lock is already acquired by said thread by calling said at least one locking function;
- responsive to said status indicating said lock is already acquired by said thread, recursively acquiring said lock by said thread by incrementing a counter associated with said lock, processing said at least one event by said thread within said second layer including a temporary return of said thread to said first protocol layer, recursively releasing said lock by said thread by decrementing said counter, and returning to said first layer;
- postprocessing said at least one event by said thread within said first layer;
- and
- releasing said lock, by said thread, by calling a release function of said locking functions from within said first layer and returning to said user.
A program product comprising:
- storage containing program instructions thereon, usable by a data processing system, for:
- initializing, by one of at least two protocol layers, a lock with an associated at least one locking function defined in a first layer of said at least two protocol layers, wherein said at least one locking function of said lock is visible by an interface to said at least two protocol layers without making the implementation of the lock visible;
- responsive to a thread called from a user, acquiring said lock, by said thread which extends across said at least two protocol layers for processing at least one event in each protocol layer, by calling said at least one locking function from within said first layer;
- preprocessing said at least one event by said thread within said first layer;
- calling, by said thread, a second layer of said at least two protocol layers;
- determining, by said thread from within said second layer, whether a status for said lock is already acquired by said thread by calling said at least one locking function;
- responsive to said status indicating said lock is already acquired by said thread, recursively acquiring said lock by said thread by incrementing a counter associated with said lock, processing said at least one event by said thread within said second layer including a temporary return of said thread to said first protocol layer, recursively releasing said lock by said thread by decrementing said counter, and returning to said first layer;
- postprocessing said at least one event by said thread within said first layer;
- and
- releasing said lock, by said thread, by calling a release function of said locking functions from within said first layer and returning to said user.
Dependencies are inferred from the claim text.