On 30 October 2012 19:18, richard kappler <richkapp...@gmail.com> wrote: > As I sit through the aftermath of Sandy, I have resumed my personal quest to > learn python. One of the things I am struggling with is running multiple > processes. I read the docs on threading and am completely lost so am turning > to the most excellent tutors here (and thanks for all the help, past, > present and future btw!). > > In what ways can one run multiple concurrent processes and which would be > considered the "best" way or is that case dependent? > > Example: > > I'm working on programming a robot in Python. The bot has an Arduino board > that receives sensor input and sends the data to a laptop which is the > "brain" of the bot via pySerial and uses this incoming sensor data to help > determine state. State is used in decision making. The laptop runs a program > that we'll call the Master Control Program in a nod to Tron. The bot also > has a chat program, computer vision, some AI it uses to mine the web for > information, several other functions. Each of these concurrent programs > (thus far all python programs) must run continuously and feed data to the > MCP which receives the data, makes decisions and sends out appropriate > action commands such as for movement, change of state, conversation > direction, what to research, etc. > > So, to return to the original question, how does one run multiple concurrent > processes within python?
The obvious way would be to use the multiprocessing module: http://docs.python.org/2/library/multiprocessing.html Oscar _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor