The simple study is:
Ant life simulation
I'm creating an OO structure that see a Class for the Anthill, a Class for the Ant and a Class for the whole simulator.
Now I'm brainstorming on "how to" make Ants 'live'...
I know that there are projects like this just started but I'm brainstorming, I'm not looking for a just-ready-to-eat-dish.
Sincerely I have to make some tests for understand on "what is better", AFAIK Threads, in Python, use less memory than Processes.
What "Ants" have to do when you start the simulation is just: moving around with random direction, if they found food ->eat/bring to the anthill, if they found another ant from another anthill that is transporting food -> attack -> collect food -> do what have to do.... and so on...that means that I have to "share" information across ants and across the whole enviroment.
so I rewrite:
It's better to create a Process/Thread for each Ant or something else?
EDIT:
In cause of my question "what is better", I'd upvoted all the smart answers that I received, and I also put a comment on them.
After my tests, I'll accept the best answer.
I agree with @delan - it seems like overkill to allocate a whole thread per Ant, especially if you are looking to scale this to a whole anthill with thousands of the critters running around.
Instead you might consider using a thread to update many ants in a single "cycle". Depending on how you write it - you need to carefully consider what data needs to be shared - you might even be able to use a pool of these threads to scale up your simulation.
Also keep in mind that in CPython the GIL prevents multiple native threads from executing code at the same time.
Ant simulation: it's better to create a Process/Thread for each Ant or something else?