Add UringSystem for Native by antoniojimeneznieto · Pull Request #4584 · typelevel/cats-effect · GitHub
Skip to content

Add UringSystem for Native#4584

Draft
antoniojimeneznieto wants to merge 26 commits into
typelevel:series/3.xfrom
antoniojimeneznieto:feature/native-io_uring
Draft

Add UringSystem for Native#4584
antoniojimeneznieto wants to merge 26 commits into
typelevel:series/3.xfrom
antoniojimeneznieto:feature/native-io_uring

Conversation

@antoniojimeneznieto

Copy link
Copy Markdown
Member

It has been a while since I wanted to work on this one! I think there will be a lot of things to discuss :)

@djspiewak

Copy link
Copy Markdown
Member

Adapts the Native UringSystem to the multi-poller runtime that Scala
Native 0.5+ enables. Mirrors the structure of the JVM prototype from
GSoC (armanbilge/fs2-io_uring#78)
@antoniojimeneznieto

Copy link
Copy Markdown
Member Author

Some updates! I've adapted the UringSystem to be multithreaded, following the ideas we used in the JVM prototype:

  • Pipe-based wakeup: When we create a Poller we also create a pipe. The read end is registered with IORING_OP_POLL_ADD on the first poll using a default callback (wakeupHandler) that processReadyEvents identifies. interrupt writes one byte to wake the poller. The wakeup CQE drains the pipe and clears the listening flag.

  • Cross-ring cancellation: Submission now yields (addr, originatingPoller). cancel takes the fast path when ctx.accessPoller hands back the same ring, otherwise the cancel is enqueued onto the originating poller's ConcurrentLinkedDeque and that ring is woken. We drain this queue at the top of each poll on the owning thread.

I'd like to implement the msg_ring wakeup mechanism as a follow-up.

@antoniojimeneznieto

Copy link
Copy Markdown
Member Author

Comment thread tests/native/src/test/scala/cats/effect/unsafe/UringSystemSuite.scala Outdated
Comment thread core/native/src/main/scala/cats/effect/unsafe/UringSystem.scala Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants