11
$\begingroup$

Bug introduced in 10.0 and persisting through 11.2
RunProcess is new in 10.0


Comparing the cpu usage of

RunProcess[{"sleep", "10"}]

and

Run["sleep 10"]

The mathematica kernel spikes up to 100% cpu usage in the case of RunProcess during the time of "external calculation", while it stays calm with Run.

Why is that? And how do I avoid this behaviour?

Mathematica version: 11.1.1

$\endgroup$
  • 2
    $\begingroup$ I can confirm this. redhat/mma11.1. RunProcess connects to the process stdout , while Run does not. I don't see why that should take so much cpu though. $\endgroup$ – george2079 Oct 10 '17 at 15:12
  • 3
    $\begingroup$ Confirmed on OS X too. $\endgroup$ – Szabolcs Oct 10 '17 at 15:31
  • $\begingroup$ Did you report this to Wolfram Support? If you haven't, please do so, and let us know what they said. It smells like a bug to me. $\endgroup$ – Szabolcs Oct 13 '17 at 7:57
  • $\begingroup$ @Szabolcs: Yes I did. The report was forwarded to their developers. I'll post an answer when the issue is resolved. $\endgroup$ – image Oct 13 '17 at 8:10
  • 1
    $\begingroup$ Confirmed on Windows 10, mma 11.1; CentOS, mma 11.2. $\endgroup$ – Turgon Oct 20 '17 at 7:34
6
$\begingroup$

more of curiosity than anything else I tried this:

p = StartProcess[{"sleep", "10"}]
While[ProcessStatus[p, "Running"]]
ProcessStatus[p]
ReadString[p, EndOfBuffer]
ProcessInformation[p]

you get essentially the same result with no noticeable CPU hit. (the kernel does not show up on the linux top list)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.