# Iofthetiger

**URL:** <https://ziggit.dev/t/iofthetiger/3065>\
**Category:** Showcase\
**Created:** [January 30, 2024, 8:45pm UTC](https://ziggit.dev/t/iofthetiger/3065 "2024-01-30T20:45:26Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![FObersteiner](https://ziggit.dev/user_avatar/ziggit.dev/fobersteiner/32/1177_2.png) [@FObersteiner](https://ziggit.dev/u/FObersteiner)\
**Post date:** [January 31, 2024, 1:31pm UTC](https://ziggit.dev/t/iofthetiger/3065/21 "2024-01-31T13:31:09Z")

</div>

> [@dude\_the\_builder](#):
>
> The Go (and I belive Erlang / Elixir) model

to be fair, they all use a runtime (IIRC)

---

<div class="post-metadata">

**Author:** ![dee0xeed](https://ziggit.dev/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@dee0xeed](https://ziggit.dev/u/dee0xeed)\
**Post date:** [January 31, 2024, 1:38pm UTC](https://ziggit.dev/t/iofthetiger/3065/22 "2024-01-31T13:38:19Z")

</div>

> [@dude\_the\_builder](#):
>
> As I see it, Zig’s first attempt at async IO was via the async / await model, albeit implemented in a a novel way using the function’s frame directly with suspend and resume points. It seems although it was a cool and novel idea

Hmm… novel? Coroutines (subroutines with multiple entry points) were invented in 1958…

> [@dude\_the\_builder](#):
>
> it clashes in critical ways with other aspects of the compiler which have higher priority in terms of achieving Zig’s goals

As I see it… If a compiler when generating code for `async/await` based (async) I/O has to use specific system calls (which are different across OSes)… well, this is **awful**. This is ok for languages like python/tcl, but not for a language like C/Zig. Just let people use OS directly and they will someday come up with such an abstraction, but do not put this abstraction into compiler proper.

---

<div class="post-metadata">

**Author:** ![dude\_the\_builder](https://ziggit.dev/user_avatar/ziggit.dev/dude_the_builder/32/557_2.png) [@dude\_the\_builder](https://ziggit.dev/u/dude_the_builder)\
**Post date:** [January 31, 2024, 1:40pm UTC](https://ziggit.dev/t/iofthetiger/3065/23 "2024-01-31T13:40:27Z")

</div>

True, but when you think about it, all these async / await implementations need an event loop to drive them and many times a worker thread pool to improve performance even more. So in the end, they end up having a runtime too. Take Rust for example; the language itself doesn’t have a runtime but does provide the async / await semantics (as syntax sugar over Futures). So you must add a runtime like Tokio or async-std to make it work.

---

<div class="post-metadata">

**Author:** ![Sze](https://ziggit.dev/user_avatar/ziggit.dev/sze/32/496_2.png) [@Sze](https://ziggit.dev/u/Sze)\
**Post date:** [January 31, 2024, 1:42pm UTC](https://ziggit.dev/t/iofthetiger/3065/24 "2024-01-31T13:42:50Z")

</div>

> [@dude\_the\_builder](#):
>
> As I see it, Zig’s first attempt at async IO was via the async / await model, albeit implemented in a a novel way using the function’s frame directly with suspend and resume points. It seems although it was a cool and novel idea, it clashes in critical ways with other aspects of the compiler which have higher priority in terms of achieving Zig’s goals. So it was sacrificed and removed.

I think we should add “for now” here:

> [@\[#36\] Zig Roadmap 2024 - Andrew Kelley](https://ziggit.dev/t/36-zig-roadmap-2024-andrew-kelley/3024/17):
>
> Question: Can we have a couple of words about async? timestamp: [https://youtu.be/5eL\_LcxwwHg?t=1842](https://youtu.be/5eL_LcxwwHg?t=1842)Paraphrased: Andrew explains that it currently isn’t practical, because there are a lot of difficult problems, that are in the way of a good implementation of async, these other things need to be addressed first. Summary And I tried to transcribe the summary in the video: timestamp of [async/await summary](https://www.youtube.com/watch?v=5eL_LcxwwHg&t=2037s) Ultimately, I think it can be recovered, I think we can have async/await. But it is just…

---

<div class="post-metadata">

**Author:** ![gonzo](https://ziggit.dev/user_avatar/ziggit.dev/gonzo/32/54_2.png) [@gonzo](https://ziggit.dev/u/gonzo)\
**Post date:** [January 31, 2024, 2:34pm UTC](https://ziggit.dev/t/iofthetiger/3065/25 "2024-01-31T14:34:08Z")

</div>

Thanks for the detailed explanation. I know this song, it was also very popular where I come from (they call it “the Rocky song” over there). But `iofthetiger` blocks my brain into interpreting the first two characters as `I/O` (as you mentioned), and I am left with `fthetiger`, which I can only read as… `<expletive> the tiger`. LOL.

---

<div class="post-metadata">

**Author:** ![slonik-az](https://ziggit.dev/letter_avatar_proxy/v4/letter/s/ebca7d/32.png) [@slonik-az](https://ziggit.dev/u/slonik-az)\
**Post date:** [January 31, 2024, 2:38pm UTC](https://ziggit.dev/t/iofthetiger/3065/26 "2024-01-31T14:38:35Z")

</div>

> [@gonzo](#):
>
> and I am left with `fthetiger`, which I can only read as… `<expletive> the tiger`. LOL.

This double interpretation only makes the pun spicier and jucier 🙂

---

<div class="post-metadata">

**Author:** ![gonzo](https://ziggit.dev/user_avatar/ziggit.dev/gonzo/32/54_2.png) [@gonzo](https://ziggit.dev/u/gonzo)\
**Post date:** [January 31, 2024, 2:40pm UTC](https://ziggit.dev/t/iofthetiger/3065/27 "2024-01-31T14:40:05Z")

</div>

Was Linus foreshadowing `io_uring` in those thoughts, back in 2016?

---

<div class="post-metadata">

**Author:** ![dude\_the\_builder](https://ziggit.dev/user_avatar/ziggit.dev/dude_the_builder/32/557_2.png) [@dude\_the\_builder](https://ziggit.dev/u/dude_the_builder)\
**Post date:** [January 31, 2024, 2:41pm UTC](https://ziggit.dev/t/iofthetiger/3065/28 "2024-01-31T14:41:13Z")

</div>

> [@gonzo](#):
>
> fthetiger

ROTFL! Definitely a whole new meaning to the name. 😹 And hey, I call it the Rocky song too.

---

<div class="post-metadata">

**Author:** ![dude\_the\_builder](https://ziggit.dev/user_avatar/ziggit.dev/dude_the_builder/32/557_2.png) [@dude\_the\_builder](https://ziggit.dev/u/dude_the_builder)\
**Post date:** [January 31, 2024, 2:46pm UTC](https://ziggit.dev/t/iofthetiger/3065/29 "2024-01-31T14:46:18Z")

</div>

> [@gonzo](#):
>
> blocks my brain

This must be a bug. It’s supposed to be non-blocking. 😝

---

<div class="post-metadata">

**Author:** ![dee0xeed](https://ziggit.dev/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@dee0xeed](https://ziggit.dev/u/dee0xeed)\
**Post date:** [January 31, 2024, 3:23pm UTC](https://ziggit.dev/t/iofthetiger/3065/30 "2024-01-31T15:23:02Z")

</div>

> [@gonzo](#):
>
> Was Linus foreshadowing `io_uring` in those thoughts, back in 2016?

I guess he was, look at this phrase.

> If you want to do arbitrary asynchronous system calls…

There was/is `libaio`, which Linus did not like (charitably speaking).  
Also there was a citation in `man 2 open`… it seems it has been removed from this manual page, but in older Linux distros (deb8 for instance) it’s still there (it’s about `O_DIRECT` flag).

As far as I could understand in that message Linus is saying that there must be  
a single general mechanism for doing things asynchronously, but not scrappy “solutions” for every special case (`libaio` works only with file i/o).

---

<div class="post-metadata">

**Author:** ![dee0xeed](https://ziggit.dev/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@dee0xeed](https://ziggit.dev/u/dee0xeed)\
**Post date:** [February 2, 2024, 10:11pm UTC](https://ziggit.dev/t/iofthetiger/3065/31 "2024-02-02T22:11:42Z")

</div>

> [@AndrewCodeDev](#):
>
> There was a famous song called “eye of the tiger” by the band Survivor

The song is dull, no drive at all in it.  
How about [rock’n’roll dev](https://www.youtube.com/watch?v=tUuAjgNGx48) ? 🫠

ReadOnly DevOps, why ain’t should be? 🙂

---

<div class="post-metadata">

**Author:** ![dude\_the\_builder](https://ziggit.dev/user_avatar/ziggit.dev/dude_the_builder/32/557_2.png) [@dude\_the\_builder](https://ziggit.dev/u/dude_the_builder)\
**Post date:** [February 2, 2024, 11:06pm UTC](https://ziggit.dev/t/iofthetiger/3065/32 "2024-02-02T23:06:42Z")

</div>

Hey man, Survivor was good, but you’re bringing in the heavy guns with AC/DC! 😸

P.S.: Now we’re going off-topic but hey, it’s AC/DC, so it’s allowed. lol

---

<div class="post-metadata">

**Author:** ![dee0xeed](https://ziggit.dev/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@dee0xeed](https://ziggit.dev/u/dee0xeed)\
**Post date:** [February 3, 2024, 12:17am UTC](https://ziggit.dev/t/iofthetiger/3065/33 "2024-02-03T00:17:56Z")

</div>

> [@dude\_the\_builder](#):
>
> Now we’re going off-topic

We are not:

[![](https://ziggit.dev/uploads/default/original/2X/9/95f23cf4e7c973334ac8ff36aaa2626cb5a93dd0.jpeg "Ain't No Fun (Waiting Round to Be a Millionaire)") ](https://www.youtube.com/watch?v=BSIFNuFa-RE)

---

<div class="post-metadata">

**Author:** ![mperillo](https://ziggit.dev/user_avatar/ziggit.dev/mperillo/32/1280_2.png) [@mperillo](https://ziggit.dev/u/mperillo)\
**Post date:** [February 3, 2024, 7:12am UTC](https://ziggit.dev/t/iofthetiger/3065/34 "2024-02-03T07:12:06Z")

</div>

> [@dude\_the\_builder](#):
>
> …  
> Take Rust for example; the language itself doesn’t have a runtime but does provide the async / await semantics (as syntax sugar over Futures). So you must add a runtime like Tokio or async-std to make it work.

Starting from go1.14, goroutines are asynchronously preemptible in order to avoid, as example, loops without function to deadlock the scheduler.

Does languages supporting async/await like Rust support this feature?

---

<div class="post-metadata">

**Author:** ![Anthon](https://ziggit.dev/user_avatar/ziggit.dev/anthon/32/8967_2.png) [@Anthon](https://ziggit.dev/u/Anthon)\
**Post date:** [February 3, 2024, 9:14am UTC](https://ziggit.dev/t/iofthetiger/3065/35 "2024-02-03T09:14:54Z")

</div>

Thanks for pointing this out. I had only read the name in the overview of the posts and thought it was some strange german name starting with an ‘L’ ( lofthetiger ) that I hadn’t seen before.

---

<div class="post-metadata">

**Author:** ![dude\_the\_builder](https://ziggit.dev/user_avatar/ziggit.dev/dude_the_builder/32/557_2.png) [@dude\_the\_builder](https://ziggit.dev/u/dude_the_builder)\
**Post date:** [February 3, 2024, 11:38am UTC](https://ziggit.dev/t/iofthetiger/3065/36 "2024-02-03T11:38:06Z")

</div>

That would depend on the async runtime you choose. I’m not sure if Tokio or async-std have this feature, but they could implement it at the runtime level without needing a change in the language.

---

<div class="post-metadata">

**Author:** ![dude\_the\_builder](https://ziggit.dev/user_avatar/ziggit.dev/dude_the_builder/32/557_2.png) [@dude\_the\_builder](https://ziggit.dev/u/dude_the_builder)\
**Post date:** [February 3, 2024, 11:40am UTC](https://ziggit.dev/t/iofthetiger/3065/37 "2024-02-03T11:40:00Z")

</div>

Yeah, Discourse automatically capitalizes topic titles so it turned iofthetiger into Iofthetiger. 😕

---

<div class="post-metadata">

**Author:** ![dee0xeed](https://ziggit.dev/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@dee0xeed](https://ziggit.dev/u/dee0xeed)\
**Post date:** [March 22, 2024, 8:48pm UTC](https://ziggit.dev/t/iofthetiger/3065/38 "2024-03-22T20:48:07Z")

</div>

> [@dude\_the\_builder](#):
>
> Yes, they implemented a uniform callback-based async IO abstraction layer over each operating system’s specific async IO interface

Sorry for bumping/off-topic/etc. I am just wondering how do timers and signals fit into `io_uring` mechanism/abstraction?

Both timers and signals are not I/O per se, no data transfer between peripherals of a “computer” and CPU, no data transfer between nodes in a network, it’s just some interaction  
between user/kernel space inside a single “device”/“gadget”.

In Linux, after you got readiness notification concerning timers/signals you must read some data from underlying fds, otherwise you will be over-flooded with these notifications.

In FreeBSD, timers are different beasts, someone may like it, someone do not, I personally don’t - “everything in Unix is a file”, after all 🙂

So, both with FreeBSD `kqueue` and with LInux `epoll`, both timers and signals more or less fit into “reactor pattern”. How do they fit into (really cool) `io_uring` facility?

---

<div class="post-metadata">

**Author:** ![dude\_the\_builder](https://ziggit.dev/user_avatar/ziggit.dev/dude_the_builder/32/557_2.png) [@dude\_the\_builder](https://ziggit.dev/u/dude_the_builder)\
**Post date:** [March 22, 2024, 10:22pm UTC](https://ziggit.dev/t/iofthetiger/3065/39 "2024-03-22T22:22:51Z")

</div>

io\_uring is really totally centered around IO, be it network sockets or files. It does have facilities for settings timeouts and the submission / completion queue entries could be used as a signaling mechanism. But the main focus is just IO. I don’t know much about epoll but I believe it’s a much more generalized async system that can handle other things besides just IO, no?

---

<div class="post-metadata">

**Author:** ![dee0xeed](https://ziggit.dev/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@dee0xeed](https://ziggit.dev/u/dee0xeed)\
**Post date:** [March 23, 2024, 10:30am UTC](https://ziggit.dev/t/iofthetiger/3065/40 "2024-03-23T10:30:37Z")

</div>

> [@dude\_the\_builder](#):
>
> I don’t know much about epoll but I believe it’s a much more generalized async system that can handle other things besides just IO, no?

`epoll` is not “async” (that’s why `io_uring` appeared), it’s main purpose is to deliver _readiness_ (operation won’t “block”, a process won’t go into sleep state) notifications, not _operation complete_ notifications.

`epoll` can easily be used for timers, created with `timerfd_create` and with signals, created with `signalfd`, epoll\_`wait()` returns when a timer expired or signal arrived. File system events fits too.

`epoll` is not suited for **file** I/O, it would just flood an application with read/write readiness notifications, `io_uring` is.

But what if want to use all the stuff (network I/O, file I/O, timers, signals, FS events) at once, how would I deal with them using `io_uring`?

Of course, it is not a question to zig lang developers, it’s more a question to os kernels developers.

[Previous page](https://ziggit.dev/t/iofthetiger/3065.md?page=1)

[Next page](https://ziggit.dev/t/iofthetiger/3065.md?page=3)
