View previous topic :: View next topic |
Author |
Message |
fpemud Guru
Joined: 15 Feb 2012 Posts: 349
|
Posted: Thu Aug 23, 2012 3:07 pm Post subject: auto rise the priority of foreground process? |
|
|
I remember in some book I read, the priority of foreground process will be tuned a little higher than background process by the OS.
But I don't see this in my gentoo linux. I do the test using command top.
I think a task run in a minimized shell window should not harm the overall responsiveness.
But in my computer, it does.
I think the reason is xserver, window-manager, my active window, and this background task(a cp command r/w the hdd so have much wa time in this process) all have the same priority and nice, which is 20 and 0.
Of course I can manually specify a higher nice when starting such a task, but have an automatical solution is better.
Is there anyone encounters the same problem? How do you deal with it? |
|
Back to top |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Thu Aug 23, 2012 3:42 pm Post subject: |
|
|
I use custom tweaks. |
|
Back to top |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9691 Location: almost Mile High in the USA
|
Posted: Thu Aug 23, 2012 3:43 pm Post subject: |
|
|
The problem with Unix is that it's hard for the computer to tell if it's foreground or background. Not only this, cp copying lots of data is massively disk intensive. Disk is slow. If you need disk while the copy is happening you will have to wait until the current cp command sent to disk is done before you can get your other data.
This is more of a disk scheduling problem. You could try ionice (in sys-apps/util-linux) and set it to something like idle priority (I think most things default as best-effort) and see if it helps.
Also you should check to make sure your computer is tuned properly, like having DMA enabled for the disk drives. Can't help much with the *really* slow devices like cdroms, etc., though. _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Thu Aug 23, 2012 5:36 pm Post subject: |
|
|
Use zen-sources if you want X to be auto-reniced. It doesn't make a whole lot of difference but the feature is there anyway.
Use BFQ if you want to be able to do disk I/O and anything else on your system at the same time. |
|
Back to top |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Thu Aug 23, 2012 5:40 pm Post subject: |
|
|
Ant P. wrote: | Use zen-sources if you want X to be auto-reniced. |
No, the OP wants apps within xorg to have their priority changed.
Personally, I explicitly set the priority of important apps. |
|
Back to top |
|
|
fpemud Guru
Joined: 15 Feb 2012 Posts: 349
|
Posted: Fri Aug 24, 2012 1:27 am Post subject: |
|
|
Thanks above.
I used PaulBredbury's method to tune my kern vm param, I beleive this willhave good effects on my I/O.
To PaulBredbury:
I think for the xserver process, I can write a fixed openrc init script to renice it.
But the auto dynamic renice is still needed. because no matter how we tune, the I/O problem will always be there, only alleviated.
To Ant P.
The problem with Unix is that it's hard for the computer to tell if it's foreground or background.
why?
I think for X server it's easy to know which process the active window belongs,
and bash knows which task is in fg and the mapping between task and process.
I think it doesn't need to be in kernel space, technically it should be and can be implement in Xorg and bash. Am I right? |
|
Back to top |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9691 Location: almost Mile High in the USA
|
Posted: Fri Aug 24, 2012 1:44 am Post subject: |
|
|
For graphical programs it can, but programs like cp do not. Technically all programs are either running or not running. Now whether you want a program to receive lower priority if minimized or not, that's another possibility - but what if you were to run firefox from that window and you minimize it?
However another issue with Linux and other unix, for security purposes, once a program's priority is dropped, it cannot be raised unless you have root access... _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Fri Aug 24, 2012 6:18 am Post subject: |
|
|
fpemud wrote: | But the auto dynamic renice is still needed. |
Then tune more. You can try e.g. schednice, but I reckon you'll not be satisfied - it can't read your mind. |
|
Back to top |
|
|
fpemud Guru
Joined: 15 Feb 2012 Posts: 349
|
Posted: Sat Aug 25, 2012 12:45 am Post subject: |
|
|
eccerr0r wrote: | For graphical programs it can, but programs like cp do not. Technically all programs are either running or not running. Now whether you want a program to receive lower priority if minimized or not, that's another possibility - but what if you were to run firefox from that window and you minimize it?
However another issue with Linux and other unix, for security purposes, once a program's priority is dropped, it cannot be raised unless you have root access... |
You're right, it's not that simple.
One example:
Open a shell window, run gedit without "&", then minimize the shell window.
If shell windows minimized, then the priority of shell process and all its children including the gedit process should be lowered.
but gedit is the active window, so its priority should be rised.
it's contradiction.
PaulBredbury wrote: | fpemud wrote: | But the auto dynamic renice is still needed. |
Then tune more. You can try e.g. schednice, but I reckon you'll not be satisfied - it can't read your mind. |
I am seeing the page.
At least the briefing of verynice -- A Dynamic Process Re-nicer -- is exactly what I want, hehe.
I will look into it. |
|
Back to top |
|
|
|