3 ms·
It's interesting to look at QNX's implemention of POSIX. In QNX, the POSIX library mostly makes calls for interprocess communication, using MsgSend and MsgRecv
by Animats 10y ago
It's interesting to look at QNX's implemention of POSIX. In QNX, the POSIX library mostly makes calls for interprocess communication, using MsgSend and MsgRecv. That's the real underlying primitive. Not files. MsgSend works like a remote procedure call - you send data and wait for a reply. (There's a timeout mechanism available, and you can time out anything that blocks. Real-time OS, remember.)
QNX lets you make anything look like a file, by writing what QNX calls a "resource manager". This takes over a subtree of the pathname space, and the library turns create, open, close, read, write, and ioctl calls into the appropriate MsgSend calls. That's how you write a file system under QNX as a user process. But there's no reason to turn things into files unnecessarily. Displays are not files, for example.
QNX has what looks like a Berkeley sockets interface, but "send" and "recv" call the same thing as "write" and "read". You can use read and write on a socket. I think you can use "send" and "recv" on a file system, too.
If you're going to have one primitive, MsgSend and MsgRecv are a better choice than files. But it's easy to get that wrong. Mach botched it, and for decades, microkernels had a bad rep.
- jacquesm 10y agoQnX is one of the under-appreciated gems in the OS landscape. I still hope that RIM will entirely open-source it and I'd happily contribute a good sized chunk of money towards a ransom.
- Animats 10y agoIt was open source for a while under Harmon, and free for non commercial use. I wish I'd downloaded it all back then. I'd like to see a QNX-like OS in Rust.
- jacquesm 10y ago> I wish I'd downloaded it all back then. IIRC there were some license issues. > I'd like to see a QNX-like OS in Rust. Hm... now that would be an interesting 'side project'.
- cyphar 10y ago> It was open source for a while under Harmon, and free for non commercial use. So it wasn't free software? It was proprietary?
- mveety 10y agoQNX is a fantastic system and one of the few microkernels that's really been done properly. That being said though the send/recv interface on QNX gives you the same side effects that Plan 9's 9P gives you. You have a simple way for everything to talk to each other. Files are really just a way to visualize communication channels. Like displays are files, but the files are just an object you reference to send messages to the driver. Same with filesystems and everything else.