The two basic commands are
Queue[expr] to line up an expression for evaluation on any available processor, and
Wait[pid] to wait until a given process has finished.
Each process in the queue is identified by its unique process ID, its pid.
WaitOne is nondeterministic. It returns an arbitrary process that has finished. If no process has finished, it calls
QueueRun until a result is available. The third element of the resulting list is suitable as an argument of another call to
WaitOne.
The functions
Queue and
Wait implement
concurrency. You can start arbitrarily many processes, and they will all be evaluated eventually on any available remote processors. When you need a particular result, you can wait for any particular pid, or you can wait for all results using repeated calls to
WaitOne.
QueueRun[] returns
True if at least one job was submitted to a remote kernel or one result received from a kernel,
False otherwise. Normally, you should not have to run
QueueRun yourself. It is called at appropriate places inside
Wait and other functions. You need it only if you implement your own
main loop for a concurrent program.