How does BOINC get WU CPU time

Message boards : BOINC client : How does BOINC get WU CPU time
Message board moderation

To post messages, you must log in.

AuthorMessage
Paul Schauble

Send message
Joined: 29 Aug 05
Posts: 60
Message 88733 - Posted: 4 Nov 2018, 9:08:42 UTC

Since a lot of projects have BOINC start a wrapper, which runs another process, which runs another process, which in some cases starts many other processes, how does BOINC get the toal CPU time?

Could someone please give me a short summary, perhaps with pointers to the source code?

Thanks,
++PLS
ID: 88733 · Report as offensive
Richard Haselgrove
Volunteer moderator
Volunteer tester
Help desk expert

Send message
Joined: 5 Oct 06
Posts: 3261
United Kingdom
Message 88736 - Posted: 4 Nov 2018, 12:54:13 UTC - in response to Message 88733.  

Interesting question. Let's start with the simpler case, where a project writes their own executable file for use in a BOINC environment.

What they do is to include API calls to BOINC-supplied library code, and it's the BOINC library (linked in to the final application) which performs the timing functions. The BOINC library also provides the messaging facilities which enable the BOINC client to control the science application, and to read back progress and timing data while it is running and on completion.

In the case of wrapper apps, the BOINC library functions are included in the wrapper application, not the final science app. The whole purpose of the wrapper, of course, is to enable a project to use a scientific tool where the source code can't be modified to add the API calls. So I think that BOINC can probably only take exact measurements from the wrapper, and use those as proxies for the science app itself: assuming that it starts when it's told to, stops when it's told to, and runs (? at 100%) in between.

You could test that: with a traditional app with the embedded BOINC library, measured CPU time will decrease relative to elapsed time if you over-commit the CPU. If I'm right about measurements only being taken from the wrapper, you won't be able to see any effect on CPU time from over-commitment.
ID: 88736 · Report as offensive
Paul Schauble

Send message
Joined: 29 Aug 05
Posts: 60
Message 88740 - Posted: 4 Nov 2018, 23:06:42 UTC - in response to Message 88736.  

First, I'm referring to Windows here.

So, if I understand correctly

1. If BOINC run the app doing the work directly, it depends on the worker app to report CPU time. BOINC has a process handle to the worker process and could get CPU time from this handle, but doesn't do that.

2. If a wrapper is used, or if the worker process starts child worker processes, perhaps for multiple levels, then BOINC doesn't have a process handle on the children and depends on all intermediate processes to report CPU time up the ladder.

3. BOINC and/or the wrapper could cover all these cases by creating a Windows JOB object before it starts the first worker process. BOINC would create the first worker process/wrapper and add it to the JOB. The JOB object then tracks all child processes subsequently and add up the used CPU time for all of them. BOINC then reads the real total CPU time from the JOB object after the wrapper returns and gets everything. Of course, this is Windows specific code, but I'm sure it's not the only Window specific code in BOINC.

If all this is correct, would you like me to do the code for item 3? Do you think the JOB handling should be in BOINC, where it's needed only once, or in the wrapper, where each wrapper needs it?

++PLS
ID: 88740 · Report as offensive

Message boards : BOINC client : How does BOINC get WU CPU time

Copyright © 2019 University of California. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.