forked from dodng/fast_ring_queue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
15 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,30 @@ | ||
##1. What is a ring queue | ||
-------------- | ||
|
||
Queue is a common data structure, this structure ensures that the data is "first in first out". Ring queue is a special queue structure , To ensure the data are FIFO, but the difference with queue is that they are ring, that is, the prev data of queue head is the queue tail,the data of ring can reuse. | ||
* the data is "first in first out". | ||
* prev data of queue head is the queue tail. | ||
* the data of ring can reuse. | ||
|
||
|
||
##2. The advantages of ring queue | ||
-------------- | ||
|
||
###2.1. Guaranteed elements are first-in, first-out | ||
* Guaranteed elements are first-in, first-out | ||
|
||
###2.2. Element space can be reused | ||
* Element space can be reused | ||
|
||
###2.3. Provides an efficient mechanism for multithread data transfer. | ||
* Provides an efficient mechanism for multithread data transfer. | ||
|
||
|
||
##3. Ring queue of work scenes | ||
##3. Ring queue of work example | ||
-------------- | ||
|
||
(Linux system for PACKET_RX_RING and PACKET_TX_RING support in essence is a kernel to achieve a ring queue), such as the use of multi-threaded data transfer data. | ||
* Linux between kernel and system to transfor network data( PACKET_RX_RING and PACKET_TX_RING ) | ||
|
||
|
||
##4. Actual test results | ||
-------------- | ||
|
||
In CentOS 5.5 (cpu per core frequency 1200MHz) on the device simply test a bit. The size of the ring queue is 10000, the size of the element data is 4 bytes, and the element that can be written and read per second is about 2.5 million, or 250 pps. | ||
* In CentOS 5.5 (cpu per core frequency 1200MHz) . | ||
* ring queue length is 10000, one element data size is 4 bytes | ||
* the element writted and then to read is about 2.5 million per second. |