3 ms·
> I'd like to rebuild unix front the ground up. Pls implement proper async syscalls this time. Thx.
by layoutIfNeeded 7y ago
> I'd like to rebuild unix front the ground up.
Pls implement proper async syscalls this time. Thx.
- colechristensen 7y agowhat do you mean by "proper"?
- deathanatos 7y agoMany — most? — of the system calls in nixes, even Linux, that deal w/ I/O are blocking calls. Sure, you can chuck them into a background thread, but even that isn't quite what you want, since you can't interrupt the background thread while the blocking call is blocking. Sure, we've got async networking, timers, events nowadays. But disk I/O is almost completely async unaware (and even if you can work around the main problem of I/O to a file, there's a ton of auxiliary calls like link, unlink, rename, mkdir, chmod/chown, etc. that are blocking and, AFAIK, have no async equivalents). I'm not sure if you can wait on a process (I think kqueue might support this, but IDK about Linux). And more fundamentally, I don't think you want synchronous I/O calls that only allow you to do one thing per thread at a time. You want to schedule as much I/O as you have available with the OS as it becomes available, s.t. the OS has a more complete picture of what I/O is actually outstanding, to better schedule it.
- FullyFunctional 7y agoTake that one step further and do what NFSv4 does: do more per command (system call); instead of sending a single command (with a single response coming back), send a sequence of command and the responses from all of them (terminating early if any of them fails).
- pjc50 7y agoI got halfway through a back-of-the-envelope spec for how this might work. Change "everything is a file" to "everything is shared pages", but impose the additional sanity restriction that each accessor of a shared page should choose to mostly write or mostly read using lockfree structures. Then instead of the operating system allocating a "standard in" for you, every process would be handed two event ring buffers, one for incoming and one for outgoing events. On waking, all the process has to do is scan the ring buffer. Potentially easy to make suitable for microkernels too, by passing the buffers directly from process to disk subsystem.