Ubuntu QA:
BlogBrainstormPackage status
Log in
Ubuntu QA
The Ubuntu community has contributed 17459 ideas, 107690 comments, 2263278 votes
Idea sandbox Idea sandbox
Popular ideas Popular ideas
Ideas in development Ideas in development
Implemented ideas Implemented ideas
Idea #13718: Automatically renice/increase priority of GUI apps in foreground

Written by omegamormegil the 25 Sep 08 at 20:55. Category: Usability. Related project: Nothing/Others. Status: New
Rationale
When you are running multiple applications in a GUI, such as running Update Manager in the background while browsing the web in Firefox, the application in front of the user should not become unresponsive to user input. Even if you are doing something intensive in the background which you want to complete quickly, giving priority to the web browser for as long as it takes to follow a weblink would only minimally slow down the background process.

Keeping the windows the user is actively using from slowing down or becoming unresponsive due to background processes would, from a user's prospective, cause their computer to feel slow less often, enhancing the user experience in general.

It's always possible to change the priority/renice processes as appropriate with System Monitor, but I think it would be OK if the system assumed that certain processes should have higher or lower priorities based on the position of the window in the GUI. Maximized windows should be given the highest priority, a window in the foreground should have a higher priority than a window in the background, and minimized windows (and processes without a window) should be given a lower priority, automatically. A way to tweak or override this feature from the application File menu or with an Administrative Tool would be practical.
Tags: (none)

56
votes
up equal down
Solution #1: Allow the system to adjust process priorities automatically for users
Written by omegamormegil the 25 Sep 08 at 20:55.
Allow the system to automatically give priority to certain applications which the user would generally want to be more responsive, such as windows in the foreground and multimedia applications. Generally speaking, maximized windows should be given the highest priority, a window in the foreground should have a higher priority than a window in the background, and minimized windows (and processes without a window) should be given a lower priority. As "brainstormed" by Scott Remnant of Canonical on Ubuntu Devel Discusshere: "I've always thought it would be interesting to be able to influence the scheduler on a per process basis - and do that from the Window Manager. ie. deliberately give the user's foreground process the "majority" of the time, and fair schedule the rest." Apparently MS Windows has had similar functionality since NT. Perhaps a preferences tool could also be created to let the user tweak the settings, or turn them off (such as when a GUI is being used to administer a server).
3
votes
up equal down
Solution #2: Put a renice button in the titlebar, plus priority to foreground app
Written by natetechboy128 the 10 Apr 09 at 03:16.
While the foreground app in the GUI should have a higher priority, it should also be possible for the user to adjust the priority without mucking about in the CLI. I propose a button in the titlebar, or even a "CPU pie", allowing users to allocate different portions of the CPU to different tasks, in a pretty way. For example: 30% Rhythmbox, 50% Firefox, 20% (insert boring background app here). Not quite a realistic pie, because it wouldn't include init and other daemons (so as not to confuse the MS-switchers) or maybe only include them in "Advanced" mode. This way, you could have higher priority to apt than to, say, curl or wget. Shouldn't be that hard to implement...

Propose your solution

Attachments
No attachments.


Duplicates


Comments
cheesehead (Brainstorm moderator) wrote on the 25 Sep 08 at 21:39
My highest priority job is sometimes in the background or running on the command line, and I'm just browsing or e-mailing while awaiting completion. I don't want the system second-guessing priorities that I gave it.

I don't find the current renice process using the command line or System Monitor to be inconvenient at all. Quite the contrary.

Xepra wrote on the 25 Sep 08 at 22:45
@cheesehead

I usually don't mess with renicing stuff, but it seems that this could be implemented in a way that wouldn't interfere with you. Since niceness goes from -20 to 20, with default being 0, couldn't your manually reniced programs be in the ranges of >|5| and allow the window manager to play in the -5 to 5 range?

In other words you always give your higher priority tasks at least 6, and your lower priority tasks at least -6, then the window manager could bump foreground, maximized tasks to 4, minimized tasks to -4 etc...

Or would that still cause you problems?

I like the idea of foreground applications being given priority on standard user machines; it could increase the overall responsiveness of the system. Obviously in some cases this could be a hinderance, but the majority should rule.

Jadd wrote on the 26 Sep 08 at 11:44
I may be completely wrong, but isn't this what the Completely Fair Scheduler in the Linux kernel is about?

koenfloris wrote on the 26 Sep 08 at 11:56
@jadd
yes indeed, but this is an improvement to it
@cheesehead
maybe an option to turn this feature off will do for you?
btw: didn't i saw your name in a zelda-walktrough? a dutch one?

cheesehead (Brainstorm moderator) wrote on the 26 Sep 08 at 12:32
I could live with a convienient way to enable/disable. Or uninstall?
Not me in a zelda-walkthrough...perhaps an impostor.

dino wrote on the 26 Sep 08 at 17:32
while a nice (hrhr) idea its not that easy to implement! You CANT implement this in metacity, where it should be implemented since you cant reduce (meaing getting better priority) a process as user! Its monotone! You can just increase the nice level of your processes.

javaiscoolmike wrote on the 30 Sep 08 at 20:58
@cheesehead

I think that it could be made in a way that if the user manually adjusts the nice values(like you) that it will not bother you.

either:
1) not mess the programs you adjusted; only renice other programs
2) or just turn its self off(renice all programs back to there original values) until all manually adjusted reniced programs have terminated.

option 2 would not 'get in your way'. and it would allow the rest of the world to be happy.

******
also
i WISH i could just right click on an application title bar and change it's priority.
******

oh, and a big issue for this would be sub-processes! do they get reniced too? what if a gui app starts a demon? does it get reniced too? if the sub-process is also a gui app that gets open minimized how is it reniced? alot of gui app have sub-process do the hard work; so it might be kind of hard to figure out what process to renice??

javaiscoolmike wrote on the 30 Sep 08 at 21:10
oh and if the gui app in the foreground is waiting on some other possess(say some demon), then giving the app in the foreground a higher priority would slow things down. And this could create a case where an app has a higher priority then X, and it slows down the responsiveness of the X sever.

I like the idea, but i think there are a lot of details that would need to be looked at seriously before we just start making changes.

foxure wrote on the 1 Oct 08 at 20:27
javaiscoolmike:
of course it needs some technical details ordered first, i guess that in the end an application will never get a nice higher than it would normally have. it's just the applications in the foreground that is getting a lower nice.

I think i like the idea. But there most be no interference with media player and stuff like that. I don't think there would be either.

adelie wrote on the 1 Oct 08 at 21:16
-1 Not An Idea

The scheduler was a HUGE fight I am sure may have cost someone an eye in the debates. I am a little scared that you think you need to micromanage your nice levels, and really make me wonder if you understand how it works, for example, idle never takes priority over anything, and nice levels are relativistic. I am baffled over what you are trying to accomplish.

What you are talking about is scheduling, and the details of how a scheduler work come down to complex mathematical equations, and nerds argue over whose equation is the best. The details are quite a bit beyond the scope of your suggestion. Sorry.

omegamormegil wrote on the 22 Oct 08 at 22:04
Perhaps you are right, and I have no idea what I'm talking about, but I think my point is perfectly clear.

For example, right now I'm doing some stuff in the background while I'm trying to use Firefox, and the browser is slow to respond to whatever I tell it to do. The stuff in the background is going to take 45 minutes to complete. Should I have to wait 45 minutes to get any practical use out of my Desktop computer? If the background process has to pause completely for 1 second, so that I can click a link in a browser, it isn't going to significantly increase the amount of time the processing is taking but it will give the user significantly more use of their desktop while the background process continues to work.

I can achieve this manually by stopping the process with the gnome-system-monitor, clicking the link in Firefox, and then continuing the process. However, if this could be handled automatically in some way (nice, scheduling, you tell me), it would save time across the board.

If this were a server, obviously the user should defer to whatever the computer is doing, as it is doing it's job. But with a Desktop system, the system should defer to whatever the user is doing, because the user is trying to do his or her job. And therefore, generally speaking, whatever is in the foreground should get priority, because that is what the user is doing.

Whether it's scheduling, or niceity, or whatever, I think implementing this would be a big plus in the User Experience department.

I acknowledge that I have no idea how much work it would take to do this, but if Ubuntu wants to perfect the Linux Desktop, I think this should be on the list.

gmatht wrote on the 8 Nov 08 at 02:24
@ omegamormegil

Actually there are three classes of applications:
1) GUI Software that the user is running in in the foreground
2) GUI Software that the user is running in in the background
3) Server software.

Even on a server, (2) should probably have a lower priority than (1).

Nice is perhaps a better thing to adjust than Windows style priorities where the higher priority applications can completely starve lower priority applications. For example we probably don't want a download to timeout because the foreground process wants to use 100% of CPU.

It may be safer and easier to increase the nice of background processes GUI processes rather than decrease the nice of the foreground process. This means that the foreground process won't be prioritized over the X server (important for Desktops) or other servers (which probably doesn't matter much for a Desktop since these servers won't be doing much work anyway).

The first step towards this would probably be to introduce a way to micromanage nice levels without needing to be root. At the moment we can increase nice, but cannot return nice to 0 without being root. Nice was changed so that users could never decrease their own nice so that users could not "fight" administrators increasing their nice levels. However it would make sense to allow a user to micromanage their nice levels, down to a limit set by the administrator.

omegamormegil wrote on the 16 Nov 08 at 17:36
Yes, performance from a User's perspective should be opposite on a Desktop and a Server system. Server systems should give priority to the background processes, and Desktop systems should prioritize whatever the user is actively using, but of course not to the point of "timing out" or severely disrupting the rest of the running processes.

Interestingly, I was just reading up on Ubuntu performance levels in the Ubuntu Devel Discuss archives, and Scott Remnant of Canonical seems to have had thoughts similar to my suggestion:

"I've always thought it would be interesting to be able to influence the scheduler on a per process basis - and do that from the Window Manager. ie. deliberately give the user's foreground process the "majority" of the time, and fair schedule the rest."

His solution is obviously technically superior to what I came up with, but he's more or less talking about the same idea. The email is readable at the link below.

https://lists.ubuntu.com/archives/ubuntu-devel-discuss/2008-November/006190.htm l

omegamormegil wrote on the 16 Nov 08 at 17:57
More from the discussion in Ubuntu-devel-discuss I noted in my last comment:

"Windows Vista does this. It also lets programs register "multimedia threads" that are then given higher priority to avoid playback glitches."

"

Matthew Thomas who wrote the email I am quoting above even links to this brainstorm idea in his comment.

Also:

"And all previous versions of NT. The thread owning the foreground window has always gotten a boost to its priority."

I think it would be awesome if Ubuntu implemented this feature, particularly since Windows NT and Vista already do this.

Nevermore wrote on the 2 Jun 09 at 13:17
I think it depends a lot on the situation. Sometimes you want the background process to be finished as soon as possible, but still want to check your email on the meantime. In this case, the user could change the priority of update manager to high, so the limited resources of notebook/older hardware would be used as efficiently as possible.

Currently it's quite complicated to set the priority level of an individual application. It should be very easy and simple, and the resulting speed-up should be visible. There shouldn't be a need to open extra program (system monitor...) for that. I propose right click application name in the panel -> set priority -> high, normal, low etc.

Also, there should be very simple way to see which applications have been given resource priority. Maybe there could be an option like "Indicate priority with font color" or something.

http://img189.imageshack.us/img189/4899/ubuntupanelapplets.jpg

Font color isn't so annoying, and it would make the priority changes more logical. I want to know which programs are loading at top priority, and if I make those manual quick changes, I'd probably lose the track at some point.

The main idea is good and important. I hate it how sometimes Pidgin freezes just because my updates are being installed with top priority. I'm too lazy to open System Monitor just to change the priority for a few minutes. Opening new programs is painful when you notice that the apps you ALREADY have open are slowing the computer down.

Notebook users might appreciate this kind of a feature. Manually changing the priorities could be quite useful, if it was easier.

Nevermore wrote on the 2 Jun 09 at 13:19
EDIT: hmhm.... Should first read all the comments.

javaiscoolmike:

also
i WISH i could just right click on an application title bar and change it's priority.

omegamormegil:

I acknowledge that I have no idea how much work it would take to do this, but if Ubuntu wants to perfect the Linux Desktop, I think this should be on the list.



I agree.


Post your comment