From 4872972c15e018bfc74c60401ca385af8a7a1200 Mon Sep 17 00:00:00 2001 From: Alex Kladov Date: Mon, 23 Sep 2024 22:36:35 +0100 Subject: [PATCH] what is io_uring? --- content/posts/2024-09-32--what-is-io-uring.dj | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 content/posts/2024-09-32--what-is-io-uring.dj diff --git a/content/posts/2024-09-32--what-is-io-uring.dj b/content/posts/2024-09-32--what-is-io-uring.dj new file mode 100644 index 00000000..2d52fbfd --- /dev/null +++ b/content/posts/2024-09-32--what-is-io-uring.dj @@ -0,0 +1,27 @@ +# What is io_uring? + +An attempt at concise explanation of what io_uring is. + +`io_uring` is a new Linux kernel interface for making system calls. +Traditionally, syscalls are submitted to the kernel *individually* and +*synchronously*: a syscall CPU instruction transfers control from the +application to the kernel; control returns to the application only when the +syscall is completed. In contrast, `io_uring` is a *batched* and *asynchronous* +interface. The application submits several syscalls by writing their codes & +arguments to a lock-free shared-memory ring buffer. The kernel reads the +syscalls from this shared memory and executes them at its own pace. To +communicate results back to the application, the kernel writes the results to a +second lock-free shared-memory ring buffer, where they become available to the +application asynchronously. + +You might want to use `io_uring` if: + +- you need extra performance unlocked by amortizing userspace/kernelspace + context switching across entire batches of syscalls, +- you want a unified asynchronous interface to the entire system. + +You might want to avoid `io_uring` if: + +- you need to write portable software, +- you want to use only old, proven features, +- and in particular you want to use features with a good security track record. \ No newline at end of file