Andrew Morton And The Low-Latency Kernel Patch
An Anonymous Coward writes: "KernelTrap has interviewed Linux kernel hacker Andrew Morton, author of the low-latency patch. Though his patch has received less attention than Robert Love's preemptible kernel patch (recently merged into the 2.5 kernel), it results in quite significantly lower latencies. The interview is quite interesting, delving into the low-latency patch, explaining how it works and the differences between it and the preempt patch. He also talks about his ext3 work, porting that journaling filesystem from the older stable 2.2 kernel to the current stable 2.4 kernel."
Is there a formal difference between low latency and a realtime OS?
What about the Timesys kernel patches? How do things match up to QNX another realtime OS??
Someone else is watching Shaka Zulu on TV? Heh.
A day in the life of a kernel hacker.
I've never heard of Drupal before! But hey, that's what KernelTrap is now running on... And under a direct SlashDot hit, it feels quite responsive. I'm impressed!
What was KernelTrap running before? PHP-Nuke? Whatever it was, it used to choke under a heavy load... This is an improvement.
Mistranscription? or is there YAAIDK (Yet Another Abbreviation I Don't Know) being thrown about?
Writers imply. Readers infer.
I've been waiting for years for Linux to have finer control of process scheduling.
I hope someday that Linux will use a method similar to Irix, where you can specify a priority from 0 to 255, modify it's timeslice, and make it realtime or timeshared. This was one of the best things about Irix, and something I could really use for Linux.
I really like reading things like this.
That's why Linux is so great -- even if you're not good enough to work on the kernel, you can read about some of the issues that pop up. If you use Linux for awhile, and if you get to the point where you roll your own kernels and apply patches, you end up learning a lot about how the system works.
The MS guys are smart, and they're making some good systems now, but you can spend your whole life with them and not have much of a clue about what's going on under the hood.
If MS would open up their internal developer discussions to the public, it would take MS system administration to a whole new level. I understand why they can't do that, but it is a great example of what's nice about Linux.
"With an internally preemptible kernel the explicit task yielding is not necessary, because the context switch is performed in the interrupt return path and via open-coded yields which are hidden in the unlock code. But you cannot preempt an in-kernel process while it holds locks, so all the unlock, relock and fixup code is needed in either approach."
:)
Try getting your head round that one when needing sleep
He also talks about his ext3 work, porting that
journaling filesystem from the older stable 2.2 kernel to the current stable 2.4 kernel."
I'm confused... I was under the impression that most of the journaling file systems required 2.4. Granted, many started their life on 2.2, but still... most recommend or require 2.4.
On a side note, support for XFS and/or ext3 for 2.2 would be very nice as we currently have many servers running Debian (potato) with kernel 2.2. We would consider upgrading the filesystem, but little else. "If it ain't broke, don't fix it". About all that doesn't work well now is ext2... fsck sucks... we have 2 hours of UPS, but no generators... living in Vermont means a 4 hour power outtage about three times a year.
First I'd like to see a general consensus that Linux should become a low-latency OS. With that, we can then merge the preempt patch and start work on carefully and cleanly addressing the various long-held locks.
The problem is that kernel developers NEVER come to a consensus about about anything.
Instead try the following 4 steps:
1) Persuade Linus to merge the code. (Trick him by giving him tiny pieces at a time until it's all merged.)
2) Then hold a slashdot interview where you brag about how low the latencies are in the kernel now.
3) Next suggest on lkml that since the kernel is already low latency it might as well stay that way.
4) Lastly flame anyone who introduces new latency problems.
There you have it folks. My fool proof plan for low latency...
:)
"The low-latency patch yields worst-case latencies of around 1.5 milliseconds at present. The preempt patch is around 80 milliseconds,
but with the locking changes it should also yield 1-2 millisecond latencies." On what speed processor? 1.5ms is way too long for any kind of processor being sold these days. Try 100us maximum latency on a 133Mhz Pentium for starters and go down from there. And learn to use the term "deterministic" and I might raise an eyebrow. Make it POSIX 1003.1 compliant and someone will have a serious solution.
Programmers either need deterministic response in their applications or they don't. If they do, then Linux is not their OS. If they don't, then these half-baked solutions to reduce context switching time and interrupt latency are probably going to be fun to play with, but will cause nightmares in the long run.
Holy shit that thread you link to is amazing! I recommend it to anyone interested in kernel development.
> it does not support ./configure
./configure doesn't support BSD? Afterall, it's configure that has the interest in 'configuring' on as many platforms as possible -- not BSDs job to look and act like the next guy.
./configure thingy.
Quite funny. Wouldn't that be
Anyhow.. Back to compiling Postgresql and friends under Windows using that
Rod Taylor
Andrew Morton And The Low-Latency Kernel Patch
:)
.)"
Sounds just like a title of a bedtime story.
I also recommend you read "How CowboyNeal saved the world (with a little help from / and
So why now? Why did *BSD fail? Once you get past the fact that *BSD is fragmented between a myriad of incompatible kernels, there is the historical record of failure and of failed operating systems. *BSD experienced moderate success about 15 years ago in academic circles. Since then it has been in steady decline. We all know *BSD keeps losing market share but why? Is it the problematic personalities of many of the key players? Or is it larger than their troubled personas?
The record is clear on one thing: no operating system has ever come back from the grave. Efforts to resuscitate *BSD are one step away from spiritualists wishing to communicate with the dead. As the situation grows more desperate for the adherents of this doomed OS, the sorrow takes hold. An unremitting gloom hangs like a death shround over a once hopeful *BSD community. The hope is gone; a mournful nostalgia has settled in. Now is the end time for *BSD.
IMHO, SoftUpdates are better than Journalled File Systems. There's no journal file to maintain, just careful ordering of the writes. Why no discussion of it for Linux?
This may be a corrupt sector containing metadata (maybe even for the "/" directory or "/kernel", if you were writing a new kernel at the time of the crash), or it may be other corrupt data which became corrupted in a cascade failure that resulted in the crash after one or more corrupted blocks were written to disk.
Soft updates simply can't recover from this.
If, on the other hand, it were a kernel panic that didn't result in corrupt data being written to disk, then there's no danger of a corrupt sector from a DC failure, and there is no danger of other corrupt data needing fsck'ing, so you would be in the situation where the only thing that would be out of date is the cylinder group bitmaps; you could clean this in the background by "locking" access on a cylinder group by cylinder group basis for a short period of time, to clear bits in the bitmap that said an unallocated sector was allocated. This might be seen as brief stalls by an especially observant user or program (say someone is doing profiling of code at the time), but could be accomplished in the background.
The problem is that you can not know the reason for the crash, until after the recovery.
If there were available CMOS, you could write a "power failure" value into it at boot time, and then write a "safe panic" or an "unsafe panic" code into it at crash time (a power failure would leave the "power failure" code there).
The only valid background case would be for a "safe panic", if you could really guarantee such a thing.
The worst possible failure resulting in a reboot is a hardware failure of the disk; I would really be loathe to try cleaning in the background after a track failure or even a sector failure (sector failures are identical to sector format corruption after a DC failure during a write, FWIW).
Look, soft updates are a good thing, but they aren't a panacea for all problems. Let's laud them for what they do right, but not misrepresent them as doing something they can't.
~shiny
WILL HACK FOR $$$
Why is it so absurdly low? It is useless for MIDI to be at that low rate. So we must run all our MIDI programs as root in order to acheive greater fidelity?
Hmmm... how is protecting the system from a potential denial of CPU attack from a rogue user program better than forcing the user to become root to run MIDI apps and opening up a far worse potential security hole?
Solaris lets user programs have millisecond timing without resorting to such nonsense.
No, he isn't. Goatse.cx guy uses "cmdrtaco" for his slashdot account.
Unfortunately...
Adding three parantheses, does not improve the flow, by a significant factor, of the quote.
I found this quite interesting -
"One hot tip: if you spot a bug which is being ignored, send a completely botched fix to the mailing list. This causes thousands of kernel developers to rally to the cause. Nobody knows why this happens. (I really have deliberately done this several times. It works)."
So, does anyone think I would get any performance improvement if I compiled this in to my kernel on my file/web/ssh/blah server? I dont want to lose my precious uptime unless its really worth it.
How can Linux achieve low-latency as long as it allows the drivers to spin in udelay calls? I'm just investigating some driver code that essentially spins indefinitely while it's waiting for the hardware to respond to a command.
The loops I'm looking at are limited to a millisecond, wherafter the driver gives up and returns -EIO, but that millisecond could be an expensive worst case.
The only practical way to guarantee low latency is to go RT Linux. Thing is, in a realtime system you design the whole system at once. Linux is general-purpose and open-ended; you can just keep on adding drivers, and nobody can guarantee the worst-case timings.
Marko
And win. So that's why they need low latency. It doesn't need to be deterministic, it just needs to give you overall more responsiveness to mouse events and video events so your frags go up.
They can always roll these back (preempt, scheduler, break-lock). The VM is more diffucult to roll back.
unfinished: (adj.)
Once again, we see the second best effect where
the second best technological solution is the one
that wins out.
Ok. Let's say a processor does an instruction in 500 picoseconds on average for a little burst, reading from L1. At that rate, you tell the processor, "I'm doubling your workload, and hurry the hell up." So the introduced CPU latency adds up to--what?--something on the order of a hundred nanoseconds. Of course that depends on a bazillion things; I'm not sure, but I understand the context.
At 100 MHz, a wire or trace carrying current rings easily and resonantly if it is about 10 inches long. At 1 GHz, 1 inch is a very long distance. If there is some sort of ground plane, it is its own tank circuit--guaranteed messy--making things that much worse. Put your finger nearby, and watch the form shift on the oscilloscope. Not good. Now try to speed that up, and what do you get? Bottlenecks.
We hear about Moore's Law this and Moore's Law that. Inside the chip, that's fine. Outside the chip--while trying to approach significant fractions of 1Gz--we have already reached diminishing returns. So people come along and start to reverse the trend of CPU-work offloading. (Consider the old "Advaned Technology" bus using direct memory access and bus mastering of peripherals while processors were running at 12 MHz.) It doesn't make sense to do that anymore, and anyone who knows how to build kernels knows this. Because of the bus/crossbar/backplane/fabric delays, CPU's will just slack off anyway, waiting for data.
If you look at the proposed specifications of PCI bus replacement technology, it's basically a local area network inside the beige box of the future. Everything is based on protocols. For all you know, within only a few years, data will be compressed and decompressed between a processor-L1-etc amalgam and a hard disk drive. It will be essentially like a modem connection. Fibre Channel disks are almost there already. By the time this stuff becomes generic, the customer's internal questions will be about the tradeoffs between bottlenecking or peripheral interfacing at all. Upgrades will be of a different form altogether. They will have to be.
Isn't OSX based on *BSD? I think there are and will (near future) be more OSX machines than linux ones. In the long run, Linux will catch up (unless Windows ZP is *BSD based :-)
unfinished: (adj.)
PLEASE JOIN THE LINUX AUDIO DEVELOPERS mailinglist:
www.linuxaudiodev.org
It's been stated that the realtime patch lowers the throughput of linux, while making the responsiveness quite good. Meaning good for destop use bad for server use.
Now my question. What does the low-latency patch do to the throughput? Increase? Decrease? Stay the same, but everything is just 'snappier'?
If Mr. Edison had thought smarter he wouldn't sweat as much. --Nikola Tesla
Just the OS kernel itself promises low latency. The driver could fail to deliver to output in a small amount of time; but the kernel itself is still
"low latency/real time".
I don't know about the low-latency patch, but the preemptive patch actually increases throughput in most servers, due to i/o operations being done asap.
There are some cases where the preemptive patch lowers throughput, but in the majority of cases it only helps.
XML is like violence. If it doesn't solve the problem, use more.
What is he talking about? There were/are ports for the mac (I was playing with it and reading comp.os.minix when linus announced the first kernel) and the atari 68000 bix too, I think. He probably has never really looked for the other ports, but they're there if you need them.
I read this as Andrew Motion and the Low-Latency Kernel Patch.
If you moderate me down I shall become more powerful than you can possibly imagine.
Maybe that project needs somebody to make it full-baked. You seem to know enough about kernels so why not help them? And don't forget to add that "deterministic"-thingy to the next release.
Preserve old classics: copy your collection onto all hard drives.
They are not exactly embedded. Both use a microkernel architecture allows them to run the rest of the OS in a separate process within the microkernel. But they do have a form of X windows and can be run on the desktop. Of course you can also strip them down, flash them, and run them in an embedded environment. Of course, the task switching latency is supposed to be higher than that of other truly embedded RTOSs like VxWorks and pSOS.