[HN Gopher] Beej's Guide to Unix IPC ___________________________________________________________________ Beej's Guide to Unix IPC Author : qntty Score : 59 points Date : 2022-01-06 20:22 UTC (2 hours ago) (HTM) web link (beej.us) (TXT) w3m dump (beej.us) | DataDaoDe wrote: | Beej's guides are amazing with a memorable and entertaining | writing style. I remember reading his network guide almost two | decades ago when I was a kid, had just heard of this thing called | a socket, but the only connotation I had for one at the time was | a wall socket. His guide helped me understand networking but more | importantly it made it a fun experience for a programmer just | starting out. | systemvoltage wrote: | I have to point this one out from his guide to C: | https://beej.us/guide/bgc/html/split/hello-world.html | | > Before we go on, why would I even begin to bother pointing | out that a pound sign is called an octothorpe? The answer is | simple: I think the word octothorpe is so excellently funny, I | have to gratuitously spread its name around whenever I get the | opportunity. Octothorpe. Octothorpe, octothorpe, octothorpe. | | I can't find it right now but somewhere in the guide in a | different chapter, he randomly inserts "Octothorpe"... good | comedy. I think this kind of writing is exceedingly rare and | immesely enjoyable. | synergy20 wrote: | The IPC is in SystemV flavor but I think these days we normally | should adopt Posix IPC instead especially for Linux/BSD, am I | missing something? "On Linux and FreeBSD there | is big advantage of posix queues, as handler given by mq_open are | basically file descriptor which can be | polled/epolled/selected/kqueued" "all POSIX IPC is | thread-safe, while most SysV IPC is NOT" | beej71 wrote: | It hasn't been appreciably touched in decades. It could | definitely use an update. And I need to port it to the new | pandoc toolchain. | synergy20 wrote: | Sounds great. It's hard to find nice tutorials for posix-ipc | on the internet. | pure_simplicity wrote: | If you use pandoc, have you considered epub as a target | format? I am getting good results going from latex to epub | using pandoc. Not sure what your sources and toolchain are | like, though. | | Thanks for the great guides. :) | colbyhub wrote: | I freaking love his guides, I'm currently reading through his C | guide: https://beej.us/guide/bgc/ | | It's very entertaining to read though which holds my attention | well, and is well suited to people with existing programming | experience. I've tried to read K&R but I keep coming back to | Beej's. | nathias wrote: | Beej really has the best guides. | Const-me wrote: | fork() is rarely ideal, unless followed by exec() to launch | another processes. That copy-on-write thing often wastes too much | physical memory. I think threads are usually better, the shared | memory allows to marshal large volumes of data without making | copies. | | I like poll() much better than signals. Signals are too limiting, | and too arcane. It's much easier to use poll() and dispatch | things manually based on the signaled handles, at least there's a | guarantee your code won't be interrupted by another event. | | Pretty much all modern kernel things are compatible with poll. | There's eventfd() which acts as an event or semaphore, message | queues (but not the ones from the article, better ones, created | with mq_open not msgget), Unix domain sockets for cross-process | messaging. There's more, poll() can track termination of | processes (see pidfd_open), page flip events in a GPU with DRM, | consumed or available video/audio samples with V4L2 or ALSA. ___________________________________________________________________ (page generated 2022-01-06 23:00 UTC)