Ask Slashdot: What's the Most Often-Run Piece of Code -- Ever? 533
Hugo Villeneuve writes "What piece of code, in a non-assembler format, has been run the most often, ever, on this planet? By 'most often,' I mean the highest number of executions, regardless of CPU type. For the code in question, let's set a lower limit of 3 consecutive lines. For example, is it:
- A UNIX kernel context switch?
- A SHA2 algorithm for Bitcoin mining on an ASIC?
- A scientific calculation running on a supercomputer?
- A 'for-loop' inside on an obscure microcontroller that runs on all GE appliance since the '60s?"
Obligatory (Score:5, Insightful)
Every Ask Slashdot gets a comment pointing out that it's the dumbest Ask Slashdot ever, I know.
This time, it's really, really the case.
Solved. Next? (Score:5, Insightful)
Question: What piece of code, in a non-assembler format, has been run the most often, ever, on this planet? By 'most often,' I mean the highest number of executions, regardless of CPU type.
Answer: Genetic code.
How could this ever be determined or verified? (Score:4, Insightful)
How could this ever be more than a guess? How could it ever be determined, documented, or verified?
And for that matter, what is the definition of whether something is "the same" piece of code? For example, if the same source code compiles to different instructions on two platforms, are they running the same code?
How about if one of them actually compiles code that gets executed, and the other optimizes it out?
Re:Obligatory (Score:5, Insightful)
I disagree. This may be the superlative of something, but I don't think "dumb" is it.
I actually think it's an interesting thought experiment. It immediately forces the reader to think about how pieces of code are used in the real world, both within and beyond their intended application. But it is also likely impossible to settle to anyone's satisfaction. I would trust a proposed answer to this question even less than I would an answer to "What was the size of the internet at the time of the Morris worm", or "How many lines of C code are there in existence".
Just because something's hard to measure doesn't make it dumb, though.
What is a 'Non Assembler Format'? (Score:1, Insightful)
Assembly language is a high level language. It has macros and all sorts of constructs and stuff. I think the OP meant 'machine code.' If you've ever hand assembled machine code, or disassembled it from a hex dump, you know the difference.
Probably some telphone code (Score:4, Insightful)
eg. Call timer code in the 5ESS switch. Countless millions of times a day for over 30 years now. Probably the oldest code that we all depend on every day.
Re:Bios code? (Score:2, Insightful)
Well, all of those Windows reboots ought to bump the value up a fair bit.
Re: For / While in C (Score:5, Insightful)
Perhaps a pixel shader in a modern video game on console or PC, executed per pixel at HD resolution, and for hours (average play time) on tens of millions of machines?
Could be approaching 10^20 executions.
Re:Bios code? (Score:5, Insightful)
Lets approach this analytically.
What platform has the most computation power (number of CPUs x speed)?
Due to the increase in speed, we can disregard any CPUs built before 2000.
In number, mobile phones are the largest platform. So I would reckon, some GSM codec/cipher.
I think, for now, microcontrollers can be ignored, because they have much lower computational power.
Desktops and supercomputers have more power, but are they excessing the mobile phones? If they are a relevant portion, then across mobile phones and desktops, perhaps some code related to network access is the most-run.
I doubt it would be something kernel-related (like bootup, context-switching), because the kernel usually does not (or should not) take up a lot of the computing time. If we go by number of entries only, then perhaps some networking code.
If so, I'm not sure which layer to look into though. The lower ones are called more often, but media is not the same across use cases.
Re:IEFBR14 - Mainframe Null Program (Score:4, Insightful)
that is actually... really fucking sad. So sad it made me laugh. Is that in itself sad?
Re:Obligatory (Score:5, Insightful)
Re:Initialize array to 0 (Score:2, Insightful)
for almost all programs... written by people who have never heard of memset (or appropriate initializations for std::vector, etc.).
Re:Solved. Next? (Score:2, Insightful)
Perhaps it would be better to say for most genes that you compile a protein from the DNA using a temporary (RNA) copy and your ribosomes as the compiler, and the protein is the executable version ... although the ribosomal RNA genes are the most ancient still used and among the few that few active components that are still used in RNA form (tRNAs as carriers probably would not count).
Re:Bios code? (Score:5, Insightful)
Actually, it's likely not executed that many times - the CPU goes into HALT when idle, and wakes up when there's work to do. Gone are the days of endlessly spinning....
The Idle Process may be more book-keeping artifact than actual code.
Re:How could this ever be determined or verified? (Score:5, Insightful)
How could this ever be more than a guess? How could it ever be determined, documented, or verified?
How many piano tuners are there in Chicago? [wikipedia.org]