Slashdot Mirror


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?"

533 comments

  1. For / While in C by Murdoch5 · · Score: 5, Funny

    for(;;){
    }

    OR

    while(1){
    }

    Starts all main control loops and all kernels.

    1. Re:For / While in C by kav2k · · Score: 1

      Fails the 3-line minimum.

    2. Re:For / While in C by Anonymous Coward · · Score: 0

      Which one does the Linux kernel use?

    3. Re:For / While in C by Ragzouken · · Score: 5, Funny

      for(;;)
      {
      }

      while(1)
      {
      }

    4. Re: For / While in C by Anonymous Coward · · Score: 0

      The network stack driver code.

    5. Re:For / While in C by hcs_$reboot · · Score: 1

      int main(int argc, char **argv) {
      ...
      return 0;
      }

      --
      Slashdot, fix the reply notifications... You won't get away with it...
    6. Re:For / While in C by Murdoch5 · · Score: 1

      Not really, if you do:
      for(;;)
      {
      }

      you get 3. I'm sure that has to be the most executed sequence.

    7. Re:For / While in C by Murdoch5 · · Score: 1

      Maybe but most control systems wouldn't make main return int. Best practice in embedded programming is to make main return void, because you use a custom linker.

    8. Re: For / While in C by Anonymous Coward · · 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.

    9. Re:For / While in C by Anonymous Coward · · Score: 0

      I have never seen an embedded linker that doesn't follow ANSI C... I feel sorry for you.

    10. Re:For / While in C by Chris+Mattern · · Score: 1

      That actually breaks the C standard, but I suppose control systems aren't much worried about portability.

    11. Re:For / While in C by Anonymous Coward · · Score: 0

      i++;

    12. Re:For / While in C by Murdoch5 · · Score: 1

      Well the theory is that in a control system main is the only entry to the entire system, so you never have to go anywhere else and hence never return form the entry, so main can be void.

    13. Re:For / While in C by someone1234 · · Score: 1

      TFA: "let's set a lower limit of 3 consecutive lines."

      --
      Patents Drive Free Software as Hurricanes Drive Construction Industry
    14. Re:For / While in C by Dahan · · Score: 5, Informative

      That actually breaks the C standard, but I suppose control systems aren't much worried about portability.

      The ANSI C standard defines two types of implementations: "hosted" and "freestanding". An embedded system would most likely be considered a freestanding implementation, in which case, the entry point function can be whatever the implementation defines it to be. It might not even be named "main" (but if it is, it could return void if that's what the implementation says). That said, C99 allows main() to return void, even in a hosted implementation: 5.1.2.2.1 gives "some other implementation-defined manner." as one of the options for main's definition. It notes in 5.1.2.2.3 that "If the return type is not compatible with int, the termination status returned to the host environment is unspecified."

    15. Re:For / While in C by vbraga · · Score: 1, Troll

      And the Language Lawyer Award goes to ...

      --
      English is not my first language. Corrections and suggestions are welcome.
    16. Re:For / While in C by Immerman · · Score: 1

      come on now, three line minimum. That should be:
      i
      =
      i+1;
      Though granted that's a rephrasing of ++i rather than i++

      --
      --- Most topics have many sides worth arguing, allow me to take one opposite you.
    17. Re:For / While in C by ConstantineM · · Score: 2

      Which one does the Linux kernel use?

      Not sure, but OpenBSD has this at the very end of its main():

      while (1)
      tsleep(&proc0, PVM, "scheduler", 0);
      /* NOTREACHED */

      I tried finding the FreeBSD equivalent, but their (Newbus?) code makes it entirely non-obvious where the loop is. Feel free to try your luck — only the comment to what the startup function is supposed to do matches, but the rest is quite unique, even a different function name — mi_startup() on FreeBSD.

    18. Re:For / While in C by Anonymous Coward · · Score: 0

      And the Language Lawyer Award goes to ...

      You will find the best programmers to be the "language lawyers." It means a complete understanding of the toolchain and runtime environment.

    19. Re:For / While in C by Anonymous Coward · · Score: 2, Interesting

      I wouldn't trust any C programmer who doesn't have a copy of the standard on his desktop (actual or digital).

      Unlike most standards it's concise and well organized. If you're too lazy to familiarize yourself with it, you're too lazy to write good C code.

    20. Re:For / While in C by constpointertoconst · · Score: 1

      ++
      i
      ;

      whitespace is whitespace

      Or if you prefer a variant with the same number of characters per line:

      +\
      +\
      i;

    21. Re: For / While in C by Molt · · Score: 1

      I was thinking pixel shader too, likely a commonly-used part of one of the standard lighting models, or a part of a blend function used for desktop compositing. When a shader's running at a relatively sedate 1920x1200 60Hz we're talking 138,240,000 executions per minute per machine- and that's if it's only executed once per pixel per frame, if it's a per-light piece of code then it could well be executed many times as often.

      --
      404 Not Found: No such file or resource as '.sig'
    22. Re: For / While in C by Impy+the+Impiuos+Imp · · Score: 1

      That was my first guess -- something deep inside a GPU, cloned across hundreds of millions of computers and consoles, cranking out quadrillions or quintillions of triangles a second.

      --
      (-1: Post disagrees with my already-settled worldview) is not a valid mod option.
    23. Re:For / While in C by Immerman · · Score: 1

      I do believe you've won - I can't think of any three lines worth of code executed more often than that. Except possibly the wastefully bloated
      i
      ++
      ;

      --
      --- Most topics have many sides worth arguing, allow me to take one opposite you.
    24. Re: For / While in C by drkim · · Score: 2, Interesting

      I don't anything about the code that runs in digital watches, but maybe the code that says:

      Is it time to trigger the alarm yet?
      Yes? Trigger the alarm
      No, check the time again.

      I just imagine with the sheer number of watches, cel phones, microwaves, DVRs, etc. out there this would be the most ubiquitous, and constantly running, bit of code.

    25. Re:For / While in C by kst · · Score: 1

      Nitpick: The C standard is published by ISO; ANSI adopts each new version as it comes out.

      All three editions of the ISO C standard (1990, 1999, and 2011) permit main to have an implementation-defined type.

      Only "int main(void)" and "int main(int argc, char *argv[])" (or equivalent) are required to be supported by all C implementations -- and that applies only to hosted implementations. For freestanding implementations, the program entry point is entirely implementation-defined.

    26. Re: For / While in C by RightwingNutjob · · Score: 2

      Code is a generous word. In most alarm clocks and wristwatches, this sort of thing is likely implemented in discrete logic gates, which I would say goes a little against the spirit of the rules.

    27. Re: For / While in C by iggymanz · · Score: 1

      i wonder if that's true anymore, little 8 bit microcontrollers with 4kb of flash are less than 50 cents each in bulk

    28. Re: For / While in C by Anonymous Coward · · Score: 1

      Specifically this line here:
      someValue = tex2d(someTexture, someCoord);

      That's HLSL (Direct X's shader language), it samples a pixel out of a texture and we really love our textures. There's typically a minimum of one of these per pixel per frame but the average is around 10ish in todays really well optimized renderers.

      Doing the math that is for let's say a kind of low estimate:
      1,280 * 720 * 10 = 9,216,000 per frame

      And assuming a modern 30FPS game that's:
      9,216,000 * 30 = 276,480,000 per second

      And an average playtime of 2 hours per day:
      276,480,000 * 60 seconds * 60 minutes * 2 hours = 1,990,656,000,000 per day per user

      Let's assume only 25% of the US population plays games for 2 hours a day:
      1,990,656,000,000 * 313,000,000 * 0.10 = 155,768,832,000,000,000,000,000,000,000 per day in the US alone

      Now to really blow that out of the way. A modern game tends to do 3 of those lines per pixel on an object. We can safely assume opaque objects are drawn front to back resulting in very minimal to no overdraw (drawing of pixels that just get covered up later). Then there are transparent objects which tend to need to be drawn back to front over the drawn opaque scene. Then there are post process effects that vary but for film-like effects your looking at upward to 50 samples per pixel per frame after the scene itself is drawn.

      That's also only for a 720HD resolution, which I suspect most gamers have better monitors than that.

    29. Re: For / While in C by SydShamino · · Score: 2, Interesting

      Lines of code I've written in HDL execute in hardware once every clock cycle, at, say 100 MHz on maybe 50,000 devices for at least a few years of active use each. That's like 3x10^20 executions alone, and I work for a specialty hardware company which has only sold ~50,000 devices I've designed over the past 13+ years. I'm quite certain other hardware developers have far, far more, and the original question doesn't necessarily seem to require code that executes in a processor versus inferring hardware.

      (And yes, there's one file that I've conveyed from project to project for everything I've designed. It generates a 100 ns time base - a one-clock-cycle-wide pulse every 100 ns - regardless of the clock frequency. It adds a little jitter to synchronize to the time base but makes it easier to change the clock frequency without breaking other real-time dependent timers.)

      --
      It doesn't hurt to be nice.
    30. Re:For / While in C by FatdogHaiku · · Score: 5, Funny

      Since no line "maximum" was defined I have to vote for SVCHOST running Windows update on XP....
      it keeps going and going and going...

      --
      You have the right to remain sentient. If you give up the right to remain sentient, you will be elected to public office
    31. Re:For / While in C by Anonymous Coward · · Score: 0

      ANSI C is fine with main() returning void. You just can't declare it that way.

    32. Re:For / While in C by ILongForDarkness · · Score: 1

      Oh snap :)

    33. Re: For / While in C by smash · · Score: 1

      Yup. Modern GPUs run at high clock rates, and regularly at 100% load for long periods of time, doing relatively simple, repetitive processes.

      I was going to suggest perhaps some ray-tracing code used by say, Pixar, but the army of modern GPUs in regular gaming machines probably tops that.

      --
      I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
    34. Re: For / While in C by Zmobie · · Score: 5, Interesting

      I work with a ton of electrical/controls engineers. Yes it is still probably true, mostly because it is still even cheaper/easier to do this through ladder logic. I forget the context of what we were talking about one day, but one day while talking to one of our SENIOR (30+ years) controls engineers I was explaining some logic that if we had to implement it in C# would take probably 300 lines of code. His reply was simply, psh, I could do that in 3 rungs, don't bother.

    35. Re: For / While in C by HappyPsycho · · Score: 1

      Quite true which hints at what may be the real winner, maybe timer interrupts? Anything with a RTC has some sort of trigger for clock 'ticks' which generate these ticks wheter you use / care about them or not.

    36. Re:For / While in C by AK+Marc · · Score: 1

      If
      then
      else

    37. Re:For / While in C by richy+freeway · · Score: 1
    38. Re:For / While in C by Anonymous Coward · · Score: 0

      This is the kind of pedantic crap that turns fledgling programmers off to C.

      I mean, seriously, who gives a shit whether you return something or not? You should just be able to put in a "return" statement, or don't. The language should take care of this. Who needs one more stupid irrelevant detail to remember, just to get your code to compile cleanly? Jeezus fuckin' Keyrist.

    39. Re:For / While in C by stenvar · · Score: 1

      That actually breaks the C standard, but I suppose control systems aren't much worried about portability.

      No, it doesn't. You're free to declare any return type for main, but if it isn't an "int" then the value returned to the environment is undefined. See Section 5.1.2.2.3. Having undefined values in a program doesn't break the standard, and it doesn't even automatically break portability (i.e., almost every correct C program contains undefined values somewhere, they simply don't matter).

    40. Re: For / While in C by SuricouRaven · · Score: 1

      They probably use CPUs rather than GPUs, or if they do use GPUs they'll be using OpenCL or CUDA code rather than the graphics API.

      Graphics cards are made provide maximum speed at the expense of quality and flexibility. Not what you want when making a movie.

    41. Re:For / While in C by Anonymous Coward · · Score: 0

      Since no line "maximum" was defined I have to vote for SVCHOST running Windows update on XP....
      it keeps going and going and going...

      I so have to second this! Yesterday installed a fresh Win 7 workstation, it took 5 ( YES FIVE ) hours of continuous updating and rebooting before it could say: You are running the latest version. Probably should have installed a Service Pack to begin with, but still this is a bit crazy ! :)

    42. Re:For / While in C by beelsebob · · Score: 1

      He said C. ++i and i++ are the same thing.

    43. Re:For / While in C by jones_supa · · Score: 1

      Huh? No, they aren't.

      ++i increments the value and returns the incremented value.
      i++ increments the value and returns the old value.

    44. Re:For / While in C by jones_supa · · Score: 5, Informative

      Since no line "maximum" was defined I have to vote for SVCHOST running Windows update on XP....

      Just to be accurate... we are shooting the messenger if we blame the SVCHOST process here. It runs various services. The faulty code was in the Windows Update service (wuauserv).

      You can see all the respective services with the command tasklist /svc .

    45. Re: For / While in C by zAPPzAPP · · Score: 1

      This would usually happen in (microcontroller-)hardware, not in code:
      a hardware counter (running on a specified timebase) and a hardware interupt.

      The code which would be in every watch would be the one for loading the counter, but it would not be the same in every watch, as it would differ depending on clock frequency and controller used.

    46. Re:For / While in C by allo · · Score: 1

      i++,
      and
      ++i;

      Are the same.
      array[++i] is another thing ...

    47. Re: For / While in C by allo · · Score: 1

      i guess a microcontroller has less precision

    48. Re:For / While in C by jones_supa · · Score: 1

      Sure...if there is no other code in the statement, it does not make any observable difference.

      But for example, while(i++) and while(++i) produce different results in C.

    49. Re: For / While in C by smash · · Score: 1

      Yeah i didn't mean to imply that pixar uses GPU rendering. Merely that when i was thinking about the most executed code in existance, it would be to do with rendering in some way. But GPU rendering in desktop machines worldwide probably trumps ray tracing on CPUs (or whatever) in the movie industry due to sheer number of users.

      --
      I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
    50. Re: For / While in C by AmiMoJo · · Score: 1

      I have written clock code for embedded systems. Not watches but ultra low power sensors that run on an AA battery for 5 years.

      Most watches only let you set the alarm down to the nearest minute, not the nearest second. Therefore the checking code only executes once a minute. The code that increments the RTC executes once a second, and looks something like this:


      seconds++;
      if (seconds > 59)
      {
              seconds = 0;
              minutes++;
              if (minutes > 59)
              {
                      minutes = 0;
                      hours++ ...

      Of course it can get more complicated if you need to take account of leap seconds and stuff like that.

      I doubt this code would be the most often executed though. It would vary between vendors, many of them using ASICs rather than microcontrollers, and in any case only executes once a second.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    51. Re: For / While in C by drkim · · Score: 1

      I have written clock code for embedded systems. Not watches but ultra low power sensors that run on an AA battery for 5 years... ...in any case only executes once a second.

      Interesting...

      Even if it only executes once a second, that would still be more than, say, a POST routine on a computer executing only once or twice a day.

      And, multiplied by the number of clock inclusive devices, it could add up to a lot.

    52. Re: For / While in C by AmiMoJo · · Score: 1

      Still not much compared to say a pixel shader that renders billions of pixels per second.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    53. Re:For / While in C by maxwell+demon · · Score: 1

      Actually it may not even make an observable difference if the code is embedded into other code, which actually uses the result.

      Reasons why it may not make an observable code include:

      * It is code that is never actually executed.

      * It is code that does not itself produce observable behaviour, and the different result of both never is translated into observable behaviour (think for example of code where the result is used to address an array which is larger than necessary; this will cause different array cells being used, but as long as it is consistent, this difference will not show up in observable behaviour).

      --
      The Tao of math: The numbers you can count are not the real numbers.
    54. Re: For / While in C by Anonymous Coward · · Score: 0

      Yeah, that definitely seems one of the most likely possibilities. And if we have to guess a shader, it's probably one used for standard environment or terrain materials in World of Warcraft?

    55. Re:For / While in C by jones_supa · · Score: 1

      True...

    56. Re:For / While in C by Anonymous Coward · · Score: 0

      FFS, we're looking for a SPECIFIC IMPLEMENTATION here. Not an algorithm. AN IMPLEMENTATION.

      If the question was, "What is the most popular painting in the world" you retards would probably answer "Blue" or some other bullshit.

    57. Re: For / While in C by Anonymous Coward · · Score: 0

      50 cents for 8 bit? You can get a 32 bit ARM cortex chip for 32 cents!

    58. Re: For / While in C by Anonymous Coward · · Score: 0

      It's actually 60 times more than that, 60 Hertz is 60 times per second. 1920x1200x60x60 = 8,294,400,000 shader executions per minute.

    59. Re:For / While in C by Dahan · · Score: 1

      All three editions of the ISO C standard (1990, 1999, and 2011) permit main to have an implementation-defined type.

      Even in a hosted environment? The C89 draft I found only lists "int main(void)" and "int main(int argc, char *argv[])" (2.1.2.2); it doesn't have the "or in some other implementation-defined manner." that C99 has.

    60. Re: For / While in C by Anonymous Coward · · Score: 0

      The only kernel I ever wrote from scratch had:

      do
          halt();
      while(1);

      it the idle process.

      halt() generated the code that puts tbe processor in liw power mode until an interrupt occurs.

    61. Re:For / While in C by ArcadeMan · · Score: 1

      Thank you Ted, that was the joke.

    62. Re: For / While in C by Anonymous Coward · · Score: 0

      It's not just a question of brevity: the PLC solving that ladder logic will do it more reliably than the 300 lines of C#, as well.

      Case in point: a badly designed logic solver will vary substantially in "solve time" when it includes short-circuited logic evaluation. This can cause certain input patterns (and internal states) to cause such a logic solver to run substantially slower than otherwise.

      Why is this a consideration? Years ago a badly designed PLC suffered from this defect (the designers thought it a clever optimization). How was the problem discovered? When car bodies on an assembly line would occasionally bash into each other. The logic solve time was approaching the "worst case", and safety interlocks within the PLC's program weren't being tripped in time. Very expensive lesson for the PLC vendor.

    63. Re: For / While in C by Anonymous Coward · · Score: 0

      Doing the math that is for let's say a kind of low estimate: 1,280 * 720 * 10 = 9,216,000 per frame

      And assuming a modern 30FPS game that's: 9,216,000 * 30 = 276,480,000 per second

      And an average playtime of 2 hours per day: 276,480,000 * 60 seconds * 60 minutes * 2 hours = 1,990,656,000,000 per day per user

      Let's assume only 25% of the US population plays games for 2 hours a day: 1,990,656,000,000 * 313,000,000 * 0.10 = 155,768,832,000,000,000,000,000,000,000 per day in the US alone

      You suck pretty bad at basic math.

      Firstly, 25% is 0.25, not 0.10

      Secondly, 1,990,656,000,000 * 313,000,000 * 0.10 is 6.23075328e+19, not 1.55768832e+29 as you have stated. You are off by almost 10 orders of magnitude.

    64. Re:For / While in C by Anonymous Coward · · Score: 0

      The goal of a low level programming language is compatibility with as many systems as possible, not an imposition upon the designers of those systems to build them as some committee demands.

    65. Re: For / While in C by Zmobie · · Score: 1

      Very good point actually. That is a normal concern point any time we are expanding a system, because if your scan times get too high, you start missing things and sometimes mis-track certain events and objects causing some reeeeeeeeeeeeeeeeeeeally bad things to happen (and in some cases illegal things to happen depending on the industry in which the work is being done).

    66. Re: For / While in C by iggymanz · · Score: 1

      you're going to do the alarm sound oscillator with your ladder logic? snooze timer and snooze bar? 12 or 24 hour time, a couple alarms, ......yes you could but the microcontroller starts looking like a better and more flexible solution.

    67. Re:For / While in C by DedTV · · Score: 1

      If we're talking user entered code, it'd have to be:
      10 PRINT "HELLO WORLD"
      20 GOTO 10

      Doesn't meet the 3 line minimum, but so what? I hate arbitrary rules. :)

      If we're talking any code, it'd probably be something like the code to display the lock screen on an iPhone or some such.

    68. Re:For / While in C by Immerman · · Score: 1

      In C, with an optimizing compiler, yes they will *probably* be compiled into equivalent code.

      If i is a member of a C++ class on the other hand on the other hand then all bets are off. Even if _++ and ++_ are implemented as efficiently as possible while still adhering to the language syntax i++ will essentially be implemented as

      temp = i;
      ++i;
      return temp

      and that temp=i; copy operation may be expensive to perform and/or cause side-effects behind the scenes, so as a rule it can't be safely optimized away without changing the meaning of your code.

      --
      --- Most topics have many sides worth arguing, allow me to take one opposite you.
    69. Re:For / While in C by Murdoch5 · · Score: 1

      Even a simple thermostat would run the loop code I posted, I would have to figured that billion upon billion of devices, chips, asic's and etc... run that code, maybe not always in C but in some language.

    70. Re:For / While in C by Agent0013 · · Score: 1

      After the entire line is executed the result is the same. The two operations are different though. int a = i++; is different from a = ++i;. The first one puts the old result of i into a then increments i. The second example increments i before putting it into a, so a has the newly incremented value.

      --

      -- ssoorrrryy,, dduupplleexx sswwiittcchh oonn.. -Quote found on actual fortune cookie.
    71. Re:For / While in C by Goaway · · Score: 1

      Actually, no, it doesn't. A complete understanding of the C toolchain requires understanding of the parts that C leave implementation-defined, or sometimes even undefined. Those parts can be far more important than the things that are actually in the spec.

    72. Re:For / While in C by RockDoctor · · Score: 1

      whitespace is whitespace

      No, "whitespace" is a programming language encoded in the various different types of whitespace - spaces, horizontal tabs, vertical tabs, backspaces, page breaks.

      Mad. As. A. Hatter.

      Hang on - don't I know that name? Edwin Brady, izzat you?

      --
      Birds are not dinosaur descendants;birds are dinosaurs, for all useful meanings of "birds", "are" and "dinosaurs"
    73. Re:For / While in C by constpointertoconst · · Score: 1

      A tautology is a tautology.

    74. Re: For / While in C by LoRdTAW · · Score: 1

      Ladder on a PLC/PAC vs. C# from scratch is like comparing apples to apple seeds.

      In a PLC, the CPU first reads the IO points, runs or scans the ladder code and then writes outputs. The programmer almost never has to worry about the IO hardware, unless it's for configuring registers in said hardware (usually on the first scan). Also, many modern PLC's implement instruction boxes that greatly simplify configuration and handle things like analog input scaling, complex math, high speed inputs/counters, PID loops and motion control. Basically, all the hard work has been done already. You simply tell it: "if input 1 is on, start timer 1 and turn output 3 off" (lameness filter didn't allow ascii ladder representation).

      Whereas in C# you have to write most of the code from scratch including dealing with the I/O devices or protocols (often through .net libraries or worse, non COM or .net DLL's) and then implementing a basic state machine to handle the actual logic code and so forth. Worse yet, you may want to implement some type of threading for parallel tasks and worry about race conditions, timing, thread safety, etc. It's a ton of tedious work.

      Then again there are of course software PAC/PLC's out there that take care of all the hard work and you only write your logic code and it does the rest.

  2. Obligatory by fisted · · 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.

    1. Re:Obligatory by Anonymous Coward · · Score: 1


      10 echo "Hello world"
      20 post_to_slashdot("First Post!")
      30 echo "Goodbye world"
      40 if (exists(Hell)) goto Hell
      50 else goto /dev/null
      60 end

    2. Re:Obligatory by Workaphobia · · 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.

      --
      Evidently, the key to understanding recursion is to begin by understanding recursion. The rest is easy.
    3. Re:Obligatory by foobar+bazbot · · Score: 3, Interesting

      I know this is OT, but

      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.

      True. But more importantly: I never knew /. let us do nested bold levels!

      For anyone too lazy to look at the html source...

      I never knew /. let us do <b>nested <b>bold</b> levels!</b>

    4. Re:Obligatory by d33tah · · Score: 5, Insightful

      Personally I think that the biggest problem with Slashdot is the abundance of comments like this. Seriously, it might not meet your standards. I understand. Now get over it and stop wasting my time writing it for the thousandth time or actually submit an article that raises the bar. Whining is not really going to change anything. Sorry, but I really had to.

    5. Re:Obligatory by Anonymous Coward · · Score: 0

      WELLLLL.....
      "dumb" is relative. However, no refrigerator has been running a microcontroller - OF ANY KIND - "since the 60s". After all, Intel didn't invent the 8051 achetecture until the 1980s. The 4004 wasn't invented until 1971.

    6. Re:Obligatory by Anonymous Coward · · Score: 0

      Yes... it was painful just to read. Especially since machines rarely run "code." It's pre-compiled, cached in memory, dynamically linked... executed millions of times a second across any number of nodes... there's seriously no logical way to even being to consider speculating such a pointless random thought except for enticing flames.

    7. Re:Obligatory by rolfwind · · Score: 1

      I don't see a difference between that and bold. Running chrome and tried safari too.

    8. Re:Obligatory by foobar+bazbot · · Score: 1

      Huh. Works on Firefox on Win7. Doesn't work on Android with any of Opera, Chrome, or Firefox.

      Pretty sure it's a question of whether CSS "font-weight: 900;" works, which depends both on browser support (anything recent should handle it, I think), and on font choice -- if the font in use only comes in two weights, two weights is all you get.

      (You can test that here... I don't like w3schools, but it's the only site with a live css fiddling tool I know.)

    9. Re:Obligatory by Anonymous Coward · · Score: 0

      Wrong! It is dumb. There's no good reason to ever care about the answer to this question.

    10. Re:Obligatory by Impy+the+Impiuos+Imp · · Score: 1

      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.

      Hey, that would make a great Ask Slashdot question! Unless it ends up being self-referential, in which case it's stupid, but because it's the most stupid, it's fascinating, making it not stupid, making it not the case, making it eligible for stupidest again, error, error, must sterilize, must sterilize.

      --
      (-1: Post disagrees with my already-settled worldview) is not a valid mod option.
    11. Re:Obligatory by geekmux · · Score: 0

      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.

      Doesn't make it dumb, eh?

      Tell you what. Since we're all about analogies here, I'll arrange for exactly three haystacks to be set up in a field right off a busy highway. Then I'll put exactly three needles in those haystacks for you to go find, which is very much akin to asking the Slashdot community to go find the most abused three lines of code in the known universe.

      You let me know how "interesting" that search goes, and how much "thought" you really think you need to put into it.

    12. Re:Obligatory by Hal_Porter · · Score: 1

      It's not the question that's dumb, it's the answers. If the comments were full of anecdotes about discovering obscure code in a common system that was executed really frequently by accident (e.g. you changed it and all hell broke loose) then it would be (IMO obviously) interesting.

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
    13. Re:Obligatory by RedBear · · Score: 2

      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.

      On the contrary. Unless you have a definitive and provably correct answer to this particular Ask Slashdot, which I didn't notice you providing, I would assert that it's an interesting question and you're just being a jackass.

    14. Re:Obligatory by postbigbang · · Score: 1

      error: out of memory in 40

      --
      ---- Teach Peace. It's Cheaper Than War.
    15. Re:Obligatory by EdIII · · Score: 1

      and the answer is readily apparent.

      Whatever lines of code are used to draw boobies on the screen is the most often used code.

    16. Re:Obligatory by abhi_beckert · · Score: 1, Informative

      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.

      And since it's impossible to settle, it's a total waste of time to even think about it. I don't know what the most often-run piece of code is. I don't have any idea. And I'm pretty sure nobody else on /. does so what's the point of even reading comments? I wouldn't be here if I wasn't bored out of my mind...

      This really is the worst ask /. I've ever seen. I wish they'd asked something interesting, like "what did you have for breakfast?" at least I can answer that with some hope of knowing the answer.

    17. Re:Obligatory by abhi_beckert · · Score: 1

      Personally I think that the biggest problem with Slashdot is the abundance of comments like this. Seriously, it might not meet your standards. I understand. Now get over it and stop wasting my time writing it for the thousandth time or actually submit an article that raises the bar. Whining is not really going to change anything.

      Sorry, but I really had to.

      Bullshit. The only way to improve is for people to point out when something is below standard. Complaints should be encouraged. You just shouldn't give credence to all of them.

    18. Re:Obligatory by Cruciform · · Score: 1

      Your comment sucks and is below standard.

    19. Re:Obligatory by Anonymous Coward · · Score: 0

      I actually is a very good question.

      It is pointless, yes. But geeky, intelligent, it makes you think, it's an entertaining time waster who those who like computers, code, and just "thinking about stuff". I'd even go as far as saying this is one of the best "Ask Slashdot's" we that this site has not more of it is a sad thing. We'd need something like this every week and slashdot would be as geeky as it claims to be.

    20. Re:Obligatory by Anonymous Coward · · Score: 1

      Doesn't make it dumb, eh?
      Tell you what. (...snip...)]

      You, sir, are a complete, total, utter fucking buffoon/idiot/retard. You have missed the point of the question entirely. It's not about finding the answer. The answer cannot be known. It's about the journey to the answer. It's a very interesting question, and if you can't see that, then shut the fuck up and don't spout off like a tool.

    21. Re:Obligatory by Anonymous Coward · · Score: 0

      And since it's impossible to settle, it's a total waste of time to even think about it.

      WOOSH. The point is that it is a fun question to think about. Don't spoil the fun just because your tiny brain can't see the fun in it.

      I don't know what the most often-run piece of code is. I don't have any idea. And I'm pretty sure nobody else on /. does so what's the point of even reading comments? I wouldn't be here if I wasn't bored out of my mind...

      You are just stupid then.

      This really is the worst ask /. I've ever seen.

      It totally is not stupid. You are stupid.

      I wish they'd asked something interesting, like "what did you have for breakfast?" at least I can answer that with some hope of knowing the answer.

      You don't have to post dumb complaints, you know. Just move on to the next story. The rest of us thought it was interesting while you were bored, picking your nose/butt/whatever and eating it.

    22. Re:Obligatory by Anonymous Coward · · Score: 0

      Bullshit. The only way to improve is for people to point out when something is below standard. Complaints should be encouraged. You just shouldn't give credence to all of them.

      Dumb cunts like you are ruining this sight.

    23. Re:Obligatory by jones_supa · · Score: 1

      55 system ("pause")

    24. Re:Obligatory by jones_supa · · Score: 1

      His comment is not bullshit. Your comment is not bullshit. The truth exists somewhere in between: don't fight unnecessary battles and instead help making things better, and on the other hand, things don't sometimes get better if we don't challenge each other once in a while.

    25. Re:Obligatory by epine · · Score: 1

      Since we're all about analogies here, I'll arrange for exactly three haystacks to be set up in a field right off a busy highway. Then I'll put exactly three needles in those haystacks for you to go find, which is very much akin to asking the Slashdot community to go find the most abused three lines of code in the known universe.

      Those would be context-free haystacks. But you're right, this is the kind of question where the last quarter mile becomes exponentially more inane.

      I'm pretty sure it was Kahneman's book that had a section on how the human mind is remarkably able and willing to make heuristic comparisons of superficially incomparable magnitudes. Is French vanilla better than French kissing? Surprisingly, the human brain puts this kind of thing into a fairly robust order, across individuals and populations, IMDRDDM (if my dim recollections don't deceive me).

      More interesting is the question about the subroutine longest embedded and most frequently invoked which turns out to return wrong values for common operations, only the code which calls the subroutine nevertheless does the right thing with the wrong value, because it too contains a weird bug which is not superficially obvious when glancing through the source code, such as dependence on an uninitialized value.

      The trope here is two sides of a formal interface, one where the formal requirements are obvious and well understood, which manage to collaborate to turn two egregious coding booboos into a paragon of durable and stable deployment.

      Then one day a programmer notices the dependence on the uninitialized value, which would clearly produce a severe failure if fed the correct inputs, and he thinks "surely this hasn't been running for thirty years deployed on hundreds of thousands of nodes, and never triggered a fatal anomaly" and yet there it is.

      Then he could author a genre sequel in the Thompson tradition entitled On Trusting Time and Track Record. Inside a black box, no one knows if you're a cluster fuck.

      Janine Benyus: Biomimicry in action

      Janine Benyus has a message for inventors: When solving a design problem, look to nature first. There you'll find inspired designs for making things waterproof, aerodynamic, solar-powered and more.

      What you won't find in nature are formal interfaces. Most of mother nature's cleverest hacks were discovered by pillaging haystacks.

    26. Re:Obligatory by Anonymous Coward · · Score: 0

      It's just a question, meant to encourage discussion. Who cares if it can be answered or not? Lots of questions are rhetorical. Try thinking outside the box for once.

    27. Re:Obligatory by burisch_research · · Score: 2

      Heh:

      Ask Slashdot: What would be the best question to Ask Slashdot? :)

      --
      char*f="char*f=%c%s%c;main(){printf(f,34,f,34);}";main(){printf(f,34,f,34);}
    28. Re:Obligatory by serviscope_minor · · Score: 2

      I actually think it's an interesting thought experiment.

      I agree. But there's no way to get from that to this (I disagree with your reasoning):

      This really is the worst ask /. I've ever seen.

      Someone posted an interesting thought experiment to slashdot. That's great. The answers are interesting and come from many facets of tech/programming that I am not involved in.

      We'll never know the absolute truth even if such a thing exists but the answers are interesting and informative.

      I wish they'd asked something interesting, like "what did you have for breakfast?" at least I can answer that with some hope of knowing the answer.

      Yeah, but I simply don't care about the answer. The answer is not interesting.

      An interesting question (like TFA) is interesting even if you can't answer it.

      --
      SJW n. One who posts facts.
    29. Re:Obligatory by Anonymous Coward · · Score: 0

      So, you're basically calling thought experiments worthless.

    30. Re:Obligatory by Internetuser1248 · · Score: 1

      And since it's impossible to settle, it's a total waste of time to even think about it.

      That argument could be used to discourage all fiction, from books to films, and also vast swathes of philosphy including all of metaphysics and a good part of all the other disciplines. You have no imagination. Not only is it a lot of fun to think about interesting questions and go over potential answers in one's mind, it has also been long established that this is a healthy and useful activity that leads to a better understanding of the world.

      How can you even live without occasionally considering some questions where a definite answer is impossible to establish? This in itself is an unanswerable question and one I find myself considering very often while reading comments like yours.

    31. Re:Obligatory by dissy · · Score: 2

      What's even more hilarious, people like the GP who claim to hate a type of article then proceed to post in each and every one of them are in reality raising two counters in a database somewhere when they #1 click on the article and #2 post a comment.
      This indicates to slashdot that the article was both interesting to read as well as interesting enough to have participation, and the interpreted result is the readers want MORE articles of that nature!

      So when people say "complaining is the only way to get change", they are very correct in fact but incorrect about as far as you can be in outcome. Complaining in the comments will cause more such articles in the future, not less.

      As you already stated, the only way to assure less such articles is to skip the ones uninteresting to you and to post what you do want to see in the firehose to be upvoted for the front page.

      Anyone who doesn't use the firehose to down vote articles and then complains about articles on the front page are nearly as bad as people who refuse to vote then continuously bitch about who does get voted in to government ("nearly" because the outcome is magnitudes less important in daily life here on slashdot than who runs the worlds biggest countries)

    32. Re:Obligatory by Anonymous Coward · · Score: 0

      WAT? :-|

    33. Re:Obligatory by Anonymous Coward · · Score: 0

      Wow. I bet you're a hit a parties.

    34. Re:Obligatory by camperdave · · Score: 1

      Yes, for those comments that are bolder than bold!

      --
      When our name is on the back of your car, we're behind you all the way!
    35. Re:Obligatory by segin · · Score: 1

      54 REM NOTREACHED

    36. Re:Obligatory by Yetihehe · · Score: 1

      Then one day a programmer notices the dependence on the uninitialized value, which would clearly produce a severe failure if fed the correct inputs, and he thinks "surely this hasn't been running for thirty years deployed on hundreds of thousands of nodes, and never triggered a fatal anomaly" and yet there it is.

      And then it breaks simultaneously in the whole world.

      --
      Extreme Programming - Redundant Array of Inexpensive Developers
    37. Re:Obligatory by Anonymous Coward · · Score: 0

      61: Hell: hcf

    38. Re:Obligatory by Anonymous Coward · · Score: 0

      Nien Nunb: "Atirizi inyui mwi hau inyouthe ukai haha!"
      Lando: "What do you mean 'illegal instruction'? How can we still be executing if the instruction's unimplemented? Unless... Lando to Admiral Ackbar-- the system's still up! That thing has a fully operational exception handler!"
      Ackbar: "It's a TRAP!!"

    39. Re:Obligatory by Anonymous Coward · · Score: 0

      It is dumb because we all know that the answer will always remain a complete guess. As such it is an invitation to trolls and tards, and any rational discussion about the matter is either impossible or useless. Yes, this is, by far and large, the most dumb question ever asked on ask slashdot.

    40. Re:Obligatory by Anonymous Coward · · Score: 0

      Mind of a scientist right here.

    41. Re:Obligatory by kumanopuusan · · Score: 1

      Not that one.

      --
      Use of the words "good", "bad" or "evil" is almost invariably the result of oversimplification.
    42. Re:Obligatory by Anonymous Coward · · Score: 0

      Says user with 7 digit id. I'm not convinced that you have credentials to make that judgment.

    43. Re:Obligatory by Anonymous Coward · · Score: 0

      Doesn't make it dumb, eh?
      Tell you what. (...snip...)]

      You, sir, are a complete, total, utter fucking buffoon/idiot/retard. You have missed the point of the question entirely. It's not about finding the answer. The answer cannot be known. It's about the journey to the answer. It's a very interesting question, and if you can't see that, then shut the fuck up and don't spout off like a tool.

      Fine. Have fun on your utterly fucking pointless journey to nowhere to prove nothing.

      Don't be surprised if you find people calling you a fucking moron. It's not an interesting question. It's a goddamn pointless one, and as boring as trying to measure infinity. Yeah, all about the journey. What the fuck ever. Smoke another bowl, hippie.

    44. Re:Obligatory by LoRdTAW · · Score: 1

      Its not that bad. At least it makes people think and post interesting ideas. I had fun reading through the comments.

  3. Bios code? by multimediavt · · Score: 2

    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?

    1. Re:Bios code? by chaoskitty · · Score: 2

      No. BIOS code only gets run at boot time.

    2. Re:Bios code? by Anonymous Coward · · Score: 5, Interesting

      I would probably have to say whatever is the inner loop on the system idle process in windows.

    3. Re:Bios code? by Anonymous Coward · · Score: 0

      On a PC, BIOS usually run only at boot, except maybe ACPI.

      BIOS also have various implementations as they are hardware dependent.

    4. Re:Bios code? by Anonymous Coward · · Score: 0

      I know I'm an AC commenting on an AC, but please mod parent up.

    5. Re:Bios code? by davester666 · · Score: 0

      well, there are lots of machines that run Windows, so it does get run pretty frequently...

      --
      Sleep your way to a whiter smile...date a dentist!
    6. Re:Bios code? by Anonymous Coward · · Score: 0
      The inner loop is basically:

      loop: hlt
      jmp loop

    7. Re:Bios code? by ColdWetDog · · Score: 1, Insightful

      Well, all of those Windows reboots ought to bump the value up a fair bit.

      --
      Faster! Faster! Faster would be better!
    8. Re:Bios code? by buchner.johannes · · Score: 4, 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.

      --
      NB: The message above might reflect my opinion right now, but not necessarily tomorrow or next year.
    9. Re:Bios code? by Orp · · Score: 4, Informative

      I would probably have to say whatever is the inner loop on the system idle process in windows.

      Ding, we have a winner. Not supercomputer code. Sure, supercomputers are... super and all, but the biggest one only has around 1 million processing cores. How many windoze machines are out there, idling away?

      --
      A squid eating dough in a polyethylene bag is fast and bulbous, got me?
    10. Re:Bios code? by Anonymous Coward · · Score: 0

      BIOS runs on assembler code, so it's outside the question... the most used commands for every languaje are the loop control commands 'for' and 'while', or the languaje's alternatives for them.

    11. Re:Bios code? by Anonymous Coward · · Score: 0

      Plus, with multicore machines, I might be using less than the maximum of cores and the rest just sit idle.

    12. Re:Bios code? by Rockoon · · Score: 5, Interesting

      You are right about the hardware/bios aspect, but arent on the right device.

      (nearly) Every computer has a video device which has a loop running over the frame buffer, outputting pixels to the display output port. Even in the days of regular CGA 320x200 graphics on 60hz monitors that amounted to 3,840,000 iterations per second. We are talking over 3 decades of this going on, on nearly every desktop and laptop computer build during that time (vector displays worked differently) and even in those early days of CGA most of the time those machines were in a text mode with a pixel resolution of 720x240 and still putting out a 60hz of video signal (10,368,000 pixels per second.)

      A single CGA desktop machine in text mode left on since January 1984 would have output 9,816,000,000,000,000 pixels to its display port so far. Thats nearly 10 quadrillion pixels. Even if the average number of running desktop computers over the period were only 1 million (a severe lowball) and used that shitty low resolution at only 60 hz, thats still over a sextillion iterations of that simple pixel outputting loop.

      I would say the average number of running desktops over the period since 1984 is more like 50 million and the average resolution over the period was 1024x768, and the average monitor refresh is 70 hz. My guestimate is about 2.606E+24 iterations of the framebuffer loop, over 2 septillion iterations.

      --
      "His name was James Damore."
    13. Re:Bios code? by Vic+Metcalfe · · Score: 1

      That is true for modern operating systems. The BIOS (Basic Input Output System) ran as the layer under DOS before Windows NT. I remember writing DOS apps, and invoking both DOS and BIOS interrupts to get things done with the disks, keyboard and monitor. DOS acted as a layer on top of the BIOS, so it was still generally used even when you made a call to DOS. Back in the day the BIOS code would have been a strong contender except for the fact that it was written in assembler and therefore disqualified.

      I think you're on the right track though... The microcontrollers which run hard disk drives execute the same code repeatedly, and while many microcontrollers are programmed in assembler, I prefer to do my microcontroller programming in C. I betcha some hard drives have microcontrollers executing code written in C.

      As you might have imagined, my beard is grey.

    14. Re:Bios code? by Anonymous Coward · · Score: 1

      My guestimate is about 2.606E+24 iterations

      Significant figures fail detected in at least 1.0000000 posts!

    15. Re:Bios code? by 0123456 · · Score: 2

      (nearly) Every computer has a video device which has a loop running over the frame buffer, outputting pixels to the display output port.

      Unless you're using a Sinclair ZX80/81 or some other peculiar device that's too cheap to include a graphics chip, that's hardware, not 'code'. If you expand the definition of 'code' to VHDL and other hardware design languages, there must be 'code' doing far more than a graphics chip would.

    16. Re:Bios code? by Anonymous Coward · · Score: 0

      uh, dude. That "hardware" is running its own code. so, that snippet of code counts.

    17. Re: Bios code? by Anonymous Coward · · Score: 1

      The scan-out logic of most graphics and display systems over those decades would be in hardware rather than software, and even ones that had CPU controlling the video output (eg similar to the humble ZX81) would probably have that logic in assembly language, so maybe not allowed for the question (?).

      But modern programmable pixel shaders, while relatively recent, might provide a few serious contenders.

      Consider: a common shader used in a blockbuster video game (or even in multiple titles from a single developer eg Rockstar or EA), or in the system software (eg blending OS overlays) or on leading mobile devices (eg iOS or Android).

      Although the ranges are broad, the product of large installed base (tens of millions or more), moderate average running time (hours to months), invoked over tens of millions of times per second.

      An order-of-magnitude guess might be:

      Installed base: 10^7 to 10^9 machines (10 million to one billion)

      Frame rate: 10^1 to 10^2 Hz (10 to 100Hz)

      Executions (pixels) per frame: 10^5 to 10^7 (720p plus/minus order of magnitude)

      Average running time per installation: 10^4 to 10^8 (3 hours to 3 years)
      E.g. 3 hours for quick game, 3 years for some shader in system software, used every frame.

      So total executions for many contenders in this category would be in range 10^16 to 10^26, probably around 10^21.

    18. Re:Bios code? by mhotchin · · Score: 4, 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.

    19. Re:Bios code? by Anonymous Coward · · Score: 0

      I think it's one loop for the whole OS.

    20. Re:Bios code? by sunderland56 · · Score: 1

      I would probably have to say whatever is the inner loop on the system idle process in windows.

      (1) Aren't there more Android devices than windows boxes?

      (2) Even if not.... most Android devices are up and running their idle loop 24/7/365. Windows boxes often get shut down at night.

      Semantics: do we consider the idle loop in Win XP to be the same code, or different code, from the idle loop in Win 7, or Win 8??

    21. Re:Bios code? by solidraven · · Score: 1

      Microcontrollers are present in huge numbers, the most executed code is probably somewhere in a 4-bit microcontroller in your washing machine or microwave oven. As such my entry for this one is the start-up sequence of a microcontroller: disable interrupts, configuration code, enable interrupts. Another likely candidate is the 8051 series microcontroller, that one has been around for decades and it's still being made and improved. So to be precise, configuring the timers and interrupts of the 8051 family.

      You must realise most graphics cards actually don't execute that many instructions. A graphics card can process a lot of data at once, sure. But it's a case of SIMD more often than not. So the actual number of instructions executed is quite limited versus the amount of data.

    22. Re:Bios code? by angel'o'sphere · · Score: 1

      That is nonsense.
      Bios code gets execute when ever it is called by the OS or by a running application.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    23. Re:Bios code? by angel'o'sphere · · Score: 0

      That is also wrong.
      HALT for the CPU means furtherhin it will do nothing.
      Perhaps you ment a different opcode?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    24. Re:Bios code? by w_dragon · · Score: 1

      I would agree, probably some ethernet or ip handling code. Something that has to exist on every device that connects to a network and is run on every single packet. The CRC check on the ethernet frame is a likely candidate. Every router, switch, and networked device is going to run an identical check on every packet before it can even verify that the frame is well-formed. Maximum frame size is around 9kB, and the standard is 1500 bytes. That's a lot of runs on a 10 gb lan.

    25. Re:Bios code? by Anonymous Coward · · Score: 1

      Most idle cycles probably goes to different malware and botnets.

    26. Re:Bios code? by edp · · Score: 1

      I write some of Apple’s FFTs and other signal-processing code, and I happen to have been pondering this question lately. My software will be in a billion computers in the next few years, and there will be sextillions of executions of instructions I have written. However, somebody out there will have more...

    27. Re:Bios code? by 0123456 · · Score: 4, Informative

      That is also wrong.
      HALT for the CPU means furtherhin it will do nothing.
      Perhaps you ment a different opcode?

      Halt means it does nothing... until the next interrupt. Which will happen when there's something useful to do.

    28. Re:Bios code? by 0123456 · · Score: 1

      uh, dude. That "hardware" is running its own code. so, that snippet of code counts.

      Uh, dude. No, it's not.

    29. Re:Bios code? by Anonymous Coward · · Score: 0

      Shut off at night? Why would anyone put an off button on a computer...

    30. Re:Bios code? by Zocalo · · Score: 1

      Up until this month's patch batch that was apparently to check to see if there was an update to IE and nail the CPU for an hour or so.

      --
      UNIX? They're not even circumcised! Savages!
    31. Re:Bios code? by geekmux · · Score: 1

      Most idle cycles probably goes to different malware and botnets.

      Then logic might conclude the winning code lies within malware or botnet code.

      And if you want to talk sheer numbers, I'd say there are a hell of a lot of cell phones out there...

    32. Re: Bios code? by MickLinux · · Score: 1

      Gandalf? Is that you?

      --
      Correct Horse Battery Staple: 72 bits of entropy. Enter "Correct H" into google. When it generates the phrase, that's
    33. Re:Bios code? by Anonymous Coward · · Score: 0

      Unless you're using a Sinclair ZX80/81 or some other peculiar device that's too cheap to include a graphics chip, that's hardware, not 'code'.

      Even on the ZX80, it was hardware. See the schematic here: http://searle.hostei.com/grant/zx80/zx80circuitAnnotated.pdf and note that while it doesn't have a dedicated graphics chip, it turns out that at least portions of around 10 of the 74xxx series ics are on the board in order to implement graphics functions. Note particularly the function of ICs 6, 7 and 8: these switch access to the memory between the CPU and the dedicated hardware that generates the requests for the bytes that get sent to the screen. The behaviour doesn't involve the CPU executing a loop over the framebuffer: what actually happens is that the CPU executes a jump to the start of a line of the video memory buffer, and the external hardware takes over. The CPU requests successive addresses are read as instructions, and the RAM duly returns them, but the multiplexing hardware prevents them from reaching the CPU: instead, they get read into a latch, and a 'NOP' instruction is provided to the CPU's data lines in their place. The latch is used to generate addresses in the ROM to determine what actual pixels to output.

      It's a hack, but it's an (almost) entirely hardware-level hack.

    34. Re:Bios code? by Rich0 · · Score: 1

      If you expand the definition of 'code' to VHDL and other hardware design languages, there must be 'code' doing far more than a graphics chip would.

      Another intermediate state would be DSPs. These historically have run at very high clock speeds for their time, but they perform a very simple set of tasks. GPUs are another example - those run at fairly high clock speeds, and are usually highly parallel.

      Not really sure we want to count those, however.

    35. Re:Bios code? by tigersha · · Score: 1

      The "framebuffer loop"???!!! Do you seriously think every pixel is pushed out there by the CPU? Even in a ZX 80 or a machine from the 50s or 60s this is not the case.

      --
      The dangers of excessive individualism are nothing compared to the oppressiveness of excessive collectivism
    36. Re:Bios code? by chmod+a+x+mojo · · Score: 2

      Come on.... ( pun intended )

      It almost has to be a video / image codec if we are talking about internet era code. I mean the internet is what, 90% porn?

      But in all seriousness, I would still say video codec code. All the devices out there consuming video at (usually) 24+FPS have to decode each frame. The line kind of blurs with DXVA / VDPAU and hardware decoding though.

      Come to think of it, it could also easily be an audio codec, either in portable music players or cell phones.

      --
      To err is human; effective mayhem requires the root password!
    37. Re:Bios code? by Anonymous Coward · · Score: 0

      Most idle cycles probably goes to different malware and botnets.

      Then they're not really idle, are they?

    38. Re:Bios code? by Memnos · · Score: 3, Funny

      I would have to guess any error handling code I have ever written. It may not be the most oft-run code, but for me it sure seems like it is..

      --
      I don't trust atoms -- they make up stuff.
    39. Re:Bios code? by angel'o'sphere · · Score: 1

      I thought that in old CPUs, like 6502 the processor would not listen to interupts anymore.
      But you are likely right for modern CPUs.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    40. Re:Bios code? by jones_supa · · Score: 1

      That gives me a thought: isn't the hlt instruction more energy-efficient than jmp?

      So wouldn't we be better off crafting a loop which has, for example, 100 sequential hlt commands, and then the jmp to the beginning?

      The hlt/jmp ratio would be higher.

    41. Re:Bios code? by Pseudonym · · Score: 1

      Not in this case, no.

      First off, the JMP is perfectly predicted, so it costs basically nothing. Secondly, the above loop fits in an icache line, and also probably fits in the Intel trace cache most of the time. 100 sequential commands of any type would not be.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    42. Re:Bios code? by mdragan · · Score: 1

      From RAM (framebuffer) to the video display there's usually no CPU involvement, true. But the CPU puts the frame in the memory (or updates the memory if they use "dirty rectangles"). Next generations of computers after Z80 (16 bit ones like Atari ST and Amiga and x86 PCs) use hardware blitters and it makes it possible to redraw every frame completely, instead of messing with "dirty rectangles". Drawing the frame is still the business of the application running on the CPU. So, lots of pixels to move to the framebuffer, for each frame.

    43. Re:Bios code? by AmiMoJo · · Score: 1

      The idle loop isn't really a loop any more. It executes a CPU sleep instruction and then the CPU stops executing until woken up by an interrupt. That saves a lot of power.

      Since every time the machine wakes up it will probably do at least one context switch that function is probably run more often.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    44. Re:Bios code? by AmiMoJo · · Score: 2

      Depends on the architecture. On many CPUs HALT stops it completely, never to resume until externally reset. There is usually a SLEEP op-code for what you are thinking of.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    45. Re:Bios code? by AmiMoJo · · Score: 2

      So I would reckon, some GSM codec/cipher.

      That is usually done by an ASIC though, so not code per-se. Parts of the radio in mobile phones are programmable, although they tend to be FPGAs rather than CPUs at the core because that reduces power when doing DSP type stuff. I'm not sure if FPGA code counts because it's not really executed like CPU code is.

      There are a lot of similar candidates that fall into this trap. Hashing code, encryption code, checksumming code... Whenever it needs to be high performance it's usually better to create a hardware implementation, so it is no longer code.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    46. Re:Bios code? by mindriot · · Score: 1

      (nearly) Every computer has a video device which has a loop running over the frame buffer, outputting pixels to the display output port.

      Yes, but there are a lot of video device manufacturers out there. When we talk about the most often run piece of code, do we mean "all implementations of code that do the same thing", or do we really mean "one specific implementation"? I would opt for the latter - which means you can't consider all desktop machines out there, only all those with video devices that really use different incantations of the same code. That lower the number quite significantly.

    47. Re:Bios code? by jones_supa · · Score: 1

      I see.

    48. Re:Bios code? by Anonymous Coward · · Score: 0

      Not GSM code. My kids are on their phones, online all the time, and they're not
      using GSM that much. Usually, they're on WLAN, playing games. So, the lowest
      common denominator of the TCP/IP stack before it splits into physical layer
      specifics? Not 3G/4G/GSM/Ehternet, but the IP packet dispathcer, probably.

      Think watching videos, IP telephony, IPTV. That's a lot of data on any device
      (mobiles, xPads, PCs, set-top boxes, playstation and other consoles...) /T.

    49. Re:Bios code? by FlexAgain · · Score: 1

      I thought that in old CPUs, like 6502 the processor would not listen to interupts anymore. ...

      The original 6502 certainly had no HALT instruction (or similar variant). I don't believe there's any way to stop it listening for an NMI (Non-Maskable Interrupt), although obviously a "normal" maskable interrupt is trivially blocked by setting the IRQ disable bit in the status register.

      --
      Actually it is rocket science...
    50. Re:Bios code? by Rockoon · · Score: 1

      The "framebuffer loop"???!!! Do you seriously think every pixel is pushed out there by the CPU?

      The emphasis is mine. You clearly think that there is only one CPU in your desktop. That has pretty much never been true over the past 30+ years. Even a humble 8088 system with a CGA graphics card had multiple CPU's .. just because you couldnt program them directly is irrelevant..

      ..what IS relevant is that you clearly dont know what you are talking about even on a very basic level. Hard to believe given your ID but there it is... you dont know dick about the shit you've been using for decades.

      --
      "His name was James Damore."
    51. Re:Bios code? by ericloewe · · Score: 1

      Yes, but modern OSes rarely do anything through the BIOS.

    52. Re:Bios code? by Anonymous Coward · · Score: 0

      Few. Most have malware.

    53. Re:Bios code? by Salgat · · Score: 1

      The clock on a micro is typically 20MHz. On top of that, a startup sequence only needs to be ran a limited number of times. We're talking 1 core @ 20MHz versus 1500 cores @ 1GHz on a modern GPU.

    54. Re:Bios code? by fatphil · · Score: 2

      > You clearly think that there is only one *C*PU in your desktop

      Emphasis mine. There generally was only one *C*PU, but there may have been other ALU's or peripherals controllers (which includes graphics chips). Processors, yes, but not CPU's in the context of those systems. My mobile phone has at least 5 fully-functional ARM processors on it (not cores, processors), for example, but only one of those is the CPU.

      --
      Also FatPhil on SoylentNews, id 863
    55. Re:Bios code? by FragHARD · · Score: 0

      No....

      It's--->
      WinCommand(RESET_ALL);

      --
      FragHARD or don't frag at all
    56. Re:Bios code? by angel'o'sphere · · Score: 1

      You are right, the STP instruction (which in my mind was HLT, which is wrong) came with the 65c02 and the 16 bit variant, forgot how it is called.
      However it basically 'killed' the processor only a hardware reset woke it up.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    57. Re:Bios code? by multimediavt · · Score: 1

      BAM! Didn't think about that. Totally the winner for anything with video output, for sue. But, I was factoring embedded devices and anything with BIOS. That gets run every time a device is power cycled. That would include cell phones and printers and routers and, well, you get the picture. BIOS is in a metric shite tonne of devices, not just devices with color displays. There is code that gets executed in every one of these devices to POST, and I have to plant the flag and say that trumps any other code oft-run. There's just way too many billion devices that POST. There haven't been enough cell phones EVER to overtake the cumulative numbers--that encompasse them--that POST. Industrial equipment, lab equipment, ANYTHING with memory has to POST. Power On Self Test, to correct my previous acronym usage. Define first, then use.

    58. Re:Bios code? by multimediavt · · Score: 1

      If we're being analytical, factor in this. And, why are we factoring out microcontrollers? The question was what code is oft-run, ever. Didn't specify platform. Matter of fact it says "regardless of CPU type".

    59. Re:Bios code? by Anonymous Coward · · Score: 0

      1) hmm not sure on that. Think there are more shipped this year than PC's. However, I am pretty sure there are more PC's than androids and ipads put together.
      2) maybe maybe not. I know entire buildings of 500+ PCs were left on for years at a time. The old 'turning it off and on burns it out faster'.

      I picked the idle loop as everything falls back to it after they are done with their work (and not). The idle loop also does not last long on pretty much any OEM PC. They are always waking up to do *something* that the OEM decided must be on the computer. Even a fairly stripped down windows wakes up and does stuff in the background.

      Not sure what the innermost loop does probably hangs out until an interrupt. Probably has not changed much since NT3.51. Anyone peek into that win2k code dump from a few years ago and see what it does?

      Android probably will gain on PC's for most code run. But PC's have a 15-20 year head start.

      My other pick would be the task scheduleder from windows.

    60. Re:Bios code? by solidraven · · Score: 1

      Each time it comes out of hibernation those routines are executed in a lot of cases. Plus during critical procedures you must always disable interrupts, hence it's a very common procedure. And you forget that your computer also contains several microcontrollers, like the 8051 is often used as USB host.

    61. Re:Bios code? by LoRdTAW · · Score: 1

      I too think an NMI is able to wake a halted or locked up CPU. In an old industrial laser Laser we have at work that there is a 6809 with a two level watchdog timer. The first level fires off an interrupt after 40ms and the next level at 100ms (if the NMI fails) pulls reset low to "reboot" the system.

  4. Hello World. by SYSS+Mouse · · Score: 4, Funny

    Indeed.

    1. Re:Hello World. by Salgat · · Score: 1

      Hello World is probably the most universally ported program.

    2. Re:Hello World. by Anonymous Coward · · Score: 0

      print or write or writeln or put, etc., i.e. output statements, in any language and compiled/interpreted into the assembler code to output on any medium/device, etc. ftw.

  5. "Hello World" by Anonymous Coward · · Score: 0

    "Hello World"

  6. Who knows? by Anonymous Coward · · Score: 0

    Why would the Slashdot community know this?

    1. Re:Who knows? by Anonymous Coward · · Score: 0

      We Slashdotters know everything. Or we think we do. Or we think we can win the argument even when neither party has any clue what the answer may actually be. Looking things up in cheating.

      Now if you'll excuse me, I have some real work to do!

  7. Slascode "asciifier" by psergiu · · Score: 5, Funny

    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.
    1. Re:Slascode "asciifier" by Hal_Porter · · Score: 1

      I also like the way it converts smart quotes pasted from the web into gibberish like âoe and â, because smart quotes were invented by Microsoft and people that use them need to be punished until they recant and learn to replace them with ASCII.

      So clearly Slashdot either making them render correctly or converting them automagically to ASCII is right out.

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
    2. Re:Slascode "asciifier" by Memnos · · Score: 1

      I'm fairly sure that "asciifier" is an indecent term that should never be used on our wonderful series of these intarweb tubes. Don't you think of the children? Are you being an Insensitive Clod, or are you just smart? Oh, sorry, my bad, you're just smart. Shall we shake hands, or bump fists, or duel in the morning. (I have a prior engagement in the morning with a girl named AsQui, so I suggest the shanking hands thingy.)

      --
      I don't trust atoms -- they make up stuff.
    3. Re:Slascode "asciifier" by xaxa · · Score: 1

      Those quote symbols are in Unicode. It's just a reflection of Slashdot's poor Unicode support.

      “Test”, ‘Test’, Test”, Test.

      (If the preview is correct, ,, << and >> are stripped out, but the English quotes remain.)

  8. The code triggered by crtl-alt-del by SensitiveMale · · Score: 1

    By a long shot

    1. Re:The code triggered by crtl-alt-del by VortexCortex · · Score: 1

      So, a Linux live CD then?

  9. Solved. Next? by Anonymous Coward · · 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.

  10. 3 line limit? by Anonymous Coward · · Score: 0

    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.

    1. Re:3 line limit? by Anonymous Coward · · Score: 0

      "in non-assembler format"

  11. Something in deep in a loop in the graphics system by Nutria · · Score: 2

    of the Windows NT kernel that hasn't changed since the 1990s?

    --
    "I don't know, therefore Aliens" Wafflebox1
  12. Obv by Anonymous Coward · · Score: 0

    return 0;
    C^

    1. Re:Obv by Anonymous Coward · · Score: 0

      I'm not even that sure about that one. Inside programs, there's functions which are called countless times and return something else than zero.

  13. How could this ever be determined or verified? by dpbsmith · · Score: 3, 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?

    1. Re:How could this ever be determined or verified? by TubeSteak · · Score: 4, 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?

      --
      [Fuck Beta]
      o0t!
    2. Re:How could this ever be determined or verified? by Anonymous Coward · · Score: 0

      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?

      125

    3. Re:How could this ever be determined or verified? by jareth-0205 · · Score: 1

      How could this ever be more than a guess? How could it ever be determined, documented, or verified?

      Don't worry about it, it's just an interesting conversation...

    4. Re:How could this ever be determined or verified? by Mark-Allen · · Score: 1

      Thanks for the link. Great reading material.

      --
      If you can stay calm, while all around you is chaos... then you probably haven't completely understood the question.
  14. Bitcoin by KingTank · · Score: 0

    Probably some loop used in Bitcoin mining.

    1. Re:Bitcoin by ShanghaiBill · · Score: 1

      Probably some loop used in Bitcoin mining.

      Most bitcoins are mined with ASICs or FPGAs, so that doesn't count as "code" since the algorithm runs directly in hardware. If you believe that algorithms implemented in Verilog or VHDL should count, then the "winner" still wouldn't be bitcoin, but something like the VHDL that implements the system clock on a billion x86s.

    2. Re:Bitcoin by The+Mighty+Buzzard · · Score: 4, Informative

      If it's not yet, it will be soon. At the moment the SHA-256 algorithm is being run in the neighborhood of 15,000,000,000,000,000 times per second by miners.

      --
      Violence is like duct tape. If it doesn't solve the problem, you didn't use enough.
    3. Re:Bitcoin by wbic16 · · Score: 0

      More like 3.0e16 sha-256 computations per second (each Bitcoin hash involves two sha256 calculations), but the HLT idle command is a clear winner.

      Assume: HLT idle is 1 clock cycle
      Assume: Typical PC is idling at 1 GHz

      PC shipments were 350m in 2010. If even 1 billion PCs are on and idle 60% of the day, then we have:

      0.6 * 1 billion * 1 GHz * 1 year = 1.9e25 iterations per year

      versus

      3.0e16 Hz * 1 year = 9.5e23 iterations per year for Bitcoin

      Now, sha256x2 is much more complicated than HLT, but the OP asked for iterations.

    4. Re:Bitcoin by Anonymous Coward · · Score: 0

      If counting hardware, I'd say a DRAM cell. I run 64 billion of them when ever my computer is on. Now, what frequency you count for a continuously powered circuit is another problem. If you just use the refresh rate (~64 ms) thats 1 trillion DRAM bit refreshes a second on my desktop. Thats about 300 times the excitation rate of my clock generator, and it happens even when the CPU is mostly asleep. I'm not counting the DRAM cells in my GPU either.

    5. Re:Bitcoin by Anonymous Coward · · Score: 0

      The linux task scheduler gets executed about 1,000,000,000 times every second.
      According to wikipedia 1 billion (1,000,000,000) android devices have been activating. So the linux task scheduler gets executed at least 10^18 times per second assuming all those devices are on all the time. I'm quietly assuming here that google has made no major changes to the scheduler for android and that there are 0 other linux machines running on earth.

      The most executed 3 lines of code is going to be the function declartion open bracket and first variable declaration of some interrupt handler.
      Probably something to do with networking or storage devices.

    6. Re:Bitcoin by Palinchron · · Score: 1

      Mining ASICs don't count, though -- ASICs are not microprocessors, so they don't run code, written in assembly or otherwise.

      --
      The lesson here is that a sufficiently large corporation is indistinguishable from government. --ultranova
    7. Re:Bitcoin by Joce640k · · Score: 1

      If it's not yet, it will be soon. At the moment the SHA-256 algorithm is being run in the neighborhood of 15,000,000,000,000,000 times per second by miners.

      So...several orders of magnitude less than (eg.) the Windows task scheduler?

      --
      No sig today...
    8. Re:Bitcoin by ArcadeMan · · Score: 1

      If that were the case, the winner would be the clock on microcontrollers. There's a shitload more of those than any x86 processors.

    9. Re:Bitcoin by Anonymous Coward · · Score: 0

      If it's not yet, it will be soon. At the moment the SHA-256 algorithm is being run in the neighborhood of 15,000,000,000,000,000 times per second by miners.

      Heh. I stupidly thought, "someone could build I nice dictionary of SHA-256 hashes with this." Then I did the math and saw they really aren't making a dent. Nevermind.

  15. this is easy.... by maxrate · · Score: 1

    nop

    1. Re:this is easy.... by Anonymous Coward · · Score: 0

      What piece of code, in a non-assembler format

      let's set a lower limit of 3 consecutive lines.

      Your listening skills are awesome!

    2. Re:this is easy.... by maxrate · · Score: 1

      that was kinda my point really

    3. Re:this is easy.... by Anonymous Coward · · Score: 0

      What piece of code, in a non-assembler format

      let's set a lower limit of 3 consecutive lines.

      Your listening skills are awesome!

      Ok, how about:

      nop
      nop
      nop
      nop

      What?! You have never unrolled a loop to make it run faster by avoiding as many jmps as possible?

  16. IEFBR14 - Mainframe Null Program by Anonymous Coward · · Score: 5, Interesting

    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.

    1. Re:IEFBR14 - Mainframe Null Program by sk999 · · Score: 5, Interesting

      This gets my vote. Ran it many times myself.

      As an aside, this program, (which did absolutely nothing and, in binary format, was originally only 2 bytes long) had the dubious reputation of being the shortest program with a bug. It failed to clear the register that returned the error code. Oops.

    2. Re:IEFBR14 - Mainframe Null Program by ihtoit · · Score: 3, Insightful

      that is actually... really fucking sad. So sad it made me laugh. Is that in itself sad?

      --
      Political debates have me rolling my eyes so much I think I got optical whiplash. I should sue. - Foamy The Squirrel
    3. Re: IEFBR14 - Mainframe Null Program by kenh · · Score: 3, Informative

      Error? More like bad coding - it relied on the processor clearing the return/exit status register originally, and once the 'error' was 'corrected' it doubled the size of the program (from one BR14 instruction to a load instruction and then the branch instruction).

      That code is now 50 years old.

      --
      Ken
    4. Re:IEFBR14 - Mainframe Null Program by Anonymous Coward · · Score: 0

      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.

      It's only 2 lines of code

            XR 15,15
            BR 14

    5. Re:IEFBR14 - Mainframe Null Program by QRDeNameland · · Score: 2

      I had an instructor years ago who said his only exception to his "there are no stupid questions" policy was when a student asked him "How do you spell IEFBR14?"

      --
      Momentarily, the need for the construction of new light will no longer exist.
    6. Re:IEFBR14 - Mainframe Null Program by serviscope_minor · · Score: 1

      This gets my vote. Ran it many times myself.

      Does the name have some sort of opaque meaning?

      --
      SJW n. One who posts facts.
    7. Re:IEFBR14 - Mainframe Null Program by Anonymous Coward · · Score: 0

      This program is not run "any time a mainframe does anything with a dataset in a batch job". It is run frequently, but not as often as that. A little background: in a batch job, there are one or more 'steps' which consist of an EXEC=pgmname statement, and multiple DD statements (roughly equivalent to a file handle). The DD statements specify the dataset (you would probably say file) being acted upon, whether they are old or new, if new the space needed and other characteristics of the dataset, the disposition at the end of the step (keep it, delete it, etc.) if the step runs successfully, and the disposition of the dataset if the step fails. All of that work is handled by the OS using information from those statements.
          Sometimes you just need a step to create or delete a dataset, without any application work - so you use IEFBR14, which "does nothing". If you were too lazy to read the Wikipedia article, the name IEFBR14 comes from the convention, in programs which are called by IBM operating systems (or other programs running on those systems) of using register 14 to contain the return address - so when your program is done, you load the return code (0 = success by convention) into register 15 and branch to register 14, in assembler this is BR 14.

  17. Some routine in a COBOL program by Anonymous Coward · · Score: 0

    That has been running on mainframes for the last 30 years or so....

  18. Zen. by Anonymous Coward · · Score: 0

    NOP
    NOP
    NOP

    and then we die.

  19. The old classic... by oldfogie · · Score: 2

    printf("Hello, World!\n");

    1. Re:The old classic... by Zumbs · · Score: 1

      I suspect that the "Hello, World" program is the most commonly *printed* (on paper, in books) piece of code, ever.

      --
      The truth may be out there, but lies are inside your head
    2. Re:The old classic... by Anonymous Coward · · Score: 0

      Winner!

    3. Re:The old classic... by Anonymous Coward · · Score: 0

      It is probably the most referred to bit of code, but the posts about "for (;;) {}" or "while(1) {}", or "do{ ... } while(1)" are most likely the most used constructs. They probably compile into the same machine code. :-)

  20. cls by Anonymous Coward · · Score: 0

    or some clearscreen derivative ...

  21. Considering the number of Windows installations by Mr.+Sketch · · Score: 1

    My guess would be the code in 'System Idle Process'.

    1. Re:Considering the number of Windows installations by Anonymous Coward · · Score: 0

      > the code in 'System Idle Process'.
      Wich is just one byte of ASM x86 : 0xF4 (HLT).

      (At least that's how it is in my kernel, there might or not be some ACPI magic involved with NT's idle task)

  22. Svchost.dll by Anonymous Coward · · Score: 1

    Go WinXP ftw!

    1. Re:Svchost.dll by Anonymous Coward · · Score: 0

      I think it would be the idle loop on the Voyager spacecraft.

  23. Initialize array to 0 by AuMatar · · Score: 3, Interesting

    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?
    1. Re:Initialize array to 0 by Anonymous Coward · · Score: 2, Insightful

      for almost all programs... written by people who have never heard of memset (or appropriate initializations for std::vector, etc.).

    2. Re:Initialize array to 0 by AuMatar · · Score: 1

      And what do you think memset is doing? Its calling this code, pretty much exactly. So my argument goes unchanged.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    3. Re:Initialize array to 0 by Anonymous Coward · · Score: 1

      Memset may be calling something functionally equivalent to that code (when called with '0' as the char to fill with), but it's highly unlikely to be calling that particular code. Typically, a somewhat more architecture-dependent optimized implementation will be used, e.g. http://www.opensource.apple.com/source/Libc/Libc-167/string.subproj/memset.c .

    4. Re:Initialize array to 0 by hcs_$reboot · · Score: 1

      memset is part of the dev library - i.e. unlike the 'for' loop, when the processor or whatever other component allows a faster initialization, memset is likely to be rewritten to use that new feature, while the compiler - depending on the 'for' loop content - may not be able to guess the mere initialization, and may not use that new proc feature.

      --
      Slashdot, fix the reply notifications... You won't get away with it...
    5. Re:Initialize array to 0 by VortexCortex · · Score: 1

      And what do you think memset is doing? Its calling this code, pretty much exactly. So my argument goes unchanged.

      What my Hobby OS's memset() is doing is an ASM macro which XORs (E)AX with itself to zero it, sets (E)CX register to ( SOME_LENGTH * sizeof( *array ) ) / CPUWORDSIZE, sets ES:DI (or equiv) to point at the start of the array, and issues a REP (repeat) after STOSW or STOSD (store string word / double word) to zero CX times -- Then does the same with STOSB (store string byte) with CX set to the remainder of the aforementioned division (which is actually bit shift / mask). It may need to do some pre-alignment byte writing similar to the post alignment. The REP instruction is the tightest loop possible, existing completely in the CPU instruction itself, this is not "exactly" like a compare and jump that you've written.

      Comparing to zero is faster on every CPU in existence. For tight loops the LOOP instruction decrements CX and branches if not zero all in one instruction, so if the value of i doesn't matter the loop above is better written:

      for( int i = SOME_LENGTH; i --> 0; )
            array[i] = 0;
      }

      If your compiler is smart enough it may do these optimizations for you -- i.e. recognize your dumb code as better replaced via memset -- However, it's not guaranteed to, and from disassembles I've seen that they frequently don't. Some compliers are overly crazed and will vectorize the above loop. In some cases I've had to "unvectorize" the code because the silly compiler assumed that synchronization was cheap, that other threads weren't in use, and profiling showed its overzealous "optimization" to be the bottle neck. It does help having an understanding about what your code is ACTUALLY turning into, despite what you may have been taught.

      That said, most programmers of higher level languages don't understand (or care) what the compiler or hardware is doing, and as so much with your kind, this is considered "mostly harmless". So, you're correct in assuming they'll keep writing moronic for loops like yours -- ignorant that even in JavaScript benchmarks show counting backwards is far faster, sometimes even moreso than 'for each'.

    6. Re:Initialize array to 0 by Anonymous Coward · · Score: 0

      for(int i=0; iSOME_LENGTH; i++){

            array[i] = 0;
      }

      Run 100s of times per program, for almost all programs

      Unfortunate. memset() probably has a better optimized version available.

    7. Re:Initialize array to 0 by Megol · · Score: 1

      And what do you think memset is doing? Its calling this code, pretty much exactly. So my argument goes unchanged.

      What my Hobby OS's memset() is doing is an ASM macro which XORs (E)AX with itself to zero it, sets (E)CX register to ( SOME_LENGTH * sizeof( *array ) ) / CPUWORDSIZE, sets ES:DI (or equiv) to point at the start of the array, and issues a REP (repeat) after STOSW or STOSD (store string word / double word) to zero CX times -- Then does the same with STOSB (store string byte) with CX set to the remainder of the aforementioned division (which is actually bit shift / mask). It may need to do some pre-alignment byte writing similar to the post alignment. The REP instruction is the tightest loop possible, existing completely in the CPU instruction itself, this is not "exactly" like a compare and jump that you've written.

      Comparing to zero is faster on every CPU in existence. For tight loops the LOOP instruction decrements CX and branches if not zero all in one instruction, so if the value of i doesn't matter the loop above is better written:

      Nitpick: comparing to zero is faster for most processors, not all.

      Also REP STOSB isn't the tightest loop in many x86 processors. For some a normal loop with a MOV [...], reg is faster and for most others a normal loop is faster unless (R/E)CX is above some value at entry (a value that depends on the processor).

    8. Re:Initialize array to 0 by Anonymous Coward · · Score: 0

      memset plz

    9. Re:Initialize array to 0 by Anonymous Coward · · Score: 0

      Winner for the most inefficient and verbose way to null an array. Also a lot of languages do not bother to null arrays since it adds overhead when not needed. Fun fact even the Java JIT Compiler avoids nulling instance fields and arrays when it does not have to. When you need it better call a method that maps to a specialized instruction (some compilers might do this for you), or just use a freshly allocated memory page which is already nulled out (most likely also using some hardware feature).

    10. Re:Initialize array to 0 by Anonymous Coward · · Score: 0

      Why not just:

      memcpy(some_ptr, 0, size);

  24. What is a 'Non Assembler Format'? by Bing+Tsher+E · · 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.

    1. Re:What is a 'Non Assembler Format'? by marcello_dl · · Score: 1

      > I think the OP meant 'machine code.'
      machine code OTOH is what gets executed.

      --
      ---- MISSING MISCELLANEOUS DATA SEGMENT --- [sigdash] trolololol
    2. Re:What is a 'Non Assembler Format'? by Anonymous Coward · · Score: 0

      > Assembly language is a high level language.

      It most certainly is not. High-level languages add a level of abstraction above machine language, and assembly does not... it's more or less a mnemonic equivalent of machine language. It's limited to instructions as statements, and typically can't handle complex expressions. It's tied to one particular architecture - its instruction set matches that of the target CPU. Macros are not abstractions, they are shortcuts.

      Even 'C' is described by K&R (in the intro to their seminal book) as "a relatively 'low-level' language."

      Randall Hyde did come up with a High-Level Assembler, but that's the exception, not the rule.

  25. Probably some telphone code by stox · · Score: 3, 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.

    --
    "To those who are overly cautious, everything is impossible. "
    1. Re:Probably some telphone code by rueger · · Score: 2

      And thirty years on many people in Canada are still charged extra each month for "touch-tone service."

    2. Re:Probably some telphone code by failedlogic · · Score: 1

      I'm having the same problem. I'm looking for a cell-phone with rotary dial.

    3. Re: Probably some telphone code by kenh · · Score: 2

      Don't look to the US for sympathy - we paid a tax on our phone service for over a century to pay off the Spanish American War... 108 years to be precise !

      http://usatoday30.usatoday.com/money/industries/telecom/2006-05-25-phone-tax_x.htm

      --
      Ken
    4. Re:Probably some telphone code by Anonymous Coward · · Score: 0

      They're far too rare. I've worked on the 5ESS too, and I know they never made it big time outside the USA. There are perhaps 2000 of them in operation. There's hardly any code running while a regular call is stable (just crossbar switches in Switching Module), too.

    5. Re:Probably some telphone code by stox · · Score: 1

      I think you may have hit the answer, the code running on the DSP's in the line units. 2000x(average # of SM's)x(Average number of Line Units)x(Average # of DSP's per line unit). The DSP's run continuously for the duration of the call.

      --
      "To those who are overly cautious, everything is impossible. "
    6. Re:Probably some telphone code by Anonymous Coward · · Score: 0

      There's an app for that. Several, actually.

      https://play.google.com/store/apps/details?id=com.demarco.rotaryphone

  26. ob by Hognoxious · · Score: 4, Funny

    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."
  27. Highest number of executions by Anonymous Coward · · Score: 2, Interesting

    The keyboard scan loop in Windows gets my vote.

    1. Re:Highest number of executions by Hal_Porter · · Score: 1

      PC keyboards have a micro controller in them that does the keyboard scanning. When it gets a key it triggers an interrupt. The OS reads the scancode from a port for a PS/2 keyboard.

      http://wiki.osdev.org/%228042%22_PS/2_Controller#Interrupts

      If you have a USB keyboard it works the same but instead of IO port access the OS ends up reading the data from a USB Interrupt end point. It sets up linked lists in memory which the (UHCI,OHCI or EHCI) USB host controller scans through to poll the end points at the frequency they request

      So is there a keyboard scan loop? Yes, but it's runs on a micro controller (actually you cold probably set up things on the micro controller so it sits in a halt instruction until there's an interrupt and you get an interrupt when any key is pressed, so you only scan when you know you'll find something for power efficiency). Is there polling? Yes, but the USB host controller does that by looping through a linked list of end point descriptors that the OS set up in memory. There's no code executing on the host CPU.

      Incidentally the USB scheme changes in USB 3.0 and XHCI controllers to save power.

      http://en.wikipedia.org/wiki/Extensible_Host_Controller_Interface#Power_efficiency

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
  28. Almost certainly microcode. by foobar+bazbot · · Score: 1

    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.

    1. Re:Almost certainly microcode. by foobar+bazbot · · Score: 1

      Gah! I missed the "in a non-assembler format" qualifier. I'm not sure what exactly that means, but I suppose it was intended to rule out smart-ass answers like mine.

    2. Re:Almost certainly microcode. by Megol · · Score: 1

      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.

      As do most RISC. There's a difference between a good transport format (the programmer visible ISA) and the execution format (operations optimized for a certain implementation). IBM Power does pretty complex rewriting and even the cleanest commercial RISC ISA ever (the DEC APX/Alpha) had internal operations and cases where one instruction generated two operations.

      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.

      The majority of x86 instructions doesn't use microcode. Cache checks are done in hardware as are TLB checks etc. The most common x86 instruction that uses microcode for execution is probably the REP MOVSx but that isn't used much in comparison to all other instructions.

  29. easy by Espectr0 · · Score: 1

    i=i+1 or i+=1 or i++

    1. Re:easy by wonkey_monkey · · Score: 1

      For the code in question, let's set a lower limit of 3 consecutive lines.

      You have failed to adhere to the asker's arbitrary criteria! Goodnight!

      --
      systemd is Roko's Basilisk.
    2. Re:Easy by Mr+Z · · Score: 1

      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.

      Somehow I don't think your entry is in the spirit of the question.

      As far as the original question is concerned: If you don't tie to any particular program, but just a subroutine used everywhere, heavily, I think memcpy() is a contender. (Pick a memcpy() implementation to put here to reach the 3 line minimum.) You'd be surprised how many programs' run times are dominated by memory copies.

  30. For Windows users by Circlotron · · Score: 1

    Probably the embedded code in keyboards that handles CTRL-ALT-DEL.

    1. Re:For Windows users by ericloewe · · Score: 1

      There is no such code in keyboards. All that happens is that the OS never forwards this particular combination of keys to any piece of code that may be running.

  31. Given that the C64 is the best selling PC ever... by Quarters · · Score: 1

    ...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.

  32. Login.c by Lawrence_Bird · · Score: 1

    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.

  33. My guess by bunratty · · Score: 1

    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.
  34. It's obvious... by Tomahawk · · Score: 1

    int main (argc, argv)
    char **argv;
    {

    1. Re:It's obvious... by wonkey_monkey · · Score: 1

      At the risk of a "whoosh," none of that actually runs, though, does it?

      --
      systemd is Roko's Basilisk.
    2. Re:It's obvious... by osu-neko · · Score: 1

      That's extraordinarily unlikely. There are bits of OS code that get executed millions of times more often than a new program gets launched.

      --
      "Convictions are more dangerous enemies of truth than lies."
    3. Re:It's obvious... by Anonymous Coward · · Score: 0

      At the risk of a "whoosh," none of that actually runs, though, does it?

      Well, not sure what the parent meant, but something runs in a way Somehow those parameters get pushed to an appropriate place. Something else knows where to look to find the parameters passed in.

      This is actually a very good answer. Any C-like program that starts must do something to get parameters from the command-line (or equivalent) and put them somewhere where later code knows where to fetch them from.

      Parent might be hinting at this or not, but that is not a bad answer. The typical case, however, is that stuff will only executed once -- you don't typically call main() again from the same program. So I think such argument passing/retrieving code is likely executed a whole lot (any time some program starts perhaps) although it is likely only ran once per program run, so the total might not be that large.

      Which makes the usefulness of this answer boil down to: do typical programs on typical systems run for a short while, with many different programs coming and going? Or is it more that long-running programs start once and stick around in the background for a long time, rarely exiting and starting up again?

    4. Re:It's obvious... by Anonymous Coward · · Score: 0

      Lines of code don't run in any case.
      The binary instructions created from the are executed.

  35. Re:Something in deep in a loop in the graphics sys by Frosty+Piss · · Score: 1

    ...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.
  36. HTTP Get Request by Anonymous Coward · · Score: 0

    The code that sends

    HTTP_GET("insert URL of porn site here")

  37. the answer is 42 by Anonymous Coward · · Score: 0

    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"
    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 ..." or "... non-python format"
    http://en.wikipedia.org/wiki/Assembly_language

    (sorry for not writing so good english)

  38. Multiple choice? by jo7hs2 · · Score: 1

    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.

  39. I am not in a position to know, however... by Anonymous Coward · · Score: 0

    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.

  40. idle time by Tomahawk · · Score: 1

    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.)

    1. Re:idle time by dak664 · · Score: 1

      On modern operating systems the idle loop is never coded in a high level language. It is painstakingly optimized in assembly language, for maximum speed.

    2. Re:idle time by mhotchin · · Score: 1

      You jest, but... Doesn't every system idle process in existence essentially halt the CPU until there's something to do?

      It's even possible that the so-called system idle process is just a book-keeping artifact for the OS to assign idle time to (in the depths of the scheduler), with no actual process running...

    3. Re:idle time by tigersha · · Score: 1

      Yes, it calls a halt otherwise the machine's fan would run all the time and a cell phone would have a battery life of about 10 minutes.

      It is scary how many people here talk about idle loops. The CPU halts and the timer interrupts it.

      --
      The dangers of excessive individualism are nothing compared to the oppressiveness of excessive collectivism
    4. Re:idle time by dak664 · · Score: 1

      The idle loop is alive and well in embedded systems. In some cases energy use is minimized by using a slow clock chosen for some small fraction of idle time, in others by sleeping between bursts of fast processing.

      x86 idle power reduction under unix started sometime in the late 1990s
      https://blogs.oracle.com/bholler/entry/the_most_executed_code_in

      Other OS starting using it around 2000
      http://en.wikipedia.org/wiki/System_Idle_Process

      Thus seti@home launched in 1999 could legitimately claim it made use of otherwise wasted CPU cycles on the Mac and Windows 95 clients.

  41. bad by Anonymous Coward · · Score: 0

    sorry i mean bad english :)

  42. Code bottleneck by Anonymous Coward · · Score: 0

    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.

  43. code between semicolons? by Haven · · Score: 1

    i++

    or

    MOV EAX, [EBX]

    or

    INC EAX

  44. XP kernel32.dll by Billly+Gates · · Score: 1

    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.

  45. nope by Anonymous Coward · · Score: 0

    genetic code is not one genuine piece of code

  46. Nobody has suggested by Anonymous Coward · · Score: 0

    printf, itself? For debugging, for testing, for actual work...

    1. Re:Nobody has suggested by Anonymous Coward · · Score: 0

      I second this. This would also include all of the traditional Hello World programs and pretty much every other C program, too. Even GUI applications use printf for error messages when run from a terminal.

  47. Cell Phone code? by MrLogic17 · · Score: 1

    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?

  48. Question is very ambiguous by YoungManKlaus · · Score: 1

    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!)

    1. Re:Question is very ambiguous by osu-neko · · Score: 1

      ...and if it's not written in assembler, it's probably not three lines. I think the entirety of the code in memcpy looks something like:

      while ( n-- ) *d++ = *s++;

      --
      "Convictions are more dangerous enemies of truth than lies."
    2. Re:Question is very ambiguous by Megol · · Score: 1

      memcpy tends to be optimized so yes, it's most likely much more than three lines of code. Checking special cases takes some code...

    3. Re:Question is very ambiguous by YoungManKlaus · · Score: 1

      ack, see glibc's version here, and that has a bunch of macros in it... http://fossies.org/dox/glibc-2.18/string_2memcpy_8c_source.html

  49. Hardware design languages by Anonymous Coward · · Score: 0

    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.

    1. Re:Hardware design languages by Anonymous Coward · · Score: 0

      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.

      Probably not, because each x86 microarchitecture has a different microcode format.

  50. Re:Solved. Next? by Anonymous Coward · · Score: 0

    Is genetic code more akin to executable code or some type of markup, or ...what?

  51. I reckon... by Jaruzel · · Score: 1

    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
    1. Re:I reckon... by Anonymous Coward · · Score: 0

      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.

      Someone should replace it with a HOSTS file. (No, apk, go away! It was a joke!)

      On a more serious note, a DNS-lookup is just a bunch of calls to send() and recv() (or sendto()/recvfrom() or sendmsg()/recvmsg()). Those functions are used for a lot of other stuff besides DNS-lookups and are therefore used a lot more than the code for e.g. gethostbyname(), so I would nominate them instead.

      If I can only nominate one of them, I pick send() as you can't be sure anyone will every recv() your UDP-datagrams.

  52. Re:Given that the C64 is the best selling PC ever. by Anonymous Coward · · Score: 0

    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.

  53. the windows interrupt handler by MarcAuslander · · Score: 1

    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).

  54. Pi by sgt+scrub · · Score: 1

    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.
  55. waiting for keyboard input by Anonymous Coward · · Score: 0

    getline() - low speed users

  56. Microcontrollers... by atari2600a · · Score: 1

    ....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.

  57. Re:Something in deep in a loop in the graphics sys by glavenoid · · Score: 1

    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 /. beta rollout fallout.
  58. easy @ECHO by Anonymous Coward · · Score: 0

    @echo off

  59. Borg's backdoor by gmuslera · · Score: 1

    The code for sleep() should be the most executed code.

  60. boot up code by zakeria · · Score: 0

    for windows

  61. basic *nix commands or TCP/IP by Anonymous Coward · · Score: 0

    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

  62. Re:Solved. Next? by wonkey_monkey · · Score: 1

    Insightful? Come off it. It's a pun.

    --
    systemd is Roko's Basilisk.
  63. It's all math by monkeyhybrid · · Score: 1

    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?

    1. Re:It's all math by Anonymous Coward · · Score: 0

      how would you describe a goto in terms of math?

    2. Re:It's all math by Anonymous Coward · · Score: 1

      There are three abstract classes of instructions: 1) mathematical operations, 2) memory load/store, 3) control flow (goto, if, etc). In practice real CPU instructions are often not classifiable as purely one or another.

    3. Re:It's all math by monkeyhybrid · · Score: 1

      Hmm, good point! Maybe I should have said that all algorithms can be reduced to math.

    4. Re:It's all math by monkeyhybrid · · Score: 1

      Yeah, I really shouldn't have added my second sentence regarding 'all software instructions'. Typing faster than my brain was thinking and all that...

    5. Re:It's all math by TapeCutter · · Score: 1

      MOV IP X

      --
      And did you exchange a walk on part in the war for a lead role in a cage? - Pink Floyd.
    6. Re:It's all math by Anonymous Coward · · Score: 0

      Key phrase you missed is 'work they do' doesn't refer to the actual instructions. Noting that 'string manipulation' is certainly a form of math but the instructions used tend to be different than the those used for in finite element analysis. The rumination on the type of work computers are actually tasked with points one to what type of code is likely most often executed.

      Also, everyone posting answers like "NOP" let me be the second or third to say, read the FA you retard. Or better consign yourself to merely lurking for the rest of your life.

  64. fractal geometry by ihtoit · · Score: 1

    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
  65. PPPd by Anonymous Coward · · Score: 0

    PPPd on Android. it runs the IP connection.

  66. Logic Gates by PerlHeadJax · · Score: 1

    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).

  67. Trick question by Anonymous Coward · · Score: 0

    Anything sufficiently complex that runs that many times on that many machines is likely worth optimizing in assembly.

  68. Re:Solved. Next? by Anonymous Coward · · Score: 1

    Looking at most linux desktop apps.. it's GetTimeOfDay()

  69. Simple by Anonymous Coward · · Score: 0

    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.

  70. Re:gcc -ansi by Anonymous Coward · · Score: 0

    #include
    main(void)
    {
            return 0;
    }

  71. Just my guess. by GrpA · · Score: 1

    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?
  72. Scrypt by mysidia · · Score: 2, Interesting

    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;

    }

    1. Re:Scrypt by x0ra · · Score: 1

      you don't need to cast 'void' pointers...

    2. Re:Scrypt by gargeug · · Score: 1

      Didn't know this. I just started using void* last week, so your comment is timely to prevent a bad habit from forming. Thanks.

    3. Re:Scrypt by Anonymous Coward · · Score: 1

      In C you don't, but in C++ you do.

    4. Re:Scrypt by Anonymous Coward · · Score: 0

      Unless C++ ...

    5. Re:Scrypt by Anonymous Coward · · Score: 0

      It also has way too much white space.

    6. Re:Scrypt by Anonymous Coward · · Score: 0

      No, that code sample needs to be casted. The function is assuming that blah is actually an array. The pointer to the first element is passed in as an argument, but you have to tell the compiler what the size in bytes is of each element. Casting the pointer to a uint8_t means that z[1] is one byte after z[0]. You can't have an array of "voids," because how many bytes wide is a "void"?

      Casting blah to uint16_t, for example, makes the compiler look two bytes after z[0] for the next element, z[1].

    7. Re:Scrypt by Anonymous Coward · · Score: 0

      you don't need to cast 'void' pointers...

      ...unless you're programming in C++.

    8. Re:Scrypt by jschultz410 · · Score: 1

      You are correct that he needs the variable z, but incorrect that he has to cast 'blah' to (uint8_t*).

      In C you are not required to cast from (void*) to other kinds of pointers (e.g. - uint8_t*) -- the compiler will do this automatically for you without complaint. In C++ you are, so you generally should always add the cast (e.g. - the return value from malloc) in case your C code gets compiled as C++ at some point.

      It looks like he is serializing a 32b unsigned integer out to a buffer in big endian format.

    9. Re:Scrypt by Anonymous Coward · · Score: 0

      you don't need to cast 'void' pointers...

      I just do it for the lols anyway

    10. Re:Scrypt by Anonymous Coward · · Score: 0

      You do in C++, he didn't say that was C. :)

    11. Re:Scrypt by Njovich · · Score: 1

      It can add clarity to always match up the exact types of left and right sides of equations and function arguments.

      So for some it will be appreciated, even though you are absolutely correct that it's not necessary (assuming C).

    12. Re:Scrypt by Anonymous Coward · · Score: 0

      Ah yes... you are right. Thanks.

  73. Not without a patent by Anonymous Coward · · Score: 0

    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!

  74. Re:Solved. Next? by Fnordulicious · · Score: 2

    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.

  75. ls(1) by SteveR · · Score: 1

    If you're just considering userspace, then perhaps good old ls(1). I must run it hundreds of times a day.

    1. Re:ls(1) by Anonymous Coward · · Score: 0

      If you're just considering userspace, then perhaps good old ls(1). I must run it hundreds of times a day.

      Especially right after mkdir foo ; cd foo, right?

  76. IEFBR14 by kenh · · Score: 1

    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
  77. Some kind of idle loop by amorsen · · Score: 1

    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?
    1. Re:Some kind of idle loop by mhotchin · · Score: 1

      The modern kernel idle loop should be halting the CPU until there's work to do. It probably doesn;t spin that much, really.

  78. DNA by Anonymous Coward · · Score: 0

    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.

  79. Microcode by istartedi · · Score: 1

    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"?
  80. Re:Solved. Next? by Anonymous Coward · · Score: 0

    Isn't that in assembler format? If only genetic code had source code comments ...

  81. Re: Given that the C64 is the best selling PC ever by kenh · · Score: 1

    Or print chr(7)

    AKA Control G, it triggered a bell sound...

    --
    Ken
  82. who by NEDHead · · Score: 1

    cares?

  83. Re:Solved. Next? by Anonymous Coward · · Score: 0

    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.

  84. Re:Solved. Next? by Anonymous Coward · · 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).

  85. Registers by Anonymous Coward · · Score: 0

    Surely it would have to be a copy/put into a cpu register

  86. Fast Fourier Transform by hism · · Score: 1

    I'll bet the Fourier transform is up there. Especially if you count the hardware implementations.

    1. Re:Fast Fourier Transform by Endloser · · Score: 1

      Considering this is necessary for DOCSIS and QAM I would agree. There is really no way of know what is the most used. But this algorithm has to be somewhere in the top; specifically FFT.

  87. Its NOP by Anonymous Coward · · Score: 0

    NOP - placeholder for every 'wait for user input' code everywhere.

  88. Genetic code? Genetic code? by Anonymous Coward · · Score: 0

    The poor poster did say "regarless of CPU type", but I think he mean SILICON hardware, not biological hardware.

  89. Re:Something in deep in a loop in the graphics sys by Nutria · · Score: 1

    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
  90. NO-OP by Anonymous Coward · · Score: 0

    /* most common code ever */

    ; /*noop*/

    1. Re:NO-OP by Anonymous Coward · · Score: 0

      { /*FIXME: */
            return;
      }

  91. Clock counting loops by msobkow · · Score: 2

    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.
    1. Re:Clock counting loops by xaj · · Score: 1

      Agreed Not exactly sure how to narrow this down--but the sequence responsible for motherboard clocks is most likely the winner.

    2. Re:Clock counting loops by Anonymous Coward · · Score: 0

      No. Digital clocks are five to ten orders of magnitude slower than modern CPUs and GPU:s and there aren't five to ten orders of magnitude more clocks than modern CPUs and GPUs. 40 years means nothing in this context. Do the math.

    3. Re:Clock counting loops by PPH · · Score: 1

      Actually, the same issue applies. Microprocessor firmware (not a part of this survey) generates an interrupt every so many milliseconds (a 'jiffy' in the Linux world). So even for a multi gigahertz machine, that could still be relatively slow.

      --
      Have gnu, will travel.
  92. Three lines? by Richy_T · · Score: 1

    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.

  93. while() and everything else runs Intel microcode by raymorris · · Score: 1

    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.

  94. The Answer by Anonymous Coward · · Score: 0

    Something mice installed.

  95. Floating Point tricks by mdccxxix · · Score: 1

    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.

  96. Obama by Alsee · · Score: 0

    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.
  97. Re: by Anonymous Coward · · Score: 0

    If we're counting number of clock cycles consumed rather than wall clock execution time then I'd say the NAG Fortran FFT library.

  98. It's pretty hard to say where to draw the line by putaro · · Score: 1

    As far as functions, I'd say bcopy().

  99. Re:while() and everything else runs Intel microcod by dreamchaser · · Score: 1

    Technically, all code of any kind winds up being executed as microcode.

  100. Re:while() and everything else runs Intel microcod by Murdoch5 · · Score: 1

    Fair enough, I just assumed this post meant higher then ASM. However you'd also have to find the three most used lines.

  101. Some Suggestions by Anonymous Coward · · Score: 0

    Some suggestions:-

    1. Re:Some Suggestions by Anonymous Coward · · Score: 0

      When it comes to the amount of computation performed, FFT/DFT/DCT etc. surely ranks much higher than PRMan and such. (Don't the optical mice run it, too?)

  102. The Windows Loop by Cassini2 · · Score: 1

    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.

    1. Re:The Windows Loop by Hal_Porter · · Score: 1

      This loop is called even when the CPU goes idle, in order to implement the OnIdle call in MFC

      GetMessage will block until a message is received. That being said MFC apps do call OnIdle when the message queue is empty. Mind you if you look at CWinThread::Run() you only call OnIdle() message when the queue becomes empty not when it stays empty.

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
  103. Re:while() and everything else runs Intel microcod by dreamchaser · · Score: 1

    I meant to add on CISC processors at least. RISC and VLIW CPUs do not use microcode.

  104. Well, duh... by Anonymous Coward · · Score: 0

    10 PRINT "If you read this you're stupid"
    20 GOTO 10

  105. Old skool, plz! by Anonymous Coward · · Score: 0

    10 GOTO 10 ;)

  106. Re:while() and everything else runs Intel microcod by angel'o'sphere · · Score: 1

    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.
  107. Can't imagine how this isn't it... by Anonymous Coward · · Score: 0

    If ()

  108. Re:while() and everything else runs Intel microcod by dreamchaser · · Score: 1

    See my addendum.

  109. Google Analytics by Fatty · · Score: 1

    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.

  110. absolutely context switch by Anonymous Coward · · Score: 0

    ..by far. this would be more interresting as a poll, BTW! :)

  111. Bubble sort by Tony+Isaac · · Score: 1

    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.

  112. Re:Solved. Next? by multimediavt · · Score: 1

    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?

  113. Re:Solved. Next? by Anonymous Coward · · Score: 0

    DNA is a markup language for proteins. RNA is like javascript and CSS. Cells are like self-replicating web pages.

  114. Car engine computer? by goodmanj · · Score: 1

    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.

  115. The answer is obvious by Anonymous Coward · · Score: 0

    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.

  116. Basic by Anonymous Coward · · Score: 0

    10 cls
    20 goto 30
    30 goto 10

  117. Idle loop by manu0601 · · Score: 1

    kernel idle loop is a good candidate.

  118. Signal processing is everywhere.... by Anonymous Coward · · Score: 0

    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...

  119. TCP by Anonymous Coward · · Score: 0

    What about the code that handles tcp/ip decoding /encoding?

  120. Beautiful by Anonymous Coward · · Score: 0

    No word can describe.

  121. Easy: the code that by Anonymous Coward · · Score: 0

    makes the blue screen come up.

  122. if ie - then do random nonsensical stuff by krups+gusto · · Score: 1

    Special instructions for IE 6 here

  123. Simple... by Anonymous Coward · · Score: 0

    You need to be punched in the face repeatedly. It should keep happening until your face caves in.

    1. Re:Simple... by Anonymous Coward · · Score: 0

      That sounds like the candidate for the most often-run piece of code -- ever!

  124. Three finger salute by Anonymous Coward · · Score: 0

    Which ever code handles the interrupt called by pressing ctl+alt+del.

  125. Re:Solved. Next? by Anonymous Coward · · Score: 0

    compiled, and the protein is executed out of order and asynchronously. Neato parallel processing!

  126. syscall(...) by Anonymous Coward · · Score: 0

    most useful functions will make at least 1 syscall

  127. Variable Assignment by Anonymous Coward · · Score: 0

    A = B

  128. In terms of CPU hours by Dunbal · · Score: 1

    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.
    1. Re:In terms of CPU hours by ericloewe · · Score: 1

      Good luck finding a modern OS that actually idles instead of just invoking a higher sleep state on the processor.

  129. NSA by dohzer · · Score: 1

    Turns out it's the injectPacket() function that the NSA uses on the DSP inside every USB connector ever manufactured.

  130. Most common code x++ by hackus · · Score: 1

    gets my vote.

    -Hackus

    --
    Got Geometrodynamics? Awe, too hard to figure out? Too bad.
    1. Re:Most common code x++ by iggymanz · · Score: 1

      not sure it would be letter x

            I'd say i++

  131. Re: while() and everything else runs Intel microco by Anonymous Coward · · Score: 1

    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

  132. Re:Solved. Next? by Anonymous Coward · · Score: 3, Interesting

    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.

  133. Windows stack traceback code used to show BSOD by MouseTheLuckyDog · · Score: 1

    Which is probably used by several other windows program to display their stack traces too.

  134. Bitcoin Hash by Anonymous Coward · · Score: 0

    Nuff said...

  135. Reading is Fundamental by Anonymous Coward · · Score: 0

    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!

  136. may be useful, if known by v4vijayakumar · · Score: 1

    Most executed code could then moved to microprocessor instruction set.

  137. appliance microcontroller in the 60s??? by iggymanz · · Score: 1

    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?

    1. Re:appliance microcontroller in the 60s??? by ihtoit · · Score: 1

      the first commercially available integrated microcontroller (the Texas Instruments TMS1000) wasn't released until 1974. The design specification was scored in 1971, the same year as TI also released the first system-on-a-chip which consisted of six modules in a common package (the TMS1000 was basically the same six modules on the same die).

      Not bad considering the solid state transistor was invented in 1925 (Lilienfeld).

      --
      Political debates have me rolling my eyes so much I think I got optical whiplash. I should sue. - Foamy The Squirrel
    2. Re:appliance microcontroller in the 60s??? by iggymanz · · Score: 1

      but Lilienfield only had idea, no proof he ever made working device. crystals of the required purity didn't exist.

  138. file IO by Anonymous Coward · · Score: 0

    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^^)

  139. Re:Solved. Next? by Rich0 · · Score: 1

    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.

  140. The code which executes... by gishzida · · Score: 1

    the BSoD stack dump...

  141. It seems fairly obvious. by MouseTheLuckyDog · · Score: 1

    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.

    1. Re:It seems fairly obvious. by Mr+Z · · Score: 1

      It's probably something even more prosaic, such as memcpy(), memmove() or similar. Simple, correct, broadly distributed, and needed by nearly every program ever written, either directly or indirectly, regardless of the language it's written in.

  142. Re:Solved. Next? by Anonymous Coward · · Score: 0

    Genetic code is executed all the time in Texas.

  143. The most often used? by Ralph+Spoilsport · · Score: 1

    Probably some "get" command.

    --
    Shoes for Industry. Shoes for the Dead.
  144. Answer: by Anonymous Coward · · Score: 0

    I think the winner would be -

      print("Hello world");

  145. Re:Given that the C64 is the best selling PC ever. by tigersha · · Score: 1

    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
  146. TCP packet create, xfer, or receive by Maow · · Score: 1

    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.

  147. Someone might die for saying by Anonymous Coward · · Score: 0

    Very likely the inner loop of something that can't be discussed.

  148. QED. by solios · · Score: 1

    Answers like this make Slashdot great. :-)

  149. Re:Solved. Next? by Vesvvi · · Score: 1

    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.

  150. HTTP Handshake? by Anonymous Coward · · Score: 0

    That's got to be the same on any platform, yes? Even the simplest user surfs the web.

  151. stack allocation by Anonymous Coward · · Score: 0

    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.

  152. There can only be two possible answers. by Anonymous Coward · · Score: 0

    0 or 1. Not sure which is executed more. Probably 0.

  153. NOP, NOP, NOP by SpaceLifeForm · · Score: 1

    Unless malware is declining these days.

    --
    You are being MICROattacked, from various angles, in a SOFT manner.
  154. Windows boot by virtigex · · Score: 1

    Either that or the Ctl-Alt-Delete stuff

  155. Easy by KliX · · Score: 1

    "xor eax, eax"

  156. Bourne Again Shell by mbeckman · · Score: 1

    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.

  157. monitor frame buffer by globaljustin · · Score: 1

    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
  158. Windows.Reboot() by mtthwbrnd · · Score: 2

    followed closely by...
    Java.InstallUpdate()

  159. router/switch by globaljustin · · Score: 1

    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
  160. Probably something in TRON (not the movie!) by Mr+Z · · Score: 1

    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.

  161. I'm pretty confident about this one..... by Ion+Berkley · · Score: 1

    ...but how many folks understand the significance of this?

    @(posedge clk)
    {
    a = b;
    }

    1. Re: I'm pretty confident about this one..... by mpdcsup · · Score: 1

      a latch? seriously

    2. Re: I'm pretty confident about this one..... by aprdm · · Score: 1

      This is not a latch. It's a ff.

    3. Re: I'm pretty confident about this one..... by mpdcsup · · Score: 1

      A FF and a latch are the same thing.

    4. Re: I'm pretty confident about this one..... by aprdm · · Score: 1

      haaaaaaa no they are not. http://blog.digitalelectronics...

    5. Re: I'm pretty confident about this one..... by mpdcsup · · Score: 1

      cite anything you want to, the internet holds nothing but truth. show me the difference in a stick diagram and i'll show you your error.

    6. Re: I'm pretty confident about this one..... by aprdm · · Score: 1

      There is a diagram there, latches and flip-flops are very different one from another. The only thing they have in common is the storage capability. I am an ASIC engineer.. i design chips for living...

    7. Re: I'm pretty confident about this one..... by mpdcsup · · Score: 1

      sounds like you're just looking to pick a fight, might be a bit insecure, and gotta be right. what does this have to do with the original post or with the comment i was commenting on? so here's the defense: latches are flip-flops despite your claim that they are not. your argument that the code in the original comment is a flip-flop may be more accurate than my quick observation that it is a latch, but the better answer is, "it is a clocked flip-flop". real-world or practicing engineers seek to overcome hurdles--linguistic and otherwise--to close gaps. i'd wager a valuable sum that engineers seeing my first comment would recognize immediately that in calling the code a latch, that i realized its purpose: to preserve the state of a sample input in a pipeline--thus latching on to a value. they would have also forgiven the technical error and probably would have assumed i was accustomed to working in the analog world.

    8. Re: I'm pretty confident about this one..... by aprdm · · Score: 1

      Ok but you are wrong :D @(clk) { if clk= 1 a = b end if } there goes your latch @(clk) { if rising_edge(clk) a = b end if } there goes your ff cheers

    9. Re: I'm pretty confident about this one..... by mpdcsup · · Score: 1

      no. i'm not.

  162. microcode? by shentino · · Score: 1

    Anyone think about microcode running inside modern CPUs?

    They're practically miniature computers themselves.

  163. Porn Snippet by Anonymous Coward · · Score: 0

    Whichever code snippit is critical to porn.

  164. But what is the oldest still in use? by Anonymous Coward · · Score: 0

    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.

  165. Re:while() and everything else runs Intel microcod by angel'o'sphere · · Score: 1

    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.
  166. goto by Anonymous Coward · · Score: 0

    Ok maybe not : )

  167. Reality's Algorithm by Anonymous Coward · · Score: 0

    var birth = x;

    var death = y;

    Function existence(birth,death) {

    for( birth = 0; birth < death; birth++; ){

    Sleep;

    Eat;

    Fuck;

    }

    return death;

    }

  168. Unroll that loop! by Anonymous Coward · · Score: 0

    while (1)
    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);
    /* NOTREACHED */

    That should speed things up a little.

  169. TCP Packet checksum by petes_PoV · · Score: 1

    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
  170. Easy. by SuricouRaven · · Score: 1

    It's the code that calculates the results from each molecular interaction.

  171. Re:while() and everything else runs Intel microcod by Anonymous Coward · · Score: 0

    The majority of instructions are NOT MICROCODED.

  172. I'm pretty sure its that program... by Anonymous Coward · · Score: 0

    ... that pops up and asks you if you would like to send an error report to Microsoft or just dismiss the dialog.

  173. In Windows by jandersen · · Score: 1

    ... the boot sequence?

  174. Re:Something in deep in a loop in the graphics sys by zlogic · · Score: 1

    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.

  175. Mega Data by Anonymous Coward · · Score: 0

    I'm guessing it will be something dealing with ginormous data streams. The something at the LHC, NSA, internet core routers...

  176. Salut Hugo! by Anonymous Coward · · Score: 0

    :-)

  177. Re:Something in deep in a loop in the graphics sys by jones_supa · · Score: 1

    Because we know there's nothing like that in the Linux kernel...

    Well, we could look at the source code and find out.

  178. Re:while() and everything else runs Intel microcod by Megol · · Score: 1
    No. Not even close even when taking your later post (specifying CISC processors) into account. There are many CISC processors that never used microcode at all and even the most used CISC processor - the x86 - use microcode only for complex tasks. All common instructions are executed natively.

    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.

  179. Some kind of wait/delay loop. by Ihlosi · · Score: 1

    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).

  180. OMG dont tell him!!!! by hlavac · · Score: 1

    He wants to patent these three lines of code, and he will succeed! We are so screwed :)

  181. McAfee virus scan? by tomhath · · Score: 1

    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

  182. MPI calls: MPI_Send/MPI_Recv and co by kefalonia · · Score: 1
    OK, I think there is a fair proposition about this question.

    First, let's agree on some observations:
    • * The per-clock throughput of CPUs has been on an exponential increase curve, per last decades, ie. last 20-30 years matter a lot
    • * The proliferation of silicon compute devices has been on the increase for decades, ie last 10-20 years matter a lot (from the very small to the very big)
    • * The duty cycle of most silicon devices is not 100%; there are two notable exceptions: infrastructure (embedded) systems and supercomputers
    • * Parallel computation implies fast interconnects for quick message passing; for some initial info, ref. https://computing.llnl.gov/tutorials/parallel_comp/
    • * Despite regular interconnect technology upgrades, MPI has been the agreed standard for message passing since the early 90s

    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...

  183. NOP by eexaa · · Score: 1

    NOP.

    srsly.

  184. HA2 algorithm for Bitcoin mining on an ASIC??????? by zwarte+piet · · Score: 1

    They don't run code you uninformed clod. The algortithm is just expressed in combinatory logic. That is what they get their speed from.

  185. Mainframe exit by allypally · · Score: 1

    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

    1. Re:Mainframe exit by maxwell+demon · · Score: 1

      That looks very much like assembly language to me. Which was explicitly excluded in the question.

      --
      The Tao of math: The numbers you can count are not the real numbers.
  186. Hepatities by Tomas+Davis · · Score: 1

    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.

  187. Network Device packet handler by maaziz · · Score: 1

    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.

  188. Physics... by Anonymous Coward · · Score: 0

    1. Sum (Fi) = 0;
    2. F = dp / ft;
    3. Fa = -Fb.

    And not only on this planet...

    1. Re:Physics... by Anonymous Coward · · Score: 0

      As for the second, it should read: F = dp /dt, obviously.

  189. BSoD by Anonymous Coward · · Score: 0

    The code that causes a BSoD

  190. mynut won; the 'love' digits by Anonymous Coward · · Score: 0

    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....

  191. Windows System Idle Process by guygo · · Score: 1

    has to be the most executed code ever.

  192. Re:Solved. Next? by Anonymous Coward · · Score: 0

    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.

  193. Boilerplate by BlackHawk-666 · · Score: 1

    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.
  194. Windows Logon.Bat by The+Other+White+Meat · · Score: 1

    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... ---
  195. A check for null by Anonymous Coward · · Score: 0

    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.

  196. BSOD() by kimgkimg · · Score: 1

    BSOD message handler?

  197. Windows by Anonymous Coward · · Score: 0

    I'd say either the patch code or the reboot code?

  198. Excactly, just a different kind of computer. by Anonymous Coward · · Score: 0

    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

  199. Swap values by Anonymous Coward · · Score: 0

    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.

  200. Swap by mpdcsup · · Score: 1

    int C = A; A = B; B = C; Though I like to write the swap: A += B; B = A - B; A = A - B;

  201. Anything related to a binary tree by esarjeant · · Score: 1

    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

  202. In psuedo code by Spiked_Three · · Score: 1

    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.
  203. BSOD by oldestgeek · · Score: 1

    over and over and...

  204. Gauss Seidel iteration by EngineeringStudent · · Score: 1

    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.

  205. Assembly code used for setting up functions. by Anonymous Coward · · Score: 0

    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.

  206. Re:Solved. Next? by Anonymous Coward · · Score: 0

    It’s not really executable as I understand it,

    Oh, it's definitely executable. Living things get executed all the time.

  207. alert by Anonymous Coward · · Score: 0

    alert('test');

  208. I may just own this one... by SplawnDarts · · Score: 1

    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.

  209. After a moment's reflection by Anonymous Coward · · Score: 0

    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.

  210. Machine code? Easy by ebvwfbw · · Score: 1

    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.

  211. Windows 98 by xded · · Score: 1

    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?

  212. As the computer said... by cwsumner · · Score: 1

    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...

  213. Back in the day you saw this a lot by Anonymous Coward · · Score: 0

    10 clr
    20 Print"HELLO WORLD. ";:Goto 20

  214. Somewhere in the Linux Kernel by Anonymous Coward · · Score: 0

    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.

  215. In USA, the Anthem is the most run piece of code. by Ruralhack · · Score: 0

    Allahmerica!!!

  216. zlib. next question by Anonymous Coward · · Score: 0

    The answer is the zlib library. You bore the world with your inane question.

  217. Quick question by Anonymous Coward · · Score: 0

    How is idle loop and stdio.h not the right answer?

  218. Re:Live CSS Fiddling tool by foobar+bazbot · · Score: 1

    Cool, thanks!

  219. Internet backbone router IP Stack? by kamathln · · Score: 1

    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?

  220. Minor Page Fault Code by MrKaos · · Score: 1

    That moves code and data between memory and the processor cache when there is a cache miss.

    --
    My ism, it's full of beliefs.
  221. codepiece by Anonymous Coward · · Score: 0

    hello world

  222. Summary by hugo.villeneuve · · Score: 1

    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.

  223. TCP/IP by Anonymous Coward · · Score: 0

    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.

  224. Going by the quality of code I see by terjeber · · Score: 1

    It's probably

    bool somVar = someFunction();
    if( someVar == true ) {
    // some code
    }
    else if( someVar == false ) {
    // some code
    }
    else {
    // Lots of code
    }

  225. Re:Solved. Next? by Rich0 · · Score: 1

    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.

  226. GOTO 10 by Anonymous Coward · · Score: 0

    10 PRINT "HELLO"
    20 GOTO 10

    1. Re:GOTO 10 by Anonymous Coward · · Score: 0

      Stop. You had me at "10." :)

  227. mouse software? by deanayer · · Score: 1

    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.

  228. Code by Anonymous Coward · · Score: 0

    Everyone who ever learned to program wrote this code

    10 print "Hello World"
    run

  229. ASIC by countach · · Score: 1

    If it's in an ASIC, it's not actually code is it? Otherwise the "code" would probably be some microcode inside Intel CPUs.