vak: (Default)
[personal profile] vak
Народ, кто-нибудь уже поимел опыт с <linux/io_uring.h>? Как оно по жизни?

Неожиданно для себя обнаружил, что в Линуксе пять лет назад появилась крутая фича. А именно три системных вызова, реализующих эффективный асинхронный интерфейс ко всем сервисам ядра.
  • int io_uring_setup(unsigned entries, struct io_uring_params *p);
  • int io_uring_enter(unsigned fd, unsigned to_submit, unsigned min_complete, unsigned flags, sigset_t *sig);
  • int io_uring_register(unsigned fd, unsigned opcode, void *arg, unsigned nr_args);
Революционная штука, как я погляжу. Может коренным образом изменить подход к разработке приложений. Только сложновато для программиста выходит. Есть статьи про это дело.

Date: 2025-02-20 13:42 (UTC)
From: [personal profile] sassa_nf
That's left as exercise to the reader.

If you used epoll, you'll notice that io_uring is not that different. The user of the API needs to figure out how to share work, how to associate execution context with IO requests and how to manage system-wide progress.

For example, if it is a Async framework, the execution context is a Future or a Promise of the IO result.

Spreading work among threads can be via hashing and periodic rehashing, work stealing, etc, really task-specific. But if you are able to saturate CPU without that, then you can shrug it off as unnecessary.