![]() |
![]() |
#1 |
"Mike"
Aug 2002
2×13×307 Posts |
![]()
We have msieve running on our low-powered NUC, which has an i5 processor with two real cores and two HT cores. The NUC has 16GiB of RAM.
If we run msieve using both real cores, our web browsing becomes unbearably slow. We suspect the onboard video which uses shared (system) memory is the culprit. (Other programs seem to work fine.) If we run msieve on just one core the browser responds reasonably fast. We only use the browser for two or three hours a day so it pains us to use only one core for msieve because that means that the other 21 to 22 hours of the day we are only getting half the work done. Changing the niceness of msieve does not make a difference. Locking the process to specific cores (taskset) does not make a difference either. We could manually pause (suspend) the msieve process but then we would probably forget to unpause it when we were done. Is there a way to trigger the pause/unpause based on a system event? For example, when the DPMS kicks off our monitor would be a good time to resume msieve. And when the monitor turns on would be a good time to suspend msieve. ![]() |
![]() |
![]() |
![]() |
#2 |
Sep 2002
Database er0rr
3,593 Posts |
![]()
Here is how to use jobs, fg, bg, ^z. You could have a cron job that checks for the absence of the browser process and then "bg" to resume msieve?
Last fiddled with by paulunderwood on 2016-01-29 at 17:51 |
![]() |
![]() |
![]() |
#3 |
"Mike"
Aug 2002
2×13×307 Posts |
![]()
We like to keep our browser open (with lots of tabs) so that idea will not work for us.
Mprime has the ability to pause itself. We wonder how hard this feature would be to add to msieve? Code:
In rare cases, users have reported the program can interfere with the performance of some programs such as disk defragmenters and some games. You can pause the program automatically when these programs are running by adding this line to prime.txt: PauseWhileRunning=prog1[n1],prog2[n2],etc The [n1], [n2] values are optional and indicate the number of worker threads to pause when prog1 and prog2 are running. The default value for n1 and n2 is to pause all worker threads. Note that the program will pause if the program name matches any part of the running program's file name. That is "foobar" will match "c:\foobar.exe", "C:\FOOBAR\name.exe", and even "C:\myfoobarprog.exe". Also, if prog1 is "*" the program will pause no matter what. Examples: PauseWhileRunning=*[1] during 6-7/2:00-3:00 PauseWhileRunning=* during 23:00-24:00 else decomp[1],mygame[2] The first example pauses one worker thread on Saturday and Sunday between 2AM and 3AM. The second example pauses all workers between 11PM and 12AM and pauses 1 worker if decomp is running and 2 if mygame is running. |
![]() |
![]() |
![]() |
#4 |
∂2ω=0
Sep 2002
República de California
3·53·73 Posts |
![]()
I'm a fan of low-tech solutions whenever feasible ... if your problem with the simple fg / ctrl-z - to-suspend method is that you forget to 'bg'-resume when done browsing (and the NUCs are so quiet that one can't use fan noise as a reliable subconscious proxy), could you put a CPU-usage display widget at top right or left of your display, with really bright (say, fluorescent-green) %-bars? Then when you minimize your browser the lack of 'color' in the space should remind you to resume your crunching stuff.
|
![]() |
![]() |
![]() |
#5 |
Dec 2014
3778 Posts |
![]()
Here is how I solved this once.
Make a new program, like nice(1) and nohup(1), that takes another command as an argument. Lets call the new program "pauser" and it has these command line arguments pauser [options] command [command arguments] where options are -dev <path to /dev file> to check, see below, can be used more than once -long-sleep <seconds> (default 300) -short-sleep <seconds> (default 15) The idea is we can notice user activity by checking the last modification time on the /dev files for the keyboard and mouse devices. For example, when I ssh into a machine env variable SSH_TTY=/dev/pts/0 when stat(2) says the time on this file has changed, that means someone has typed something in their ssh session. There are /dev files for the console and in X windows sessions. The pauser command works like this 1. start the sub-command and get the PID of it 2. mode = running 3. while <sub command still running> // When the CPU hog is running, check frequently for user activity // When the hog is paused, then check less often 4. sleep( mode == running ? short-sleep : long-sleep ) 5.a. if mode == running 5.b. stat(2) all the /dev files and if any have changed since the last stat do 5.b.i set mode = paused 5.b.ii send SIGSTOP to our child process using the PID from step 1 5.b.iii continue the while loop 6. if mode == paused 6.a. stat(2) all out /dev files, and if none have changed since last stat do 6.b.i set mode = running 6.b.ii. send SIGCONT to PID 6.b.iii. continue while loop The basic idea is to check /dev files changing to indicate user activity. When the CPU hog is running, we check every 15 seconds and when user activity is noticed, use SIGSTOP to pause the CPU hog process. Once it is paused, then check every 5 min for the user inactive and when found, use SIGCONT to restart the CPU process. Bonus points for the first one to run this as one command line nohup pauser nice msieve & |
![]() |
![]() |
![]() |
#6 |
"Mike"
Aug 2002
11111001011102 Posts |
![]()
After some experimentation today, we found that *not* locking (via taskset) msieve to the physical cores (0-1) allows our browser to run smooth enough to be usable.
Maybe someday we will find (or code) a tool to pause things. ![]() |
![]() |
![]() |
![]() |
#7 |
"Mike"
Aug 2002
2·13·307 Posts |
![]() |
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Resuming yafu job (ecm) | Johnatan | YAFU | 4 | 2016-06-13 11:39 |
Resuming aliqueit | johnadam74 | Aliquot Sequences | 4 | 2016-03-28 12:32 |
Pausing CUDA jobs | fivemack | Software | 0 | 2013-11-27 23:50 |
Pausing for games... | Xyzzy | Software | 2 | 2003-09-25 04:25 |
Resuming work | rc | Software | 9 | 2003-02-08 15:08 |