do I get this right? If I have an OS with IPC (inter process communication) and threading, I can simply use it as an actor model. So, I send and receive messages with IPC and start new actors as a thread (actually process, because I don't share the memory). Or do I miss some feature which is required by the actor model in order fit into the requirements?
- Actors need an address: PID
- Send messages to other actors: IPC
- Create new actors: Processes
This is indeed possible: as you say all the building blocks are there.
Still, it doesn't seem to be a very good fit: when programming in the actor model, it is common create many actors, so actors should be 'cheap'. Unfortunately on most operating systems, processes are not cheap:
- To start with, on a typical system the number of PID's is limited. Now you can increase
pid_max
to get around this up to a point, but this is already a sign that you're prehaps mis-using this tool
- A process will likely have some state, so it'll need some pages of memory to store that state in. Even with smart copy-on-write tricks between processes, having many actors within a process will likely be more efficient compared to having one process per actor (unless you start sharing memory across processes, but you mentioned you don't want to do this, and indeed it seems difficult to keep safe)
- Having so many processes means the kernel scheduler has to schedule them all. I would be concerned if it would not get overwhelmed by that: this would be a rather unusual workload, that typical schedulers are likely not optimized for. Traditional actor systems don't use one thread per actor, but instead keep track of message queues 'internally' and use a limited number of threads to service all actors. As long as actors don't block the threads and you have your number of threads close to your number of CPU's, this can be very efficient.
- Failure handling (what if a process crashes?) seems tricky to handle across processes
So in summary, it's possible, but I'm not sure it would be a good idea. Would be interesting to see how it plays out when attempted, though!