Mathematica 9 is now available
Previous section-----Next section

QueueRun

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.
Queue[cmd]submits cmd for evaluation on a remote kernel and returns the queued job's pid
Queue[{vars...}, cmd]    builds a closure for the local values of the given variables before sending cmd to a remote kernel
QueueRun[]checks all remote kernels for available results and submits waiting jobs to available remote kernels
DoneQ[pid]returns True if the given process has finished
Wait[pid]waits for the given process to finish and returns its result
Wait[{pid1, pid2, ...}]waits for all given processes and returns the list of results
Wait[expr]waits for all process IDs contained in expr to finish and replaces them by the respective process' result
WaitOne[{pid1, pid2, ...}]waits for one of the given processes to finish. It returns {res, id, ids}, where id is the pid of the finished process, res is its result, and ids is the list of remaining pids

Queuing processes.

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.
Queue[expr, Scheduling->p]queue expr with priority p

Specifying priorities.



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.