5 ms·
> Io in zig is for “things that can block execution”. Things that could semantically cause a yield of any kind. Allocation is not one of those things. The allo
by chrisohara 1y ago
> Io in zig is for “things that can block execution”. Things that could semantically cause a yield of any kind. Allocation is not one of those things.
The allocator may yield to the OS when requesting or releasing memory (e.g. sbrk, mmap, munmap)?
- messe 1y agoI don't find that a particularly compelling argument in this case, because so can accessing any memory address if it's not currently swapped in.
- deleted 1y ago[deleted]
- laserbeam 1y agoYielding in this context means to a different “thread” in your context, not the OS. If you want to express “this is a point where the program can do something else” it is a yield. If you block and can’t switch to something else… it is not. So if you’re using an API like mmap like that you should think of it as IO (I don’t think you can, but am not sure).
- throwawaymaths 1y agothe page allocator which is the root of many allocators calls mmap. of course the fixed buffer allocator does not.