Command management using allocated command identifier pools
Systems and methods for threaded computing systems using allocated command identifier pools for command management are described. Command requests for different processing threads are received. Based on the thread assigned to process the command request, command identifiers are assigned from different pools of command identifiers for each thread, where each pool contains non-overlapping sets of command identifiers. The command identifiers are returned to the same pool that the command identifier came from upon completion of each command.
1. A system comprising:
a processor;
a memory; and
a command manager stored in the memory and executable by the processor to:
receive a plurality of command requests, wherein each command request of the plurality of command requests is configured to initiate a corresponding command of a plurality of commands;
determine, for each command request, a corresponding thread from a plurality of threads to distribute the plurality of commands among the plurality of threads, wherein:
each thread of the plurality of threads is configured to operate in a separate context that is unaware of each other thread among the plurality of threads; and
the plurality of command requests includes a first command request for initiating a first command for a first thread selected from the plurality of threads;
assign, based on the first thread, a first command identifier from a first pool of command identifiers to the first command, wherein:
each thread from the plurality of threads has a different associated pool of command identifiers; and
the command manager assigns, to each command of the plurality of commands, a unique command identifier without synchronization across command identifier assignments for the plurality of threads; and
return, upon completion of the first command, the first command identifier to the first pool of command identifiers.
2. The system of claim 1 , further comprising:
an identifier manager stored in the memory and executable by the processor to:
determine a global pool of command identifiers, wherein the global pool includes a total number of command identifiers;
determine a number of threads corresponding to the plurality of threads; and
allocate the total number of command identifiers among a plurality of associated pools of command identifiers, wherein:
each thread of the plurality of threads corresponds to an associated pool of command identifiers from the plurality of associated pools of command identifiers; and
each associated pool of command identifiers includes non-overlapping sets of command identifiers relative to each other associated pool of command identifiers.
3. The system of claim 2 , wherein:
the total number of command identifiers is at least a maximum number of concurrent commands for a target system multiplied by the number of threads; and
each associated pool of command identifiers includes a number of unique command identifiers equal to at least the maximum number of concurrent commands.
4. The system of claim 2 , further comprising:
a configuration interface stored in the memory and executable by the processor to:
determine the total number of command identifiers;
determine the number of threads; and
configure, using the total number of command identifiers and the number of threads, the plurality of associated pools of command identifiers.
5. The system of claim 1 , further comprising:
a plurality of circular queues stored in the memory, wherein each circular queue corresponds to a different associated pool of command identifiers.
6. The system of claim 5 , wherein the command manager is further executable to:
pop, from a first circular queue for the first pool of command identifiers, a next command identifier to assign as the first command identifier; and
push, to the first circular queue, the first command identifier to return the first command identifier to the first pool of command identifiers.
7. The system of claim 5 , wherein each circular queue of the plurality of circular queues includes:
a buffer space in the memory containing a number of cells equal to a number of command identifiers in that circular queue;
a first pointer indicating a next command identifier to assign; and
a second pointer indicating a target cell for a returning command identifier.
8. The system of claim 1 , further comprising:
a storage interface configured for communication with a target memory device; and
a command generator in communication with the storage interface and configured to:
generate a plurality of read/write commands to the target memory device; and
send the plurality of command requests, including the first command request, to the command manager.
9. The system of claim 2 , wherein the identifier manager is further configured to allocate, prior to the command manager receiving the plurality of command requests, the total number of command identifiers among the plurality of associated pools of command identifiers to initialize the plurality of associated pools of command identifiers.
10. The system of claim 8 , further comprising:
a plurality of central processing unit (CPU) cores, wherein:
each CPU core corresponds to a corresponding thread from the plurality of threads; and
the command manager and the storage interface are configured as drivers operating in a kernel space of an operating system instantiated in the plurality of CPU cores.
11. A computer-implemented method, comprising:
receiving a plurality of command requests, wherein each command request of the plurality of command requests is configured to initiate a corresponding command of a plurality of commands;
determining, for each command request, a corresponding thread from a plurality of threads to distribute the plurality of commands among the plurality of threads, wherein:
each thread of the plurality of threads is configured to operate in a separate context that is unaware of each other thread among the plurality of threads; and
the plurality of command requests includes a first command request for initiating a first command for a first thread selected from the plurality of threads;
assigning, to each command of the plurality of commands, a unique command identifier without synchronization across command identifier assignments for the plurality of threads, wherein:
assigning to each command of the plurality of commands includes assigning, based on the first thread, a first command identifier from a first pool of command identifiers to the first command; and
each thread from the plurality of threads has a different associated pool of command identifiers; and
returning, upon completion of the first command, the first command identifier to the first pool of command identifiers.
12. The computer-implemented method of claim 11 , further comprising:
determining a global pool of command identifiers, wherein the global pool includes a total number of command identifiers;
determining a number of threads corresponding to the plurality of threads; and
allocating the total number of command identifiers among a plurality of associated pools of command identifiers, wherein:
each thread of the plurality of threads corresponds to an associated pool of command identifiers from the plurality of associated pools of command identifiers; and
each associated pool of command identifiers includes non-overlapping sets of command identifiers relative to each other associated pool of command identifiers.
13. The computer-implemented method of claim 12 , wherein:
the total number of command identifiers is at least a maximum number of concurrent commands for a target system multiplied by the number of threads; and
each associated pool of command identifiers includes a number of unique command identifiers equal to at least the maximum number of concurrent commands.
14. The computer-implemented method of claim 12 , further comprising:
determining the total number of command identifiers;
and
configuring, using the total number of command identifiers and the number of threads, the plurality of associated pools of command identifiers.
15. The computer-implemented method of claim 11 , further comprising:
selecting a first circular queue from a plurality of circular queues stored in memory, wherein each circular queue corresponds to a different associated pool of command identifiers; and
storing the first pool of command identifiers in the first circular queue.
16. The computer-implemented method of claim 15 , further comprising:
popping, from the first circular queue for the first pool of command identifiers, a next command identifier to assign as the first command identifier; and
pushing, to the first circular queue, the first command identifier to return the first command identifier to the first pool of command identifiers.
17. The computer-implemented method of claim 15 , wherein each circular queue of the plurality of circular queues includes:
a buffer space in a memory containing a number of cells equal to a number of command identifiers in that circular queue;
a first pointer indicating a next command identifier to assign; and
a second pointer indicating a target cell for a returning command identifier.
18. The computer-implemented method of claim 11 , further comprising:
generating a plurality of read/write commands to a target memory device; and
sending the plurality of command requests, including the first command request, for the plurality of read/write commands to a command manager for assigning command identifiers.
19. The computer-implemented method of claim 12 , wherein allocating the total number of command identifiers among the plurality of associated pools of command identifiers is performed prior to receiving the plurality of command requests.
20. A system, comprising:
a processor;
a memory;
means for receiving a plurality of command requests, wherein each command request of the plurality of command requests is configured to initiate a corresponding command of a plurality of commands;
means for determining, for each command request, a corresponding thread from a plurality of threads to distribute the plurality of commands among the plurality of threads, wherein:
each thread of the plurality of threads is configured to operate in a separate context that is unaware of each other thread among the plurality of threads; and
the plurality of command requests includes a first command request for initiating a first command for a first thread selected from the plurality of threads;
means for assigning, to each command of the plurality of commands, a unique command identifier without synchronization across command identifier assignments for the plurality of threads, wherein:
assigning to each command of the plurality of commands includes assigning, based on the first thread, a first command identifier from a first pool of command identifiers to the first command; and
each thread from the plurality of threads has a different associated pool of command identifiers; and
means for returning, upon completion of the first command, the first command identifier to the first pool of command identifiers.