netcamlbox: checking the mail box without waiting
Hugo Ferreira <[email protected]> Tue, 23 Mar 2010 15:50:08 +0000
| Newsgroups | gmane.comp.lang.ocaml.lib.net.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I am trying to use netcaml3 mailbox to
allow a coordinator process to distribute
tasks among worker processes. To do this
I must check if any process's message box has
space. If so I place a request for task
execution otherwise I go on and do something
else (process worker responses).
To check the mail box free space I tried to use:
let n = Netcamlbox.camlbox_messages wname in
and if (n - message_size) I proceed with the
blocking calls (wait and send). My problem
is that when I call this function from the
coordinator process I get:
Fatal error: exception Unix.Unix_error(20, "shm_open", "/camlbox_9838_0")
Raised by primitive operation at unknown location
Called from file "netcamlbox.ml", line 322, characters 4-21
For testing purposes I used:
let wslots = 2 in (* maximum of two messages queued for each worker *)
let wboxes = Array.init n_workers
( fun k ->
let wname = mname ^ "_" ^ string_of_int k in
let wbox, _, ws = prep_mbox wname wslots msg_size in
let n = Netcamlbox.camlbox_messages wname in
(wname, wbox, ws) ) in
let coord_box = (mname, mbox, mfd, ms) in
let worker_boxs = wboxes in
coord_box, worker_boxs
My question is: how do I go about avoiding the block
on a mailing box?
TIA,
Hugo F.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev