Io_uring is not an event system (2021)(despairlabs.com)
33 points by signa11 4 days ago | 16 comments
- kiitos 4 hours ago"event system" is any mechanism where events (readiness, completion, signals, GUI messages) drive control flow, restricting "event system" to descriptor readiness exclusively is the author's personal framing, not exactly common parlance
- PunchyHamster 5 hours ago>io_uring is not an event system at all. io_uring is actually a generic asynchronous syscall facility.
It's not an event system at all! It's an event system!
The type of events being subset of all possible events in system does not make it not events system. Nor it being essentially a queue
[-]- ciconia 5 hours agoIt's not an event system in the sense that it's not just a way to get notified when a file descriptor is ready for reading or writing. Like the OP says, it is a way to run syscalls asynchronously.[-]
- jcelerier 4 hours ago> It's not an event system in the sense that it's not just a way to get notified when a file descriptor is ready for reading or writing.
first time in my life I hear people calling this an event system. For me it's always been any architecture centered around asynchronous message queues.
[-]- hxtk 4 hours agoEvent-Driven Architecture refers to a different thing, but people used to refer to async code as event-based back before async/await existed, when doing async meant writing the Event Loop yourself.
- Sharlin 3 hours agoYes, but "fd readiness checker" is a super narrow nonstandard definition of "event system". Though I get what the author tries to say.
- lordnacho 5 hours agoI thought the main selling point was that you could tell the system "when you finally get this response, run this function on it"[-]
- ciconia 4 hours agoThere are no callbacks in io_uring. You submit an operation (SQE), the kernel runs your request while you're doing other stuff, eventually you get back a completion entry (CQE) with the results of the operation.[-]
- Muromec 4 hours agoSounds like a callback to me[-]
- pyrolistical 1 hour agoThere is no callback. The response just shows up on the other ring buffer.
The client decides when to look at the ring buffer
- vlovich123 4 hours agoSaying it’s a callback is equivalent to claiming select is a callback. Receiving an event does not a callback make - providing the function address to invoke would make it a callback.
- Veserv 3 hours agoCallback execution is: wait until begin event occurs, then do this operation.
Asynchronous execution is: do this operation, then wait until finish event occurs.
They are opposites.
- lstodd 4 hours agoThe kernel can't "run a function". It can only wake a thread sleeping on a syscall. This is called blocking IO.
The whole point of async is to find a compromise between context switch cost and event buffering and the latency resulting from the latter. It is not about "running a function".
[-]- touisteur 4 hours agoThere is limited chaining capability in io_uring that can be an actual gamechanger if your chain of ops can be fully in-kernel.
An intern of mine wrote a whole tcp-checkpoint-(pause-ingress-and-egress-and-the-socket-save-all-state-unpause-everything)-and-send-full-state-on-other-socket (which was a dozen or so ops - netlink writes, ioctls, set/getsockopt, read/write calls...) in a chain - all in one command-queue-write IIRC.
Performance was as good as an ad-hoc kernel module, without any ebpf. We just had one kernel patch to handle some unhandled syscall (getsockopt ? Setsockopt ? Ioctl?) (that we sadly didn't upstream... 2 years ago) and we were done. Really a great system for batching syscalls.
It made me wish for a form of DAG for error-handling or for parallel operations in chains...
- lukeh 4 hours agoio_uring can also use an eventfd to signal you need to check the completion queue. We use this with libdispatch to run a clang block on completion (the block is stored in the user_data). Admittedly this is a very specific use case.
- themafia 4 hours ago> The kernel can't "run a function".
What is a signal handler?
- catchcatchcatch 5 hours ago[dead]