r/ProgrammingLanguages • u/lxsameer • Aug 03 '26
Blog post Concurrency in Serene's Runtime
I recently finished building the concurrency runtime for my programming language, Serene, and wrote a three-part series explaining how it works.
The series covers:
- Why I chose stackful fibers
- An M work-stealing scheduler
- An IO Reactor
- A tiny HTTP server that brings everything together
I'd love to hear feedback from anyone interested in programming language implementation, runtime systems, or systems programming.
Part 1: Choosing the Building Blocks
35
Upvotes
3
u/sreekotay Aug 09 '26
VERY nice - I did something very similar, but for C - its a preprocessor that autocolors blocking/nonblocking etc but lowers to clean C
any benchmarks you've been looking at?
https://github.com/sreekotay/concurrent-c
2
u/Pzzlrr Sep 23 '26
I'll be watching this project with great curiosity. When will we see any non trivial projects written in it?
1
u/tmzem Aug 03 '26
A very interesting read.
A question: How does the guard page approach work for very high amounts of fibers? Don't OS'es place restrictions on the amount of memory mappings a process can do? Or is there a trick to get around it?
1
u/matthieum Aug 03 '26
You mentioned that fibers are fixed-size... but how large are they?
One of the interesting parts of
mmapis the ability to reserve address-space without actually allocating memory for it. This means that you could reasonably reserve 1MB-2MB worth of address space per fiber, yet have the fiber only use 4KB to start with, and let the OS page in memory lazily.3
u/benjamin-crowell Aug 03 '26
That was very well written and enjoyable to read. Thanks!