ChrisSD 8 days ago

I think the two basic synchronisation primitives are atomics and thread parking. Atomics allow you to share data between two or more concurrently running threads whereas parking allows you to control which threads are running concurrently. Whatever low-level primitives the OS provides (such as futexes) is more an implementation detail.

I would tentatively make the claim that channels (in the abstract) are at heart an interface rather than a type of synchronisation per se. They can be implemented using Mutexes, pure atomics (if each message is a single integer) or any number of different ways.

Of course, any specific implementation of a channel will have trade-offs. Some more so than others.

2
im3w1l 8 days ago

To me message passing is like it's own thing. It's the most natural way of thinking about information flow in a system consisting of physically separated parts.

LtWorf 8 days ago

What you think is not very relevant if it doesn't match how CPUs work.

ChrisSD 8 days ago

huh?

hedora 8 days ago

I think they mean that message channels are an expensive and performance unstable abstraction.

You could address the concern by choosing a CPU architecture that included infinite capacity FIFOS that connected its cores into arbitrary runtime directed graphs.

Of course, that architecture doesn’t exist. If it did, dispatching an instruction would have infinite tail latency and unbounded power consumption.