Overall architecture #4
jamescowens
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I will make a few relevant comments here as I have put a lot of thought and effort into this over the past month.
The complete picture for idle time CANNOT be obtained at the standard user (non-root) level due to permissions issues. The existing code in the boinc-client for polling XSS (the x screensaver module) for getting idle time DOES NOT work when running the boinc-client as a separate user (which is best practice), without opening up the GUI session user's X session for external access via the xhost command. This is a non-starter security-wise.
Wayland is much more complicated as there is no standardization of the idle query, it is up to the compositor to implement.
Given all of the above constraints. I am implementing the following architecture, largely as a separate service from BOINC. Note that I did a proof of concept in bash shell script, and am currently working on the C++ implementation. Event_detect is essentially finished and idle_detect C++ version is a work in progress. (The shell version works currently with the C++ event_detect version.)
Note the C++ is implemented in modern C++-17 compliant code, in an object oriented manner. It also is multithreaded with appropriate locking/critical section control.
The output of the event_detect is a file last_active_time.dat, which is in /run/event_detect. Note that on all reasonably recent Linux distributions, the /run directory is a tmpfs which is in memory only. Using an output file (and for the input events) a named pipe in the same directory is much simpler than using a shared memory (which would require complicated semaphore work to coordinate access), and presents less of a security risk. The ONLY thing written to the last_active_time.dat is an int64 in string format that represents unix epoch time in seconds UTC.
Since event_detect receives update last_active_times from its own sources AND all user level idle_detect instances running on the machine, and provides an overall last_active_time in last_active_time.dat, the BOINC client will simply poll the last_idle_time.dat file once a second to determine idleness.
This pretty much will resolve 99% of the issues we have been having with idle detection.
Beta Was this translation helpful? Give feedback.
All reactions