Live data from Hacker News

A Posix Queue Implementation

zinascii.com

11–14 of 14 posts

Re: A Posix Queue Implementation

#11

Does anything use posix queues? Lack of support has never been an issue for openbsd afaik. Looks like somebody snuck it into FreeBSD, which I wasn't aware of until I just looked it up. Seems like a forgotten feature.

I thought about them a few times wanted to use them. But every time I thought "Hmm, wonder if anyone else is using them... I better stay away if I hit some bug or untested corner case".

Re: A Posix Queue Implementation

#12
post #4

Compare QNX message passing, which has a much simpler API and runs faster. The UNIX/Linux world has never gotten message passing right. It's inevitably built on top of files, sockets, or shared memory, which adds complexity and reduces speed.

Using files and sockets as common abstractions for a variety of underlying mechanisms is one of the most powerful things about UNIX/Linux. Yes, there are tradeoffs, but in return, it means you can interoperate with a tremendous number of utilities and tools (which don't even need to know anything about the underlying mechanism) in unplanned and unexpected ways... for free.

As long as you happen to understand what goes thru the pipe, which isn't always the case.

Re: A Posix Queue Implementation

#13
post #11

Does anything use posix queues? Lack of support has never been an issue for openbsd afaik. Looks like somebody snuck it into FreeBSD, which I wasn't aware of until I just looked it up. Seems like a forgotten feature.

I thought about them a few times wanted to use them. But every time I thought "Hmm, wonder if anyone else is using them... I better stay away if I hit some bug or untested corner case".

I used POSIX message queues in production once. They worked fine, as a replacement for TCP when on the same machine, with reduced latency (roughly 75%). But eventually I switched to Unix Domain Sockets which offered similar good performance with a more familiar operating model (e.g. no worries about cleaning up old queues, and it's just another type of socket). This was on Linux 2.6.32-ish, and the POSIX MQ implementation had no bugs that I noticed over some millions of messages. Which is more than I can say of the UDP implementation.

Re: A Posix Queue Implementation

#14
Is this secure? That is, can you receive messages from an untrusted process without worrying that it will somehow crash or corrupt your process?

There are two processes mmap'ing the same memory, and operating on it with a mutex. It seems like the one side has to perform elaborate checks to make sure the other side is obeying the protocol. Or am I mistaken?

Post reply on HN