Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

«Threads» imply «shared state» within the confines of the same process, hence the need for locking primitives, mutexes, and alike.

«Actors» imply «no shared state» – there is a message inbox and a message outbox, but the state is private to the actor.

Both can be asynchronous.

 help



I think this taxonomy is not good. It’s comparing apples to oranges, or apples to fruit sugars or something.

Threads are not a programming paradigm or style, any more than a CPU is a programming paradigm or style. They’re a tool, an existential piece of the landscape which can be used to perform paradigms/styles. Like CPUs, they do have affinity for certain use cases, but the car is not the road trip.


If threads don’t share state, they are effectively the same as processes. The whole purpose of having threads in addition to processes is to share state. If you don’t share state, you don’t need threads. That’s what the blog post means by “an OS with no threads”.

Yes, they are.

Threads are to a process what a single CPU core is to a multi-core CPU.


There are still tons of advantages to programming with multiple threads or multiple processes even on a single-core CPU, though. Scheduling is a very powerful thing to be able to use.

It’s pre-coffee, and I totally disagree “threads are not a programming paradigm”. But the best way to do that is to say that the car IS the road trip and it’s a fundamentally different thing if you use a train.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: