logoalt Hacker News

vbezhenar • yesterday at 11:55 AM • 3 replies • view on HN

UNIX had no threads originally. Processes are similar to actor model. You create pipe and you exchange bytes between processes.

Of course there are more ways to exchange data between processes, like explicitly allocating shared memory. But "idiomatic" way seems to me pretty much similar to actors.


Replies

cowlevel • yesterday at 7:47 PM

Still doesn't. The Linux kernel makes no distinction between threads and processes. What we commonly call "processes" are in fact "thread groups" and play a minor role, mostly related to signal handling and the ability to exit them all at once with a syscall.

The clone syscall allows you to fork a thread with varying levels of sharing. Usually a thread library will share almost everything and a process fork will share almost nothing, but those aren't the only choices. Yu can choose, say, to duplicate the memory map but share the file descriptor table.

monocasa • yesterday at 12:00 PM

Yep, and poll(2) (or later select(2)) to coalesce all possible events into one logical event queue.

signa11 • yesterday at 12:03 PM

this is talking about the kernel not the userland.

➕ show 1 reply