Modeling Data Concurrency w/ Asynchronous I/O in Zig - RedisConf 2020
Channel:Redis · Length:49:19 · Published:2020-06-18 · Views:10936
Summary
Zig creator Andrew Kelley's RedisConf 2020 talk on modeling data flow with asynchronous I/O in Zig. It explains how Zig's async/await avoids function coloring, and Loris Cro demonstrates OkRedis, a zero-allocation Redis client.
Why HN recommends it
HN recommends it as the clearest explanation of how Zig achieves colorless async/await.
I highly recommend watching Andrew Kelley's video — HN, 2021
Programming language design · C, C++, Rust, Go & systems languages
Subtitles (excerpt)
hello there i am andrew kelly the creator of the zig programming language and i am here to talk to you today about how zig lets you express the inherent concurrency of the problems that you're trying to solve with code using async await uh let's jump right into it so what's async await it's uh besides buzzwords i'll tell you exactly what it is it's language level syntax that lets you start multiple operations at the same time and then selectively wait until some number of them are completed before continuing on with the data so if i were to sort of show it visually you can think of your software as a pipeline and you can think of each of these little shapes as little operations that you need to do in order to process data and then you're going to end up with your final result here represented by this scroll so in terms of redis for example any one of these little shapes could be a redis query uh or maybe it's you know a different database query or maybe it's a external api fetch or maybe its recon configuration file or maybe it's using a third-party api point is this is basically what every uh what all software is doing some form of this you know the arrows are just the little processing in between and then you end up with your result so this is the way i like
On Hacker News
I really can't agree with this premise after seeing how Zig implements color-less async/await: [LINK] I highly recommend watching Andrew Kelley's video (linked in that article) on this topic: [VIDEO] — kbd, 2021-04
I recently wrote an IO abstraction over io_uring using Zig's async/await. Here's how you would do a write()/fsync()/read() with this ( [LINK] ): const offset: u64 = 0; const bytes_written = try io.write(fd, buffer_write[0..], offset); try io.fsync(fd); const bytes_read = try io.read(fd, buffer_read[0..], offset); Other sync functions can use this asynchronous IO completion code in a synchronous s… — jorangreef, 2021-02
There is an interesting approach in Zig to explicitly kick call frames to achieve colorless asyncness. [VIDEO] — bvrmn, 2020-05
> Code that's meant to be pinned (and may behave incorrectly if not pinned) looks no different from any other code. Same goes for async/await. The decision to keep you running on the same native thread is up to the scheduler. > Java isn't positioned as a high-level, high-abstraction language and that's not, IME, the user community it has. I beg to differ. It aims to be a good compromise between p… — pron, 2020-05
Related videos
- ZFS: The Last Word in File Systems Part 1 · Deirdré Straughan · 1:01:26
- Writing a Wayland Compositor in Zig - Isaac Freund · Zig SHOWTIME · 42:19
- TigerStyle! (Or How To Design Safer Systems in Less Time) by Joran Dirk Greef · TigerBeetle · 1:01:59
- Finding the Missing Memristor - R. Stanley Williams · The Qualcomm Institute · 47:52
- A Better Default Colormap for Matplotlib | SciPy 2015 | Nathaniel Smith and Stéfan van der Walt · Enthought · 19:08
- How Python was Shaped by leaky Internals, Armin Ronacher, Flask framework · Видео с мероприятий {speach! · 49:55
- CppCon 2015: Andrei Alexandrescu “std::allocator...” · CppCon · 1:12:27
- Lexical Scanning in Go - Rob Pike · GoogleFOSSSydney · 51:17
- Why Isn't Functional Programming the Norm? – Richard Feldman · Metosin · 46:09
- Maybe Not - Rich Hickey · ClojureTV · 1:03:28
- Conway's Game Of Life in APL · Dyalog · 7:47
- Lecture 1A | MIT 6.001 Structure and Interpretation, 1986 · MIT OpenCourseWare · 1:12:55
- Crockford on JavaScript - Volume 1: The Early Years · YUI Library · 1:42:08
- Growing a Language, by Guy Steele · Bill Pugh · 53:31
- CppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step” · CppCon · 59:33
- Effective Programs - 10 Years of Clojure - Rich Hickey · ClojureTV · 1:14:51