Method and apparatus for serving a request queue
First Claim
Patent Images
1. A method for serving a request queue in a system comprising a plurality of channels, the method comprising the steps of:
- a) acquiring a blocking semaphore to determine the number of channels to acquire;
b) decrementing a blocking semaphore count;
c) acquiring at least one channel from which an incoming request is received;
d) receiving a request;
e) enqueueing the received request;
f) incrementing a dequeueing semaphore count;
g) acquiring the dequeueing semaphore to determine the number of requests to dequeue;
h) decrementing the dequeuing semaphore count;
i) dequeueing an enqueued request;
j) processing the dequeued request; and
k) incrementing a blocking semaphore count.
1 Assignment
0 Petitions
Accused Products
Abstract
A system and method is provided for implementing a thread safe request queue. The request queue is preferably implemented using a circular array and atomic operations are preferably used for non-blocking functionality. In a preferred embodiment of the present invention, the request queue is capable of simultaneous thread release so that threads dequeue only when they are ready to be processed.
-
Citations
14 Claims
-
1. A method for serving a request queue in a system comprising a plurality of channels, the method comprising the steps of:
-
a) acquiring a blocking semaphore to determine the number of channels to acquire;
b) decrementing a blocking semaphore count;
c) acquiring at least one channel from which an incoming request is received;
d) receiving a request;
e) enqueueing the received request;
f) incrementing a dequeueing semaphore count;
g) acquiring the dequeueing semaphore to determine the number of requests to dequeue;
h) decrementing the dequeuing semaphore count;
i) dequeueing an enqueued request;
j) processing the dequeued request; and
k) incrementing a blocking semaphore count. - View Dependent Claims (2, 3, 4, 5, 6, 7)
-
-
8. A circular queue for serving requests in a system having a maximum integer number that can be stored in a machine word, the circular queue comprising:
-
a) an integral number of array elements, S, defined such that the maximum possible integer number stored in a machine word, MAX_INT, is divisible by S as shown in the following equation;
MAX—
INT=0(mod S); and
b) each array element having an index that is a multiple of quotient, q, wherein q is defined by the following equation;
q=(MAX—
INT+1)/S. - View Dependent Claims (9, 10)
-
-
11. A method for choosing and serving a circular array request queue comprising the steps of:
-
a) selecting an integral number of array elements, S1, such that the maximum possible integer number stored in a machine word, MAX_INT, is divisible by S1 as shown in the following equation;
MAX—
INT=0(mod S1);
b) indexing each array element such that the element index is a multiple of quotient, q, wherein q is defined by the following equation;
q1=(MAX—
INT+1)/S1;
c) acquiring a blocking semaphore to determine the number of channels to acquire;
d) decrementing a blocking semaphore count;
e) acquiring at least one channel from which an incoming request is received;
f) receiving a request;
g) enqueueing the received request;
h) incrementing a dequeueing semaphore count;
i) acquiring the dequeueing semaphore to determine the number of requests to dequeue;
j) decrementing the dequeuing semaphore count;
k) dequeueing an enqueued request;
l) processing the dequeued request; and
m) incrementing a blocking semaphore count. - View Dependent Claims (12, 13, 14)
-
Specification