Idle Loop Optimized
seebs writes "Every so often someone makes a joke about optimizing the idle loop, but this article actually does it. " It's about time too- that process has been eating up clock cycles for to long.
← Back to Stories (view on slashdot.org)
I run Gentoo.
Yeah.
It's always eating them up, right when I need them too!!! The odd thing is it's always decreasing to fit my needs... where are all my spare cycles?
My UID is prime... is yours?
Aaaaah!!!
Got You!!
APRIL FOOLS!
"Who says nothing is impossible? Some people do it every day!" - Alfred E. Neuman
finally.. a real post
i win
Say, I'm curious, are you guys scripting this to post a new article every 5 minutes, or did you find some cheap outsourced labor to pound them out in real time?
This sig has been temporarily disconnected or is no longer in service
"Every so often someone makes a joke about optimizing the idle loop, but this article actually does it."
The article does what? Makes the joke, or optimizes the idle loop?
10 PRINT "I am awesome"
20 GOTO 10
The webmaster in question said "yeah, I noticed a couple of extra visitors, but my TRS80-based web server coped just fine.".
Never email donotemail@WeAreSpammers.com
Show some restraint. It isn't necessary to publish EVERY LAST APRIL FOOLS JOKE found on the Internet. Give it a rest already!
-Charles
Learning HOW to think is more important than learning WHAT to think.
You can choose to run something like SETI@Home, or if you'd actually like to make a difference, Folding@Home.
foolio - threadcrap
Slashdot Story Generator only they one the editors have is better, because it actually links to real stories.
The rock, the vulture, and the chain
Today at work I was in a spectacularly smooth (and remarkably energy efficient) idle-loop.
Fortunately the loop was terminated automatically at 5pm.
------ The best brain training is now totally free : )
- which literally means 'diarrhea of words', - which (I believe) is in some weird way applicable today to the /. editors pushing April 1 'joke' stories.
think you mean too*.
can we get some editors that can spell?
...have they implemented multicore support for greater speed and accuracy?
Isn't it awfully nice to have a penis?
Isn't it frightfully good to have a "dong"?
It's swell to have a "stiffy",
It's divine to own a "dick".
From the tinyest little "tadger",
To the world's biggest "prick".
So three cheers for your "Willy" or "John Thomas",
Hooray for your "one-eyed trouser snake".
Your "piece of pork",
Your "Wife's best friend",
Your "Percy" or your "cock".
You can wrap it up in ribbons,
You can slip it in your sock.
But don't take it out in public,
Or they will put you in the dock,
And you won't come back.
I thank you!
Um could you optimize the idle loop? Yeah... that would be great.
while(1) cout "/.\n"
Would you believe Intel CPUs already have an instruction for optimizing the idle loop?
Great, this technology will allow me to do nothing even faster and with greater efficiency.
I hate it when I give a cpu an idle loop, and come back later to find it's not even running, lazy bastard. Seriously, after prototyping a new processor the first test it gets is something like
0000 jmp 0000, or after getting a VHDL z80 to run in ModelSIM the first thing I did was slowly stepping thru a similar loop to verify it was actually 'fetching and stepping' (manually putting the instruction in the bus since I didn't even have memory, heheh).
try { do() || do_not(); } catch (JediException err) { yoda(err); }
cmdrTaco, did you read that? you might want to
This is a joke, but man if I didn't know programming I sure would have fallen for it. It's all so... reasonable.
Jesus - optimizing the idle loop - the way he ends up doing it just cracks me up.
1f u c4n r34d th1s u r34lly n33d t0 g37 l41d Capitalization really works: i helped my uncle jack off a horse
True, the article is partly an april fool's joke. What would you get by optimizing the idle loop? More cycles of the idle loop running in your idle time! But the 2nd half of the article discusses Altivec instructions. And seriously, there's useful information to be found there if you're writing Altivec code.
There are 10 kinds of people in the world - those that know binary, and those that don't.
There was a similar one years ago about optimizing the idle loop of 4bsd Unix on the VAX. Turns out there was a real reason to make the change, a bug report was filed and the optimization was implemented. The "broken" idle loop did some computation and then checked to see if there was other work to do. If the computation got faster, then the latency in noticing that new work arrived got lower. Lower latency is usually a goot thing. Note that the techniques expoused in this article might even increase the latency by doing more work in each iteration.
I love this sort of thing. The basic idea is silly, but he manages to show some useful stuff and make some valid points while exploring it.
I remember in the 1980's there was a great article on how to add a GOSUB keyword to the FORTH language. The article evolved the code through four different versions, and each one showed something cool and useful about FORTH. Well, maybe not the last one:
: GOSUB ; IMMEDIATE
For those of you who don't grok FORTH, this defines a keyword called GOSUB that does nothing, and does it at compile time so it doesn't get compiled in either. (The article noted that GOSUB FOO is the same thing as just plain old FOO, since FORTH functions are always called as subroutines anyway.)
Around the same time, I saw an article on how to build your own 64KB memory: take a breadboard, and 65536 8-bit flip-flop chips, plus a 1:65536 multiplexer and a 65536:1 demultiplexer for address selection! The article helpfully calculated how many Watts of power it would take to drive all these chips (a LOT) but it didn't say where one might find a multiplexer or demultiplexer with over 65000 pins on it.
steveha
lf(1): it's like ls(1) but sorts filenames by extension, tersely
Naw, the /. post is referring to itself. It does both.
I'm also worried about the lack of a decent defragmenter for the unused portions of my hard disk....
***You learn something Every day. And then you die.***
Sorry man, but the compiler shoulb de doing that.
Loop unrolling is the _basics_.
You should worry about better design and readability.
Auto-vectorization is a step for GCC 4.0, thought.
I intend to live forever. So far, so good.
http://www.theinquirer.net/?article=22318
My blog: http://www.seebs.net/log/ --- My iPhone/iPad app: http://www.seebs.net/seebsfrac/