Ask Slashdot: What's the Most Often-Run Piece of Code -- Ever?
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?"
for(;;){
}
OR
while(1){
}
Starts all main control loops and all kernels.
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.
CLI paste? paste.pr0.tips!
I would have to guess some code in BIOS that's pretty much the same on every platform. The POST components for memory checking, for instance. That might actually get disqualified as they may be written in assembler?
Indeed.
"Hello World"
Why would the Slashdot community know this?
Must be the SlashCode "asciifier" which removes all non-ASCII characters in summaries and posts, thus mangling a lot of names, locations and math formulas.
1% APY, No fees, Online Bank https://captl1.co/2uIErYq Don't let your $$$ sit in a no-interest acct.
By a long shot
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.
Way too low. The answer is almost certainly:
1. An embedded CPU (Z80, at a guess)
2. Move a value into a register, increment the register, compare to a value.
of the Windows NT kernel that hasn't changed since the 1990s?
"I don't know, therefore Aliens" Wafflebox1
return 0;
C^
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?
"How to Do Nothing," kids activities, back in print!
Probably some loop used in Bitcoin mining.
nop
http://en.wikipedia.org/wiki/IEFBR14
Any time a mainframe does anything with a dataset in a batch job (i.e. allocate, delete, whatever) it runs IEFBR14, a null program, as a target program to satisfy a requirement in how jobs are created.
This means that banks, retailers, governments, you name it--when they process the back-end records that make modern life functional, IEFBR14 usually gets invoked somewhere.
That has been running on mainframes for the last 30 years or so....
NOP
NOP
NOP
and then we die.
printf("Hello, World!\n");
or some clearscreen derivative ...
My guess would be the code in 'System Idle Process'.
Things you think are in the Constitution, but are not.
Go WinXP ftw!
for(int i=0; iSOME_LENGTH; i++){
array[i] = 0;
}
Run 100s of times per program, for almost all programs
I still have more fans than freaks. WTF is wrong with you people?
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.
http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/kernel/timer.c?v=2.6.25.8#L1059
?
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.
"To those who are overly cautious, everything is impossible. "
on anything {
displayHWinPtrAddrPtrScreen( {492EC5F8-477F-438E}.color.const::BLUE status:{492EC5F8-477F-438E}.const.DEATH } )
}
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
The keyboard scan loop in Windows gets my vote.
As most of us know, and the rest of us ought to, x86 and many other CISC architectures have their instruction set decoupled from the internal microarchitecture by using microcode.
Since multiple microcode instructions can run for one machine instruction, there's likely a sequence of three or more instructions used by many common instructions (I'm guessing something pertaining to checking for cache misses?) that thus gets executed more often than any single opcode on that machine.
i=i+1 or i+=1 or i++
Open Source Java Web Forum with LDAP authentication
Probably the embedded code in keyboards that handles CTRL-ALT-DEL.
...and all you ever saw on store displays in the 80's was the result of:
10 PRINT "FUCK "
20 GOTO 10
I'd have to say that code is a contender.
I'm fairly certain that all the BSD's including OS X use a standardized login.c Though my money would be on there being some system related windows code that has been the same since the 90s.
Browser code for reloading a page... mostly on Slashdot. No, really, how about an inner loop of a Windows screensaver?
What a fool believes, he sees, no wise man has the power to reason away.
int main (argc, argv)
char **argv;
{
...of the Windows NT kernel that hasn't changed since the 1990s?
Because we know there's nothing like that in the Linux kernel...
If you want news from today, you have to come back tomorrow.
The code that sends
HTTP_GET("insert URL of porn site here")
there are a lot of possibilities
Mp3-Player ... ...
Digital-Clock counting Seconds, Minutes or Hours
Code to send or receive Text messages
to handle GPS, GSM or WiFi
BUT what do you understand under " in a non-assembler format" ..." or "... non-python format"
assembla is NOT the language of machines its just an low level programming-language - very close to the hardware
still it needed to be translated - so this exclusion is like to say " in an non-java
http://en.wikipedia.org/wiki/Assembly_language
(sorry for not writing so good english)
I read this as a multiple choice question with a defined answer. I was disappointed when I figured it out, because I was hoping I had correctly picked D. Sigh.
The place to look would be inside Windows graphic library or in the C++ string library. Toss up which is more code doing low level graphics (fonts probably) or comparing strings.
A friend who worked on Intel compatible processors mentioned that people tend to think computers do 'math' most often (which was true up until about 1985), but really the vast amount of work they do is string manipulation. Which implies that fast string instructions are more important than fast math instructions.
Most OSes have some code that runs when other processes aren't running to measure the idle time. Certainly in Windows, this is a process in it's own right.
If the CPU is only 1% utilised, then the idle time process is consuming most of the remaining 99% (with the kernel using a bit of that).
So, I would hazard a guess that it's something in this.
(Or, for Windows, the code that swaps pages out to disk.)
sorry i mean bad english :)
I don't know the answer, but this would definitely be a candidate for getting made into a machine instruction into the next CPU architecture, and the efficiency savings would be enormous.
i++
or
MOV EAX, [EBX]
or
INC EAX
Man file has run and still continues to run on more computers than ever before and frankly refuses to die. It won't ever go away.
http://saveie6.com/
genetic code is not one genuine piece of code
printf, itself? For debugging, for testing, for actual work...
For an all-time high, you want a combination of a large number of devices, over a long period of time.
I'd say cell phones would do nicely. Probably something that runs often on all cells everywhere. Maybe something that sync's with cell towers, or handles jumping between towers.
Maybe text message handling code. How many texts are sent per day?
There is a bunch of problems with the question, esp. how you define your minimum code junk. If we really define as "any piece of code" then I'd go with some system functionality.
General search criteria:
- runs on many machines
- runs all the time
- execution time is extremely low
- runs already for a long time
My personal guess would be a version of memcpy, because
- it is used for virtually everything and everywhere
- the functionality is there since forever (so one can assume a stable code base with little changes, which is important to extend #4)
- its fast, so it can run lots of times in a small timeframe
- BAD: it might be actually written in assembler (doh!)
I bet there is something common in hardware design, say Verilog, that is run continuously in billions of places in in your computer. How about the basic DRAM cell? I got 64 billion (8 GB of RAM) of those running all the time my computer is on.
If you want procedural code, I'd assume its some part of the X86 microcode. Maybe something in instruction decode that just runs on every instruction it decodes.
Some parts of IEEE floating point that are microcoded likely have several lines involved. I bet there is also microcode in the cach subsystem somewhere that runs a ton.
If you want higher level code, like us software guys write, thats easy: code up a loop that gets optimized out by the compiler, but would have run some insane number of times (2^66^64^64 or something), then claim that code was run the most.
Question is stupid btw.
Is genetic code more akin to executable code or some type of markup, or ...what?
Ignoring the '3 line' thing because that's just dumb, my vote for the most run piece of code on the planet right now would be:
DNS. Either the part that queries or the part that answers.
Think about how many times that's being called at this moment, globally.
(And yes, this Ask /. is the stupidest ever.)
Together, We Can Make Slashdot Better. I Do NOT Mod ACs. - Check Me Out
The 1337 version of that:
10 FOR X=0 TO 35
20 PRINT TAB(X) "FUCK"
30 NEXT X
40 FOR X=34 TO 1 STEP -1
50 PRINT TAB(X) "FUCK"
60 NEXT X
70 GOTO 10
The extra 1337 version uses SIN(X) to feed the horizontal tab. The ultra mega 1337 version increments the vertical scroll register at each scan line resulting in so called FLD but that requires 6502 assembler.
I agree this is impossible to measure but..
I'd guess the first level interrupt handler in windows (most of which is in C by the way) would be high on the list.
(Most processors go to sleep rather than running an idle loop, which sort of rules that out).
The routine used in calculating Pi.
int a=10000,b,c=2800,d,e,f[2801],g;main(){for(;b-c;)f[b++]=a/5;
for(;d=0,g=c*2;c-=14,printf("%.4d",e+d/a),e=d%a)for(b=c;d+=f[b]*a,
f[b]=d%--g,d/=g--,--b;d*=b);}
Having to work for a living is the root of all evil.
getline() - low speed users
....are more of an early-70s thing. The 60s was all about integrated hand-engineered hard-wired logic, & even then it's a late-60s thing.
Superintendent Chalmers: A graphics system... in the linux kernel... and hasn't changed... since the '90s?
Principal Skinner: Yes!
Superintendent Chalmers: May I see it?
Principal Skinner: Er, no.
I, for one, am looking forward to the inevitable
@echo off
The code for sleep() should be the most executed code.
for windows
the unix commands would probalby be among the most, since "ls" "cat" "mkdir" et. al. have all existed for a long time, and I'd suspect that they OR....
The BSD TCP/IP stack (probably really this one) is the most ran
Insightful? Come off it. It's a pun.
systemd is Roko's Basilisk.
Aren't all string instructions essentially math instructions? In fact, aren't all software instructions of any type reducible to mathematics when you get down to the metal?
For a GIF of less than two million pixels, say 1600x1200, and each pixel's colour selected from a palette of 256 colours and dependent on neighbouring pixels' colour values derived from the same iterative algorithm run 1 million times to maximise value stability per pixel, you're looking at running the same line of code 4.9152*10^14 times.
Assuming 100% (as in perfect) saturation on a 2GHz processor core, that'll take just over 68 hours.Or, to use the old industry yardstick, 63.2 P90-days.
(source: mad guy with calculator and a good few years experience tying up stacks of commodity processors to paint pretty pictures)
Political debates have me rolling my eyes so much I think I got optical whiplash. I should sue. - Foamy The Squirrel
PPPd on Android. it runs the IP connection.
Arguably, given that ultimately all code is executed by microprocessor/controller/ASIC/whatever logic gates, I would say it has to be one of AND, OR, or NOT (or one of their base combinations). Cf. http://en.wikipedia.org/wiki/Logic_gates
Also note that this answer satisfies the "non-assembler format" constraint (in letter if not in spirit).
Anything sufficiently complex that runs that many times on that many machines is likely worth optimizing in assembly.
Looking at most linux desktop apps.. it's GetTimeOfDay()
Given the enormous sizes of memory both RAM and ROM, and the blazing speeds of processors, some days I'm inclined to believe it's NOP.
#include
main(void)
{
return 0;
}
Based on the number of graphics cards out there, the high repetitive nature of their application and the fact that that's all they do, it's probably something related to them. I thought of supercomputers running very small recursive routines, but they usually have a limited lifetime and older computers aren't fast enough and haven't continued to run in any event.
Graphics though? I'd guess something in a very common graphics card would probably be in the scale to achieve the title of most-run code.
Though if you had allowed assembler, I'd have gone with nop, nop, jump -2.... In all of it's forms. It's not uncommon in older systems that run entirely off of interrupts to use this as an "idle loop" that just waits for the next interrupt so that the interrupt handler can get on with the job of code execution. Many embedded systems use this.
GrpA
Enjoy science fiction? "Turing Evolved" - AI, Mecha, Androids and rail-gun battles. What more could you want?
static inline void B(void *blah, uint32_t a)
{
uint8_t * z = (uint8_t *)blah;
z[0] = (a >> 24) & 0xff;
z[1] = (a >> 16) & 0xff;
z[2] = (a >> 8) & 0xff;
z[3] = a & 0xff;
}
I have a patent for "3 consecutive lines of code". It's not obvious, even to those trained in the art.
Now pay up world!
It’s not really executable as I understand it, but I am not a biologist. The translation from DNA to RNA is hard to construe as ‘execution’. Then in the next step the RNA goes to ribosomes to construct proteins. So maybe DNA is ‘compiled’?
The field of computational biology would probably have a good metaphor to map the ideas from biology to computer science.
If you're just considering userspace, then perhaps good old ls(1). I must run it hundreds of times a day.
If not for the arbitrary 'three line' lower limit I'd say IEFBR14 - it is probably the most common OS360 -> 'Whatever they call MVS now' utility and it's only one line long...
It is used to allow programmers to manage files on mainframes by triggering all the job set-up and tear-down processing, deleting, creating, versioning files on mainframes.
Actually, it WAS only one instruction long, a branch instruction, but in the late 70's they doubled the length of it by loading a zero in the return status register with a load instruction.
This code has been running on IBM mainframes for nearly 50 years!
Ken
A kernel idle loop is my best guess, but unfortunately some of them will be less than three lines.
Alternatively interrupt handling (the timer interrupt will be the vast majority).
Finally! A year of moderation! Ready for 2019?
The central dogma of molecular biology:
http://en.wikipedia.org/wiki/Central_dogma_of_molecular_biology
Happens millions of times per day in each human; not to mention the times it occurs in other living creatures.
x86 micro-instructions? Define "code". DNA. There ya' go.
For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
Isn't that in assembler format? If only genetic code had source code comments ...
Or print chr(7)
AKA Control G, it triggered a bell sound...
Ken
cares?
I guess it would technically work like that:
The DNA would perhaps be source code of sorts, on the disk.
The RNA is basically a copy of some piece of DNA, perhaps "This bit of code has been loaded into memory so that it can be handled by the compiler."
Proteins are really the executable in this scenario.
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).
Surely it would have to be a copy/put into a cpu register
I'll bet the Fourier transform is up there. Especially if you count the hardware implementations.
NOP - placeholder for every 'wait for user input' code everywhere.
The poor poster did say "regarless of CPU type", but I think he mean SILICON hardware, not biological hardware.
Because we know there's nothing like that in the Linux kernel...
There are 99x more Windows computers than x86-based Linux computers, and they've been running a lot of the same code for 15 years.
Thus, in the question What's the Most Often-Run Piece of Code -- Ever? the answer is probably related to Windows.
"I don't know, therefore Aliens" Wafflebox1
; /*noop*/
The counters in digital clocks have furiously been counting clock ticks to the next second since the '70s, if not earlier.
I do not fail; I succeed at finding out what does not work.
Clearly has to be a machine code timing loop. Pick the CPU of your choice but
LOAD register, x
DEC register
JUMPIFNOTZERO -1 (or -2 or other value depending how things are wired).
Some processors will combine the DEC and JUMP commands, some will perform the loop as a jump over a hard-goto if the test *is* zero but doing nothing for a fixed amount of time is needed on all but fancy-pants CPUs with their multitasking and stuff.
The C code while() ends up running cpu microcode, as does for(), printf(), and all other C.
Thus, the microcode is run most often.
The microcode isn't written in assembler, it's written in micro-machine code, which is much lower level than assembler.
Something mice installed.
I talked to a guy who writes floating point optimization for Apple. He estimated that 10% of processor time of all Apple products in the last 10 years or so was just his code, running over and over. So I'd guess it's probably something like that.
It's the code that the Obama administration uses to inject subliminal messages into all video to indoctrinate our children into the homosexual agenda.
-
- - You can't take something off the Internet! That's like trying to take pee out of a swimming pool.
If we're counting number of clock cycles consumed rather than wall clock execution time then I'd say the NAG Fortran FFT library.
As far as functions, I'd say bcopy().
Technically, all code of any kind winds up being executed as microcode.
Fair enough, I just assumed this post meant higher then ASM. However you'd also have to find the three most used lines.
Some suggestions:-
I'm betting on Windows it is probably something to the effect of:
MSG msg;
while(GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
This loop is called even when the CPU goes idle, in order to implement the OnIdle call in MFC. My second guess would be the code inside the GDI BitBlt call.
I meant to add on CISC processors at least. RISC and VLIW CPUs do not use microcode.
10 PRINT "If you read this you're stupid"
20 GOTO 10
10 GOTO 10 ;)
Certainly not.
There are plenty of processors that don't have micro code but execute machine code in hardware alone.
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
If ()
See my addendum.
I'll go with the Google Analytics tracking code. It's on virtually every large site and any device that supports javascript runs it every time a click happens. Sometimes even more.
..by far. this would be more interresting as a poll, BTW! :)
Every computer science student for decades was taught how to write a bubble sort, as an example of sorting algorithms. Never mind that it is hard to imagine a more inefficient algorithm. And never mind that it isn't even a very intuitive way to sort a list of objects. Every student learned it anyway, and many of them probably took it with them to their future employers.
It’s not really executable as I understand it, but I am not a biologist. The translation from DNA to RNA is hard to construe as ‘execution’. Then in the next step the RNA goes to ribosomes to construct proteins. So maybe DNA is ‘compiled’?
The field of computational biology would probably have a good metaphor to map the ideas from biology to computer science.
As I understand it, gene expression is where the DNA code is interpreted and appropriate cells with appropriate properties are then created. Expressing the DNA (make this a skin cell with these properties) would be execution, wouldn't it?
DNA is a markup language for proteins. RNA is like javascript and CSS. Cells are like self-replicating web pages.
Possibly a small piece of sensor code in a major automaker's engine computers. These are very conservatively built -- probably there are large chunks of code that haven't changed since engine computers appeared in 1980 or so. They're very common -- probably hundreds of millions have been built. And they run the same code constantly over and over, every moment the car is running.
The main reason I might be wrong is that the clock speeds for these engine computers are presumably pretty slow.
The most often run piece of code EVER? Depending on the CPU, it'd be the equivalent of either HLT or NOP.
Think of how often our PCs are idle! HLT gets called all the time! Yeah, I know, I'm breaking the non-assembler rule, but I'm too lazy to look up how that'd be encoded on x86 and x86-64.
10 cls
20 goto 30
30 goto 10
kernel idle loop is a good candidate.
I reckon it's likely to be one of two things... either some variation of 1d convolution, for applying fixed-impulse response filters, which basically boils down to:
for (i=0;i<N;i++) {
for (j=0;j<M;j++) {
y[i] += x[i - j] * h[j];
}
}
The other candidate that makes sense is the Fast-Fourier-Transform code, which transforms between time-domain signals (amplitude/time) and frequency domain (frequency/amplitude) signals in O(n log n) time.
Both are key signal processing algorithms that are used in some form almost everywhere. Cell phones use them extensively for handling both audio and radio signal process, and nowadays for signals from other internal sensors like GPS, accelerometers, gyros and magnetometers. Virtually all network links 'use' these techniques at some point when processing analogue signals optimised for their transport medium... WiFi, cable, ADSL, and fibre-links all use these techniques. Add to this all the other embedded devices you use that connect with something in the real-world: everything from hard-drives to cars to TVs...
You might have a few gadgets, but those gadgets probably contain smaller-gadgets that each spend most of their life running a simple signal processing loop...
What about the code that handles tcp/ip decoding /encoding?
No word can describe.
makes the blue screen come up.
Special instructions for IE 6 here
You need to be punched in the face repeatedly. It should keep happening until your face caves in.
Which ever code handles the interrupt called by pressing ctl+alt+del.
compiled, and the protein is executed out of order and asynchronously. Neato parallel processing!
most useful functions will make at least 1 syscall
A = B
It has to be the idle loop in the most popular operating systems. For all we think we suck every single tick of CPU power out of our machines, in actual fact most of their time is spent idling. That has to be the most frequently run code in the world.
Seven puppies were harmed during the making of this post.
Turns out it's the injectPacket() function that the NSA uses on the DSP inside every USB connector ever manufactured.
gets my vote.
-Hackus
Got Geometrodynamics? Awe, too hard to figure out? Too bad.
Ummm, the most executed C code, ever, is probably known as "walk the dog": it wastes a little time.
The MOST executed code ever, is probably assembly:
NOP
NOP
NOP
It's not compiled, it's interpreted. If you had a single gigantic mRNA consisting of all your genes, that would be compilation.
You can think of DNA as source (in an extremely low-level language), mRNA as machine code, and ribosomes as microcontrollers. DNA transcriptase interprets DNA into RNA. In eukaryotes, SNRPs are optimizers (written by a lunatic, but no analogy is perfect) that rearrange the RNA; ribosomes interpret the RNA.
You've got lots of ribosomes in each cell, so think of each cell as a massively multi-core architecture running a totally asynchronous program.
So what's the most frequently interpreted gene? Most likely something used by bacteria, since those are the most numerous cells on the planet. Or maybe a routine that's common to all cells. Something that regulates cell division?
Note that a lot of the stuff that cells do most frequently (say, transport a hydrogen ion across a membrane) does not require DNA synthesis each time. The instructions in DNA are in large part "build a machine out of protein"; there are also a lot of genes involved in *managing* the machine but not much involved in *operating* the machine, if you see what I'm driving at. Obviously, after cell division you need to synthesize more stuff to replace what you've lost (otherwise you'd shrink away to nothing after surprisingly few divisions), but you basically need to sythesize everything; I'm not sure one gene would stand out.
There are specialized cases where a cell needs to synthesize LOTS of something; salivary glands in insects for example make lots of extra copies of the genes for certain enzymes; some plants do something similar to synthesize various chemicals. But these cases are probably outnumbered by bacteria.
Which is probably used by several other windows program to display their stack traces too.
Nuff said...
For those of you who keep suggesting NOP or NOOP as the answer:
"What piece of code, in a non-assembler format, has been run the most often"
IN NON-ASSEMBLER FORMAT.
LERN 2 REED D1CK SHITS!
Most executed code could then moved to microprocessor instruction set.
I'd really like to know what microcontroller was used in appliances in the 60s. Yes, I can answer that question for the early 70s....but 60s?
fopen()
fread()
fclose()it's did by all computer since long long time
(if it's not, it could be the ctrl alt del routine^^)
Kind of depends how you define "execute." DNA contains control structures, and coding regions. It gets copied, and then used as a blueprint for making proteins (ribosomes are the "CPU" for this and are basically a combination of proteins and RNA). Then the proteins themselves do things.
RNA is an interesting sub-example, because it can be functional as well as a blueprint at the same time. Many think that life started out with RNA as a result, and the ribosome is found in all living organisms and is dependent on RNA for its operation. Even in humans the RNA is basically just a copy of some piece of DNA.
Now, just how often DNA is "executed" is another matter. When you talk about chemicals binding to it the "clock speeds" could be seen as being very fast, as these chemicals are constantly binding and unbinding all the time. When you talk about the process of copying DNA or making proteins out of it, the speed isn't all that fast. Google suggests that the rate is about 500 bases per minute. A base contains 2 bits worth of information, so that is 16bps. DNA replication is about 60x faster. However, biological processes are highly parallelized - at any time a cell might be transcribing hundreds of genes, and especially in bacteria there might be many copies of the same gene being created in parallel at once, and many proteins being made at once off of each copy. When a eukaryote replicates its DNA it copies it from numerous points at once. And then of course an animal is made of billions of cells on top of that.
So, compared to a modern CPU many information-processing functions in the cell are incredibly slow. However, they're also incredibly parallel and asynchronous.
the BSoD stack dump...
TIme is your friend here. The longer the object using the code exists the better. It helps if your code survives across several models. This means a piece of code which is fundamental, simple to write and error free that gets saved for the next version. It should be associated with a product/service that is ubiquitous., but also provided by a monopoly so the service is not seperated among several code bases. Everything said so far means it is very likely C, definitely preANSI but maybe even preK&R. So very likey it is something in a 5ESS SM especially if the code goes back to 4ESS or further[1], the two most obvious -- in the code that scans for open lines the function which detects whether or not a line is open. If there is no such scanning code, then something in the database call that looks up a number when a digit is pressed. [1] It would be given a big boost if it were siomething that was written before switch code was split into US/International veersions.
Genetic code is executed all the time in Texas.
Probably some "get" command.
Shoes for Industry. Shoes for the Dead.
I think the winner would be -
print("Hello world");
When I was 16 I once got thrown out of a computer show for something very similar...
The dangers of excessive individualism are nothing compared to the oppressiveness of excessive collectivism
I imagine the creation of a TCP packet would mostly use a very similar routine regardless of the platform OS or hardware.
Or maybe the transferring of a packet.
Very likely the inner loop of something that can't be discussed.
Answers like this make Slashdot great. :-)
You could break it down further to look at the lower-level "operations" being performed.
In order to see if the next amino acid should be a glutamine instead of an asparagine, each of the two are going to be bounced into the active site to see if they "fit": if they fit, they're incorporated and if not, they bounce out and the next one is tried.
So you could think of this as an if, else repeated really ridiculously quickly: at the speed of molecular diffusion, minus just a tiny bit. That makes it both extremely fast and extremely parallel, as you observe.
As a side note, nearly ever molecular interaction operates in this way, unless a substrate is literally "handed-off" between two enzymes. That would definitely make a molecular recognition operation the most highly "executed" routine (at least down to that scale) by untold orders of magnitude.
That's got to be the same on any platform, yes? Even the simplest user surfs the web.
Counting lines code is a bit pointless, since no language is given and the effects of 3 lines of code can range from nothing to infinite execution.
Much more interesting would be what sequence of three instructions is most often executed disregarding NOPs and stalls.
The answer would probably be some combination of a goto, compare and addition.
Or alternatively a store, call and addition.
0 or 1. Not sure which is executed more. Probably 0.
Unless malware is declining these days.
You are being MICROattacked, from various angles, in a SOFT manner.
Either that or the Ctl-Alt-Delete stuff
"xor eax, eax"
Bash runs on most every platform, from mainframes to Macs to phones and tablets and Raspberry PIs. And unnumbered embedded systems. It's the Duct Tape of computing, executing daily and hourly scheduled jobs on millions of computers. Routers have it. DVRs have it. Even digital cameras have it. Brian Fox created bash to serve as a universal open source substrate for portable systems. It has performed better at this role than anyone could have hoped.
good call on the frame buffer loop
I have a thought it may be a router command somewhere in the OSI model ;)
Thank you Dave Raggett
followed closely by...
Java.InstallUpdate()
It's got to be the router or switch that runs Dijkstra's algorythm on every packet that gets sent through any router or switch anywhere ever.
The code varies by router type, network topology, etc etc, but the code would fit into 3 lines.
Everythign from the Application Layer of the TC/IP suite has this algorythm done on it, including HTTP and SMS.
I cant figure it now but it has to rival the option I saw above for the monitor refresh program & the windoze system idle process
Thank you Dave Raggett
Apparently, the TRON family of operating systems one of the most popular operating system families in the world, embedded in literally billions of devices. Sure, all those devices are probably quite slow, but they're also probably running around the clock, mostly looping in some idle loop. So I wouldn't be surprised to find out that it has the most-executed sequential code.
If you consider RTL (register transfer language) to be code, then I'm sure one of the state machines at the heart of the fastest, most prevalent CPU family is well in the lead. It could be the state machine that selects instructions to dispatch, the state machine that retires results, the state machine that fetches instructions, the branch predictor state machine... If a given state machine gets reused over many products in a family, that acts as a multiplier. If it's part of a core that gets replicated many, many times (such as a GPU core), that also acts as a multiplier. Of course, GPUs will clock down and power down cores aggressively when not needed.
Program Intellivision!
...but how many folks understand the significance of this?
@(posedge clk)
{
a = b;
}
Anyone think about microcode running inside modern CPUs?
They're practically miniature computers themselves.
Whichever code snippit is critical to porn.
As the number of total instructions computed increases geometrically world-wide, any current standard OS instruction would be a candidate. And by current, I mean now. No, right now. Right...now. Now. No, ... now.
A more interesting question is what is the oldest line of code running in a real-world context, or something along that line of questioning. For the current question, oldest will most likely not be the most.
Since some businesses have held on to their COBOL systems, I would imagine there is a common COBOL function that has been called since COBOL was invented and is still running in a an application in some financial institution, maybe on the very same mainframe.
Saw it later, but its still wrong :) old 8bit CISCs (if you can call that CISC) prozessors, like a 6502, often had no microcode.
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
Ok maybe not : )
var birth = x;
var death = y;
Function existence(birth,death) {
for( birth = 0; birth < death; birth++; ){
Sleep;
Eat;
Fuck;
}
return death;
}
while (1)
/* NOTREACHED */
tsleep(&proc0, PVM, "scheduler", 0);
tsleep(&proc0, PVM, "scheduler", 0);
tsleep(&proc0, PVM, "scheduler", 0);
tsleep(&proc0, PVM, "scheduler", 0);
tsleep(&proc0, PVM, "scheduler", 0);
tsleep(&proc0, PVM, "scheduler", 0);
tsleep(&proc0, PVM, "scheduler", 0);
tsleep(&proc0, PVM, "scheduler", 0);
That should speed things up a little.
Maybe not that, exactly. But some code to do with the assembly / disassembly of comms packets.
politicians are like babies' nappies: they should both be changed regularly and for the same reasons
It's the code that calculates the results from each molecular interaction.
The majority of instructions are NOT MICROCODED.
... that pops up and asks you if you would like to send an error report to Microsoft or just dismiss the dialog.
... the boot sequence?
Windows Vista rewrote the graphics system from scratch. That was one of the reasons it was hated so much - WDDM drivers are difficult to write and NVIDIA/ATI failed to provide stable drivers on time.
I'm guessing it will be something dealing with ginormous data streams. The something at the LHC, NSA, internet core routers...
:-)
Because we know there's nothing like that in the Linux kernel...
Well, we could look at the source code and find out.
But you perhaps meant that all instructions are executed as micro-operations? That would be true for x86 and most RISC machines but not all RISC or CISC processors. Most popular processors do convert the instruction set architecture instructions into one or more internal micro operations as that is often the most efficient way to execute existing code. And that includes RISC processors.
That's what I would guess. Endless loops don't qualify since they run for a long time, but they aren't run often (especially endless loops that don't do anything else).
He wants to patent these three lines of code, and he will succeed! We are so screwed :)
I've heard it runs a lot. My vote was going to be Windows System Idle process. Graphics cards might top that but I have no idea how many are running the same code
First, let's agree on some observations:
ref. http://www.top500.org/ ->Statistics for more details; so, here we talk about big machines, of high duty cycle, of using mostly a uniform API for synchronization.
Given Weather, Climate & Computational Fluid Dynamics codes (and some more), the temporal density of such calls is pretty good.
Concluding, MPI should be the most common *API* being called nowadays per unit of time;
there is still room for challenging this though: MPI Send/Recv calls have a few variants plus,
MPI stack implementors may have fragmented the codebase, to declare a clear winner...
NOP.
srsly.
They don't run code you uninformed clod. The algortithm is just expressed in combinatory logic. That is what they get their speed from.
Returning from a routine (sub or main) on an IBM mainframe or PC (plug compatible) will have happened billions of times before the other PC was even invented. That head start may have been eclipsed by later, more widespread, architectures, but we'd need an intern at a tech job interview to estimate when that happened.
LM 14,12, 12(13) restore content
SLR 15,14 set completion code to zero (implies success)
BR 14 return to caller/op sys
While most types of hepatitis are caused by viruses, autoimmune Hepatitis is not. This specific type of hepatitis happens when a persons immune system attacks the liver cells. AIH is a condition that is chronic and can end up causing cirrhosis of the liver, which then leads to liver failure. The two different types affect different age groups. The first is type I, which is the most common and usually affects younger women. It is also not associated with any other type of autoimmune disease. The second id type II, which normally affects girls between the ages of two and fourteen.
Hands down it will be packet input/output handler in the cisco IOS running on routers. Most of the network devices in Internet Backbone, Internet Exchange, Tier-1 networks, Tier-2 networks are cisco devices. So when any packet is generated/sent across the internet(google search, FB page, slashdot page, news, torrents, photo uploads, whatsapp messages, TOR, Deep Web) the same packet handler routines get invoked, even though it can be different versions of Cisco IOS versions or different device drivers on different cisco products. Also, apart from this most of the networking devices in MNCs(enterprises), Service Providers, Data Centers, Mobile networks, Security are cisco devices running the same packet handler routines.
1. Sum (Fi) = 0;
2. F = dp / ft;
3. Fa = -Fb.
And not only on this planet...
The code that causes a BSoD
part of the new clear kode still misused constantly & in alpha beta... free the innocent stem cells the kode of life extension... kreme of the kode contest rages on....
has to be the most executed code ever.
Perhaps it would be better to stop thinking that the genetic mechanisms that predate human intelligence by billions of years just happen to follow our clever little computing designs? That sort of "Cool! It works just like a computer!" thinking has stymied human understanding of cognition for the past 60 years.
My money is on it being the boilerplate code that formed the main event loop of every Windows program recently.
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
while(GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
All those moments will be lost in time, like tears in rain.
Almost every Windows corporate PC has been running a logon.bat script at least once a day for the last twenty years.
Now every logon.bat is different, but if we are playing loose with the semantics...
--- Generation X: The first generation to have SIG lines inferior to their parents... ---
A check for null is probably the #1 most executed line of code ever. Especially in today's Android-style environments where everything is asynchronous, and you're always checking to see if an object is either initialized or still around. C code is constantly walking strings checking for null. C code also counts down to null.
BSOD message handler?
I'd say either the patch code or the reboot code?
This might actually be the correct answer. The DNA code that compiles to the DNA compiler/interpreter, gets run all the time in every f'ing organism there is, and is practically the same everywhere. +1
IN any language:
Temp=A;
A=B;
B=Temp
This is at the heart of a sorting algorithms and change of context routines for operating systems.
In assembler, Temp would be a CPU register.
int C = A; A = B; B = C; Though I like to write the swap: A += B; B = A - B; A = A - B;
I'd say anything related to reading from a binary tree. This is used as part of a Huffman style decoding for MPEG/JPEG/ZIP/etc. Most media we consume today (DVD, MP3's, M4V's, HDTV, etc.) relies on this kind of logic.
The majority of US homes (75%) have an HDTV, DVD and one or more portable media devices. Most of these homes have at least 3 hrs of HDTV decoding per day, which given the current population might be 1.5 billion hours of decoding per day in the US. Factor in music and multiple TV's you might be closer to 3-5 billion hours per day.
Eric Sarjeant
eric[@]sarjeant.com
next post
is post anti microsoft?
yes - mod up
no - mod down
loop
slashdot troll = you make a compelling argument I do not like the implications of.
over and over and...
It is a requirement for any large matrix inversion to run efficiently, and large matrix inversion is the fundamentals behind all big science computes including what goes on at national labs. Though I do not know what the code is, I strongly suspect that this is the single code, likely from a Fortran library, that has run most on the biggest supercomputers on the planet.
Compilers use pretty boilerplate code for setting up functions as outlined in the dragon book. Every time a function is called, a pretty boilerplate piece of assembly sets up the function input, local variables, etc. Since every function ever written ends up using this boilerplate assembly code, it is easily the most called code of all time.
It’s not really executable as I understand it,
Oh, it's definitely executable. Living things get executed all the time.
alert('test');
We're looking for a CPU that has the following properties:
1) it runs a tight wait loop when idle
2) high CPU clock speeds
3) high number of them in the wild
4) it's not turned off for power management reasons
Now, I'm just guessing, but the winner may be the "waiting for command" loop on datacenter type disk drives. In many implementations it's a tight loop (sometimes empty waiting for command arrival interrupt), the clock speeds are about 400mhz (which while it isn't THAT much leads to millions of iterations per second), there's a CRAPLOAD of them out there, and the datacenter type drives don't generally have power management that turns them off the drive CPU. Whereas laptop drives, system main CPUs, and GPUs all do get power managed.
So disk drive firmware engineers may in fact deserve the trophy.
I'd have said a standard library which calculates leap years. The sheer amount of devices that has been ported to, and the frequency of execution, has to be pretty goddamn huge.
It's no op. Used to be on the old machines you could see the instruction being executed. Check out an HP-3000 Series III. After a while you'd see just one pattern until someone decided to do something else. Looking at the decode book, it was noop. Looking at utilization data for big data centers I'm sure that's true today. Most machines are well over 90% idle.
Windows 98 idle loop didn't use HALT, small "cooling" apps were written on purpose to implement it. Does this bring back the "os idle loop" as a candidate for the most run piece of code?
As the computer said, when they asked it to determine the meaning of the universe, "There is insufficient information for a meaningful answer".
A classic SF reference, which I don't remember at the moment...
10 clr
20 Print"HELLO WORLD. ";:Goto 20
I'd be willing to bet money that it's somewhere in the Linux kernel, since Linux has about ~80% of the world smartphone sales (android), a majority of the server market, and so far as I can tell, all 500 of the top 500 supercomputers in the world (as of November 2013, look at the actual list, not the summaries), and has had a majority of the top 500 supercomputers for the past 8-10 years.
Allahmerica!!!
The answer is the zlib library. You bore the world with your inane question.
How is idle loop and stdio.h not the right answer?
Cool, thanks!
It might be somewhere in the Network Stack of some Internet backbone router? Or some code shared by Network stack of multiple Oses? The code would have to run continuously on so many devices for *every* *packet* going through? May be sometimes multiple times for the same packet! Firewall ? Routing algorithm?
That moves code and data between memory and the processor cache when there is a cache miss.
My ism, it's full of beliefs.
hello world
I compiled the most interesting answers (in no particular order):
1) OS kernel context-switching
2) Windows System Idle Code: But Some are pointing out that modern version are actually halting the CPU and are used to implement power saving.
3) Graphic processing: GPU code for pixel rendering, codec
4) Network functions. Linux TCP function (which include all Android phone). Others are pointing to the code in Cisco Routers OS processing most of the internet traffic.
5) MPI API (send/recv) (http://en.wikipedia.org/wiki/Message_Passing_Interface)
6) Fast Fourier transformation (FFT) FFT/DFT/DCT processing code.
7) Clock checking code.
Not sure of the winner.
I nominate something in the TCP stack. Didn't Intel at one point propose making a checksum or similar algorithm an x86 instruction primitive? Their point was, it was heavily used and didn't seem too likely to change. There was a lot of pushback from the rest of the IT though.
Anyhow with TCP being the network system that ate all others, and that only likely to grow with the Internet of Things, the TCP stack seems like a good bet.
It's probably
bool somVar = someFunction();
// some code
// some code
// Lots of code
if( someVar == true ) {
}
else if( someVar == false ) {
}
else {
}
Well, when you get down to that level it is a bit less deterministic than your illustration makes it sound like. The ribosome doesn't try out one tRNA after another per-se - it just makes it really easy for a peptide bond to form if the codon matches well. There is some rate at which incorrect amino acids are added (well, a rate for every combination of tRNA and mRNA sequence/position), and a much higher rate at which correct ones are added. Incorrect and correct amino acids can also be removed, and I imagine the rate of the former is high and the rate of the latter is low. All of this ends up resulting in peptides being formed correctly.
When you get down to the atomic level it is all probabilities and kinetics, even in computer chips. There is some probability that a 1 stored in a RAM chip will get read as a 0, but the circuitry operates at a scale/speed/etc where that probability is very low. Biological systems tend not to use quite the same level of "digitization" and so mistakes are much more common, but then again when a cell cranks out a protein it doesn't just crank out one, so if on occasion one has a defect it is usually no big deal.
10 PRINT "HELLO"
20 GOTO 10
Maybe for x86 and onward microsoft based mouse code considering you use the mouse nonstop practically. Alternately it would be anything dealing with ASCII generated from the keyboard.
Everyone who ever learned to program wrote this code
10 print "Hello World"
run
If it's in an ASIC, it's not actually code is it? Otherwise the "code" would probably be some microcode inside Intel CPUs.