Significant Interactivity Boost in Linux Kernel 673
An anonymous reader writes "The Linux kernel team is at it again. Linux creator Linus Torvalds recently proposed a patch to offer interactive processes a boost, greatly benefiting the X desktop, as well as music and movie players. O(1) scheduler author Ingo Molnar merged Linus' patch into his own interactivity efforts, the end result nothing short of amazing... The upcoming 2.6 kernel is looking to be a desktop user's dream come true."
Re:a desktop user's dream come true? (Score:2, Interesting)
X11 Beh. (Score:3, Interesting)
My 2 1/2 cents Canadian
There was a time when... (Score:0, Interesting)
BTM
Re:Actually... (Score:3, Interesting)
If this patch is causing great excitement, then I can only assume linux is now more responsive on the desktop than windows.
Now, if only supermount was in the 2.5 kernel tree........
Say What? (Score:2, Interesting)
How does what Linus and Ingo are doing this time differ from previous approaches such as the low latency patch and real time enhancements?
Desktop user's dream? (Score:3, Interesting)
Most desktop users don't know what kernel they have. Even users that have Linux say "I have Linux 8.0".
While I think they'll notice some of this, I think users will see more benefit, and notice very much more, when the kernel is more real-time (pre-empting kernel code).
explanation needed, please (Score:3, Interesting)
With that lack-of-linux-knowledge, could someone explain why precisly this is a "Significant Interactivity Boost in (the) Linux Kernel"? Thank you.
Doesn't work for me (Score:3, Interesting)
Well, okay. Look. I just opened up my X server here on my mac os X box, sshed with X tunneling to my university's Solaris box, opened up xchat, selected some text, and attempted to paste it into a nearby xterm. Oh, hey, guess what, didn't work. I tried what you said. I selected some text, i clicked on the xterm, i tried middle-clicking and right-clicking. Nothing there. Care to tell me what i'm doing wrong?
Anyway, the whole select-to-copy thing is HORRIBLE GUI design. What if you want to select something in order to edit it without *blowing away* the clipboard? What if your hand slips and you select a couple letters of text by accident before you can paste something important into its destination? I, personally, have intense problems with the copy-paste thing because at some point i picked up the stupid habit of often scrolling by selecting text and dragging off the edge of the window, which will obliterate the textboard. And, worst of all, there's that nagging little question: let's say i'm editing a file, and i want to select some text in the part of the document i'm editing, "cut" it, scoll up to the top of the document, delete part of a paragraph, write a couple lines, and then paste what i just cut. What X's copy/paste means is that i must select the text i want to move to copy (making sure not to delete it yet, becuase it would be too easy to accidentally select text and copy over what i've written, losing it forever), scroll up, click where i want it to go, paste, and then delete and rewrite the text around it, scroll back down, and then delete the text i copied. Yeah, way to go on making the interface fit the needs of the user. Dammit.
And then there's the fact that, still, mostly due to the broken silliness of X copy&paste, most applications don't quite work the same, becuase they've all fucking implemented the clipboard in nonstandard ways because those unstandard ways are "better". Which they are, unless for some silly reason you want to copy and paste between applications. We've got the "clipboard" and the "cut buffer" and i don't know what either means, and lately some GNOME apps and such have taken to signing up with a sane (i.e., "copy" and "paste" are commands, and as such require a menu use or a key combination). And then vim has like its ten little internal clipboards, and emacs has some clipboard system i don't even pretend to know the first thing about, and i mostly use vim as my text editor in unix. And none of these apps i've ever seen give the option of choosing which copy/paste behavior you want: i mean, none of them will give you a nice little preference that says "select to copy" vs "select 'copy' from menu to copy" vs "have ten little internal cycling cut buffers with some arcane method of manipulation". And i still don't know how copy/paste within vim is supposed to interact with other X apps. I'd test it right now, but for some reason still unknown to me, i can't get gvim to run over my ssh-tunneling setup. When i try, it says:
X11 connection rejected because of wrong authentication.
XIO: fatal IO error 32 (Broken pipe) on X server "localhost:13.0"
after 0 requests (0 known processed) with 0 events remaining.
The connection was probably broken by a server shutdown or KillClient.
Maybe it doesn't like my MIT magic cookies, or something? But I digress. Face it. Copy and paste is still the most broken thing about X, and that's saying a lot. And maybe i'm just dense, but i still can't figure out how to change my X keyboard mapping on these silly Solaris boxes.
-- super ugly ultraman
for all you... (Score:5, Interesting)
The patch (Score:2, Interesting)
On Fri, 28 Feb 2003, Andrew Morton wrote:
> >
> > Andrew, if you drop this patch, your X desktop usability drops?
>
> hm, you're right. It's still really bad. I forgot that I was using distcc.
>
> And I also forgot that tbench starves everything else only on CONFIG_SMP=n.
> That problem remains with us as well.
Andrew, I always thought that the scheduler interactivity was bogus, since
it didn't give any bonus to processes that _help_ interactive users
(notably the X server, but it could be other things).
To fix that, some people nice up their X servers, which has its own set of
problems.
How about something more like this (yeah, untested, but you get the idea):
the person who wakes up an interactive task gets the interactivity bonus
if the interactive task is already maxed out. I dunno how well this plays
with the X server, but assuming most clients use UNIX domain sockets, the
wake-ups _should_ be synchronous, so it should work well to say "waker
gets bonus".
This should result in:
- if X ends up using all of its time to handle clients, obviously X will
not count as interactive on its own. HOWEVER, if an xterm or something
gets an X event, the fact that the xterm has been idle means that _it_
gets a interactivity boost at wakeup.
- after a few such boosts (or assuming lots of idleness of xterm), the
process that caused the wakeup (ie the X server) will get the
"extraneous interactivity".
This all depends on whether the unix domain socket code runs in bottom
half or process context. If it runs in bottom half context we're screwed,
I haven't checked.
Does this make any difference for you? I don't know what your load test
is, and considering that my regular desktop has 4 fast CPU's I doubt I can
see the effect very clearly anyway ("Awww, poor Linus!")
NOTE! This doesn't help a "chain" of interactive helpers. It could be
extended to that, by just allowing the waker to "steal" interactivity
points from a sleeping process, but then we'd need to start being careful
about fairness and in particular we'd have to disallow this for signal
handling.
Linus
----
===== kernel/sched.c 1.161 vs edited =====
--- 1.161/kernel/sched.c Thu Feb 20 20:33:52 2003
+++ edited/kernel/sched.c Wed Mar 5 19:09:45 2003
@@ -337,8 +337,15 @@
* boost gets as well.
*/
p->sleep_avg += sleep_time;
- if (p->sleep_avg > MAX_SLEEP_AVG)
+ if (p->sleep_avg > MAX_SLEEP_AVG) {
+ int ticks = p->sleep_avg - MAX_SLEEP_AVG + current->sleep_avg;
p->sleep_avg = MAX_SLEEP_AVG;
+ if (ticks > MAX_SLEEP_AVG)
+ ticks = MAX_SLEEP_AVG;
+ if (!in_interrupt())
+ current->sleep_avg = ticks;
+ }
+
p->prio = effective_prio(p);
}
enqueue_task(p, array);
Re:FINALLY! Thank you! (Score:4, Interesting)
I am curious... which GUI do you use in Linux? What speed processor and how much RAM do you have? Which distribution (or kernel) of Linux do you use?
I ask because it has been my experience that Linux is already considerably more responsive (in terms of GUI performance) than Windows. I use KDE 3.1 with Linux 2.4.20 and I have 512 megs of RAM and a 1.46 Ghz processor.
Now, least people accuse me of trolling (or of pandering to the Linux crowd), I should point out that I am not sure why Windows is so unresponsive. It seems to have something to do with hard drive access. It seems to me that Windows XP is acting like I'd expect it to if I didn't have DMA enabled for my hard drives. Basically, whenever I access the hard drive, the GUI becomes almost completely unresponsive, sometimes taking almost a minute to fire up even a browser. I have checked, though, and I do have DMA enabled.
So I truly do not know what is going on with Windows, but in Linux I just don't have these problems. Under heavy disk access, it may take a few seconds to fire up a browser in Linux, but that's it. MP3s keep playing, my apps are still responsive, etc. etc.
Windows NON-reponsiveness (Score:3, Interesting)
If Windows Explorer (not Internet Explorer, but Windows Explorer, the shell program that displays files and directories on the screen) needs something from the network, and the network is slow in responding, it puts up an hourglass. Even though what it needs is only relevant to the topmost window, it may refuse to let you bring up any other window, either in Explorer _or in any other application_. The condition may persist for large fractions of a minute.
The same thing sometimes occurs accessing files on slow media (diskette or CD-ROM).
Re:explanation needed, please (Score:3, Interesting)
Re:left, no right! (Score:1, Interesting)
Re:huh? (Score:5, Interesting)
Well, here is Linus replying to Molnar's post:
OK, maybe not gone wild as in baring their breasts, but certainly gone wild as in no-holds-barred flamageIs this really a good thing ? (Score:2, Interesting)
Re:X11 Beh. (Score:3, Interesting)
By those standards, Apple's OS X really sucks.
Re:huh? (Score:3, Interesting)
Red Hat- Because being a beta tester for kernels is cool!
(I love red hat, I just think AC takes some big risks with the RH kernel wrt controversial patches)
Linus discovers priority inversions (Score:5, Interesting)
There are various solutions to this problem. It sounds like the Linux kernel people are trying priority inheritance via the messaging system (local sockets). QNX [qnx.com] has had that for over a decade. Because QNX does almost everything, including all I/O, by message passing, it has to do this right. In the UNIX world, message-passing was added quite late, in BSD, and X is one of the few interactive programs that uses socket communication on the local machine. Sockets are used mostly to talk across the network. So support for time-critical local sockets isn't very good. UNIX pipes were the original UNIX interprocess communication mechanism, and they were intended as batch-like devices. Sockets look, and work, a lot like pipes. This legacy is the real cause of the problem.
Of course, the reason Linux users actually want this feature is so that they can play their pirated MP3s in the background while using X-windows.
Re:Simply More Evidence (Score:5, Interesting)
The non-obvious improvements are things like making the applications that depend on, or are depended on, by the interactive app, run faster. There are also additional tweaks to this that that are being considered such as giving interactive programs a smaller time-slice, but more of them, so it'll do things like paint the windows properly in respose to your movements, but it won't bog the rest of the system down.
Technically, scheduling tweaks do add to code complexity, but only in such a tiny way. Linus's patch was five lines. And Linus is very concerned with making sure patches are self-contained and, when possible, aren't spread out, a few lines in many different areas. He's got a very good, very "correct" attitude about design. It comes from him being happy with Linux for years now, he's not rushing to any specific point so it becomes useful. He's willing to put the time in to do it right.
Anyways, this is to say that most kernel patches don't lead to complexity, most decrease the complexity of the code. Linus has often sent patches back to be done the "right way" instead of allowing a hack. This tweak is so small and self-contained that it can't really be said to add complexity to anything.
Copy & Paste behavior is the BEST thing about (Score:3, Interesting)
Whenever I'm on a windows box, I groan at having to manually copy after selecting, and not being able to paste with one mouse click.
Remember one person's UI annoyance is another person's UI bliss. }:) That's why we'll never agree!
Linux support for multiple scheduler classes? (Score:3, Interesting)
Timeshare scheduling class (the default) attempts to evenly share process time across threads.
Interactive class is used for improving performance with windowing applications.
System class is used by the kernel.
Real Time class is used for fixed priority, fixed quantum scheduling.
Now I'm no kernel hacker and couldn't explain the hardcore details if pressed, but this sounds pretty clever and Solaris is a very neat operating system. These scheduler classes are loaded as modules which strongly suggests that they can be plugged in and replaced if necessary.
In 2.4 there were patches that provided realtime and low latency scheduling for the kernel. The new O(1) scheduler is getting positive vibes from the developers from what I've read, but does it cover these bases or are patches still required? In other words, does Linux now scale from realtime embedded to low latency desktop to [whatever NUMA systems require]?
Re:Linus discovers priority inversions (Score:1, Interesting)
Re:Actually... (Score:2, Interesting)
Do you have any idea how stupid you're sounding right about now? You're trolling, right? First of all, what protocol do you think VNC uses across the network? Yes, that's right: TCP/IP. "Ah," you say "but X uses TCP/IP even on the local system." My response is simple: no, it doesn't. When displaying locally X uses domain sockets, which is just about the fastest way of moving data about inside the system, especially when combined with the shared memory extension.
There isn't a single justifiable reason for claiming X is inherently slow. Sure, the protocol carries with it a bit of cruft, but that cruft doesn't slow X itself down. It's just the interaction of X with the current linux kernel that isn't as fast as windows. And the combo patch mentioned in this article is meant to solve that problem. That's why it got onto slashdot.
When a Linux GUI can use things like hardware acceleration, only then will it outperform windows.
Oh man, welcome to slashdot, where the uninformed spread their beliefs. Hardware acceleration (2D) has been in XFree since the 3.x days, and 3D acceleration is in XFree 4. Ofcourse, you might have misconfigured your system, which is a whole other can of worms (I agree X is still too easy to misconfigure).
As for why Apple didn't go with X, that's hard to say. Apple likes architectural elegance, and X for all it's power isn't all that elegant. Also, they had to write a lot of code in the graphics layer anyway, since XFree at the time didn't support a lot of what they needed (anti-aliased fonts, transparency, hardware auto-detection). Btw, transparency and decent hardware detection won't hit XFree until version 5.
Besides, I don't know if you've actually used Mac OS X, but it's GUI performance isn't all that. And it is seriously bloated memory-wise in the graphics layer.
My Point (Score:1, Interesting)
To be a good Desktop OS you need ease of use, at this moment X11 doesnt fit that description. Just because you may think Microsoft or even Apple is evil doesnt mean you shouldnt take design tips from them.
A possible solution would be a new X11 Compatable system for those who want it and a solid fast easy to use UI for it for those who dont. I also think we need a Unified UI Toolkit so everything across applications is the same.
Re:explanation needed, please (Score:4, Interesting)
It can be done, but it's awkard.
Try SuSE, you get a good desktop and (gasp) consistent config tools in one place. Or try Mandrake, you get the latest desktop and good config tools. Or try Debian, you get an ultra-stable system that can be easily upgraded. Or try Gentoo, you get a faster system on the bleeding edge.
Just use a real KDE 3.1 on a non-RedHat distribution and you will never look back at MS Windows.
Re:Desktop user's dream? (Score:3, Interesting)
While I think they'll notice some of this, I think users will see more benefit, and notice very much more, when the kernel is more real-time (pre-empting kernel code).
Actually, the huge benefits from running CONFIG_PREEMPT have mostly disappeared from 2.5. When the preempt patches were coming out for 2.4, we noticed huge differences in performance, but that's mostly due to a lot of rough edges in 2.4 that have largely been addressed in 2.5.
That doesn't mean that preempt is useless now. On the contrary, having the preempt infrastructure has made it easier to check for a lot of error cases, like functions sleeping with spinlocks held. It's just that turning preempt on in 2.[56] won't suddenly make your box a superdesktop anymore :3
Re:explanation needed, please (Score:3, Interesting)
Re:FINALLY! Thank you! (Score:5, Interesting)
Re:Gaming (Score:2, Interesting)
The way the scheduler determines interactivity is that an application sleeps, i.e. it waits for some sort of user input and then executes based upon that input. Games, at least the type of games that lag, don't meet this definition of "interactivity" and so will see little benefit from this patch.
These scheduler improvements could be considered comparable to seek time on a disk, while game performance is more akin to burst speed.
Re:Predicting the future.... (Score:1, Interesting)
Re:If Linux drops X11 (Score:3, Interesting)
Lower-end stuff (e.g. xterms) run slower over a dialup link (I'm sure I'm not even getting 40-50 kbps here), but it's entirely usable, particularly if I've been using it for a little while. Netscape 4 was lousy. I just tried it. I'm at 16-bit colour, BTW.
Back when I had a cable modem (before I moved to a place where they said I'd have a cable modem by the end of last year. hah!), which was capped at 3Mbps, I ran Mozilla 1 over the cablemodem, over a long distance (they hadn't hooked in to KANREN, so my traffic to the university went from Manhattan, KS through Manhattan, NY and back) from my older Ultra10 workstation (It had, I think, just been upped to 256MB RAM), displaying on my Debian (XFree 4? Or was it still 3?) PII 400 w/ 512 MB RAM, and it ran just fine. I don't recall it being substantially slower than local. I was either running 16bit or 24bit depth. Quite possiby 24bit, since I wasn't trying to run many games then (I made it 16bit for games over winex).
Oh, did I mention that those were over an encrypted connection? (ssh X11 tunneling)
Heck, the university used Sun IPX/IPC with Linux as thin-clients, displaying from a couple of (actually fairly crummy IIRC) central servers. It was pretty usable, too.
Slow at 100Mbit my ass.
And, according to www.ncl.cs.columbia.edu/publications/cucs-022-00.
Re:FINALLY! Thank you! (Score:2, Interesting)
The users I know would trade stability and $10/mo for instant access, so they leave their computers on all the time and they crash once a week. Maybe the users you refer to are more cost-conscious, or maybe they just want stability and would trade the two minutes it takes to boot and log in for a reliable system.
All I'm saying is that, given the opportunity, anyone would want both reliability and instant-access for zero cost. M$ knows this, and they know their products are not stable, so they market the (fictional) "fast boot times" of their OS's.
X11 developers? (Score:3, Interesting)
The XFree86 page is rather spartan, and I get NO idea what the roadmap for XFree looks like.
Re:Cool, they're reinventing Windows (Score:3, Interesting)
Did you actually read the article? This has nothing to do with foreground processes, and everything to do with making things more responsive for processes that are going to relinquish their locks more quickly. The only reason X is brought up as a demo is because (being a monolithic and single-process beast) it's easiest to notice when X is lagging behind a bit because of the (previous) sucky heuristics.
The double-whammy of Ingo's patch combined with Linus's little 6-liner is quite impressive. I've got a make -j3 running in my background right now, while I'm running KDE and using the XFree-supplied 'nv' driver (instead of the NVidia supplied one... haven't yet checked to see if NVidia has ported their driver to work with 2.5.x, or if it Just Does [TM]). I can move windows about with better responsiveness than my Win2K install gives me when it's just finished a huge task (compilation of a large project, exiting out of Counter-Strike). This is a very welcome improvement.
As a side note: Isn't it funny how the users with the higher Slashdot IDs seem to be more MS-friendly than those of us who've been here a while (with a few notable low-UID exceptions).