System and method for transforming a queue from non-blocking to blocking
First Claim
Patent Images
1. A method for transforming a queue from non-blocking to blocking, comprising:
- instantiating a callable object, the callable object having at least one function that can be called;
providing a non-blocking queue into which requests are placed for processing;
providing a function of the non-blocking queue that accepts a first parameter and a second parameter;
associating a thread pool with the non-blocking queue, wherein the thread pool contains one or more threads that process the requests placed in the non-blocking queue, and wherein the thread pool is accessible from the non-blocking queue;
calling the function of the non-blocking queue from a request manager;
including, by the request manager, a caller request as the first parameter of the function of the non-blocking queue, and the instantiated callable object as the second parameter of the non-blocking queue;
determining, by the function of the non-blocking queue, that the non-blocking queue is available to process the caller request;
calling, by the function of the non-blocking queue, the at least one function of the callable object;
polling, by the at least one function of the callable object, a thread from the thread pool;
returning, by the at least one function of the callable object, the polled thread to the function of the non-blocking queue;
returning, by the function of the non-blocking queue, the polled thread to the request manager; and
using the polled thread within the thread pool, to process the caller request.
1 Assignment
0 Petitions
Accused Products
Abstract
A system and method can use continuation-passing to transform a queue from non-blocking to blocking. The non-blocking queue can maintain one or more idle workers in a thread pool that is not accessible from outside of the non-blocking queue. The continuation-passing can eliminate one or more serialization points in the non-blocking queue, and allows a caller to manage the one or more idle workers in the thread pool from outside of the non-blocking queue.
-
Citations
18 Claims
-
1. A method for transforming a queue from non-blocking to blocking, comprising:
-
instantiating a callable object, the callable object having at least one function that can be called; providing a non-blocking queue into which requests are placed for processing; providing a function of the non-blocking queue that accepts a first parameter and a second parameter; associating a thread pool with the non-blocking queue, wherein the thread pool contains one or more threads that process the requests placed in the non-blocking queue, and wherein the thread pool is accessible from the non-blocking queue; calling the function of the non-blocking queue from a request manager; including, by the request manager, a caller request as the first parameter of the function of the non-blocking queue, and the instantiated callable object as the second parameter of the non-blocking queue; determining, by the function of the non-blocking queue, that the non-blocking queue is available to process the caller request; calling, by the function of the non-blocking queue, the at least one function of the callable object; polling, by the at least one function of the callable object, a thread from the thread pool; returning, by the at least one function of the callable object, the polled thread to the function of the non-blocking queue; returning, by the function of the non-blocking queue, the polled thread to the request manager; and using the polled thread within the thread pool, to process the caller request. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A system for transforming a queue from non-blocking to blocking, comprising:
-
one or more microprocessors; a non-blocking queue into which requests can be placed for processing, and that exposes a function of the non-blocking queue that accepts a first parameter and a second parameter; a thread pool that is associated with the non-blocking queue, wherein the thread pool contains one or more threads that process the requests placed in the non-blocking queue, and wherein the thread pool is accessible from the non-blocking queue; wherein the system, running on the one or more microprocessors, operates to; instantiate a callable object, the callable object having at least one function that can be called; call the function of the non-blocking queue from a request manager, wherein the request manager includes a caller request as the first parameter of the function of the non-blocking queue, and the instantiated callable object as the second parameter of the non-blocking queue; determine, via the function of the non-blocking queue, that the non-blocking queue is available to process the caller request; call, via the function of the non-blocking queue, the at least one function of the callable object; poll, via the at least one function of the callable object, a thread from the thread pool; return, via the at least one function of the callable object, the polled thread to the function of the non-blocking queue; return, by the function of the non-blocking queue, the polled thread to the request manager; and use the polled thread within the thread pool, to process the caller request. - View Dependent Claims (11, 12, 13, 14, 15, 16, 17)
-
-
18. A non-transitory machine readable storage medium having instructions stored thereon that when executed cause a system to transform a queue from non-blocking to blocking, by performing a method comprising:
-
instantiating a callable object, the callable object having at least one function that can be called; providing a non-blocking queue into which requests are placed for processing; providing a function of the non-blocking queue that accepts a first parameter and a second parameter; associating a thread pool with the non-blocking queue, wherein the thread pool contains one or more threads that process the requests placed in the non-blocking queue, and wherein the thread pool is accessible from the non-blocking queue; calling the function of the non-blocking queue from a request manager; including, by the request manager, a caller request as the first parameter of the function of the non-blocking queue, and the instantiated callable object as the second parameter of the non-blocking queue; determining, by the function of the non-blocking queue, that the non-blocking queue is empty; calling, by the function of the non-blocking queue, the at least one function of the callable object; polling, by the at least one function of the callable object, a thread from the thread pool; associating, by the at least one function of the callable object, the polled thread with the caller request; returning, by the at least one function of the callable object, the polled thread to the function of the non-blocking queue; returning, by the function of the non-blocking queue, the polled thread to the request manager; and using the polled thread within the thread pool, to process the caller request.
-
Specification