Skip to content

Step-x-Group/iouring_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How io_uring works

https://blog.akinokae.de/p/io_uring-with-rust/io_uring-workflow.png

The io_uring framework is built around two primary ring buffers managed by the kernel:

Submission Queue (SQ): This is where user space enqueues operations for the kernel to execute. It holds Submission Queue Entries (SQEs) that describe the requested operations.
Completion Queue (CQ): This is where the kernel posts the results of completed operations. It contains Completion Queue Entries (CQEs) with details of the operation’s outcome.

These queues follow a single-producer, single-consumer model, which ensures efficient data transfer between user and kernel spaces.

Here’s step-by-step how io_uring works:

In User Space:
    The application begins by creating and registering a ring buffer with the kernel. This ring buffer contains both the Submission Queue and Completion Queue.
    The user constructs a Submission Queue Entry (SQE) that describes the operation to perform. This could be a file read, write, or another supported operation.
    The constructed SQE is then pushed to the Submission Queue.
    The user updates the tail pointer of the Submission Queue to notify the kernel about the new entry.
    The application waits for results in the Completion Queue. This waiting can be active or passive depending on the application’s design.
    Once the operation completes, the application retrieves the corresponding Completion Queue Entry (CQE) and processes the result.

In Kernel Space:
    The kernel retrieves the SQE from the Submission Queue and validates it.
    The kernel executes the operation described by the SQE. This could involve reading data, writing to a file, or another supported action.
    After completing the operation, the kernel posts a CQE with the result to the Completion Queue, allowing the user space to process the outcome.

By avoiding unnecessary system calls and reducing the need for user-kernel transitions, io_uring achieves remarkable efficiency.

About

iouring tests in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages