Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
auto rise the priority of foreground process?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
fpemud
Guru
Guru


Joined: 15 Feb 2012
Posts: 349

PostPosted: Thu Aug 23, 2012 3:07 pm    Post subject: auto rise the priority of foreground process? Reply with quote

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
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Thu Aug 23, 2012 3:42 pm    Post subject: Reply with quote

I use custom tweaks.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9691
Location: almost Mile High in the USA

PostPosted: Thu Aug 23, 2012 3:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Thu Aug 23, 2012 5:36 pm    Post subject: Reply with quote

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
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Thu Aug 23, 2012 5:40 pm    Post subject: Reply with quote

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
View user's profile Send private message
fpemud
Guru
Guru


Joined: 15 Feb 2012
Posts: 349

PostPosted: Fri Aug 24, 2012 1:27 am    Post subject: Reply with quote

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
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9691
Location: almost Mile High in the USA

PostPosted: Fri Aug 24, 2012 1:44 am    Post subject: Reply with quote

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
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Fri Aug 24, 2012 6:18 am    Post subject: Reply with quote

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
View user's profile Send private message
fpemud
Guru
Guru


Joined: 15 Feb 2012
Posts: 349

PostPosted: Sat Aug 25, 2012 12:45 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum