On Jan 25, 2011, at 9:33 AM, Ken Wesson wrote:

> Well, that's weird, because the documentation *I* read says it
> composits the arguments together into a command line and hands off to
> Runtime/exec. And the documentation of *that* says it returns a
> Process object and the process it launches runs asynchronously.

That doesn't necessarily contradict what I observed. The way I read the docs[1] 
is that sh does indeed use Runtime.exec(), but then waits for the sub-process 
to complete and returns a map of its exit status, etc. That's not explicitly 
stated, but it's the only explanation consistent with what I observe. For 
comparison, what behavior do you observe with (do (clojure.java.shell/sh 
"sleep" "10") nil)?

> If that were the case, though, your pmap should indeed only be running
> cores+2 instances at once. Which is not what you observed.
> 
> Something's hinky here.

Indeed. According to a previous thread[2], something similar happens with 
Thread/sleep; my guess is that sh sleeps (or something similar) while it waits 
for the sub-process to finish and thus suffers from the same issue.

[1] 
http://clojure.github.com/clojure/clojure.java.shell-api.html#clojure.java.shell/sh
[2] http://groups.google.com/group/clojure/browse_thread/thread/9b3581d9f4b4afd6

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to