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

343 of 533 comments (clear)

  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 Ragzouken · · Score: 5, Funny

      for(;;)
      {
      }

      while(1)
      {
      }

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

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

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

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

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

    9. 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
    10. 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."

    11. 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.
    12. 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.
    13. 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.

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

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

    16. 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'
    17. 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.
    18. 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.
    19. 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.

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

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

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

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

    24. 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.
    25. 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
    26. Re:For / While in C by ILongForDarkness · · Score: 1

      Oh snap :)

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

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

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

      If
      then
      else

    31. Re:For / While in C by richy+freeway · · Score: 1
    32. 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).

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

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

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

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

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

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

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

      i++,
      and
      ++i;

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

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

      i guess a microcontroller has less precision

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

    41. 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.
    42. 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
    43. 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.

    44. 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
    45. 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.
    46. Re:For / While in C by jones_supa · · Score: 1

      True...

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

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

      Thank you Ted, that was the joke.

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

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

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

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

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

    56. 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"
    57. Re:For / While in C by constpointertoconst · · Score: 1

      A tautology is a tautology.

    58. 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 rolfwind · · Score: 1

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

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

    7. 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.
    8. 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;
    9. 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.

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

      error: out of memory in 40

      --
      ---- Teach Peace. It's Cheaper Than War.
    11. 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.

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

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

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

      Your comment sucks and is below standard.

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

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

      55 system ("pause")

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

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

    19. 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);}
    20. 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.
    21. 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.

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

    23. 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!
    24. Re:Obligatory by segin · · Score: 1

      54 REM NOTREACHED

    25. 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
    26. Re:Obligatory by kumanopuusan · · Score: 1

      Not that one.

      --
      Use of the words "good", "bad" or "evil" is almost invariably the result of oversimplification.
    27. 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 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!
    4. 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.
    5. 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?
    6. 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."
    7. 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.

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

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

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

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

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

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

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

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

      Most idle cycles probably goes to different malware and botnets.

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

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

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

    20. 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!
    21. 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...

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

    24. 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
    25. 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!
    26. 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.
    27. 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.
    28. 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.

    29. 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});
    30. 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.

    31. 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
    32. 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
    33. 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
    34. 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.

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

      I see.

    36. 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...
    37. 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."
    38. Re:Bios code? by ericloewe · · Score: 1

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

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

    40. 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
    41. 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.
    42. 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.

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

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

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

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

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

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

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

    3. 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.
  10. this is easy.... by maxrate · · Score: 1

    nop

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

      that was kinda my point really

  11. 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 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.
    5. 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.
  12. 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
  13. Considering the number of Windows installations by Mr.+Sketch · · Score: 1

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

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

    Go WinXP ftw!

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

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

  17. 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
  18. 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 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. "
  19. 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."
  20. 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;
  21. 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.

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

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

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

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

  26. 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.
  27. 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.
  28. 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."
  29. 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.
  30. 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.

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

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

    i++

    or

    MOV EAX, [EBX]

    or

    INC EAX

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

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

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

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

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

  40. 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.
  41. Borg's backdoor by gmuslera · · Score: 1

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

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

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

    --
    systemd is Roko's Basilisk.
  43. 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: 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.

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

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

    4. 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.
  44. 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
  45. 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).

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

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

  47. 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?
  48. 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 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.

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

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

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

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

  53. 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"?
  54. 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
  55. who by NEDHead · · Score: 1

    cares?

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

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

  58. 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
  59. 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 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.
  60. 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.

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

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

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

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

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

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

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

  66. 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;
  67. 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.

  68. 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.
  69. Re:while() and everything else runs Intel microcod by dreamchaser · · Score: 1

    See my addendum.

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

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

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

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

  74. Idle loop by manu0601 · · Score: 1

    kernel idle loop is a good candidate.

  75. if ie - then do random nonsensical stuff by krups+gusto · · Score: 1

    Special instructions for IE 6 here

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

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

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

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

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

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

  82. may be useful, if known by v4vijayakumar · · Score: 1

    Most executed code could then moved to microprocessor instruction set.

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

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

  85. The code which executes... by gishzida · · Score: 1

    the BSoD stack dump...

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

  87. The most often used? by Ralph+Spoilsport · · Score: 1

    Probably some "get" command.

    --
    Shoes for Industry. Shoes for the Dead.
  88. 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
  89. 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.

  90. QED. by solios · · Score: 1

    Answers like this make Slashdot great. :-)

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

  92. NOP, NOP, NOP by SpaceLifeForm · · Score: 1

    Unless malware is declining these days.

    --
    You are being MICROattacked, from various angles, in a SOFT manner.
  93. Windows boot by virtigex · · Score: 1

    Either that or the Ctl-Alt-Delete stuff

  94. Easy by KliX · · Score: 1

    "xor eax, eax"

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

  96. 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
  97. Windows.Reboot() by mtthwbrnd · · Score: 2

    followed closely by...
    Java.InstallUpdate()

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

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

  101. microcode? by shentino · · Score: 1

    Anyone think about microcode running inside modern CPUs?

    They're practically miniature computers themselves.

  102. 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
  103. 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.
  104. 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
  105. Easy. by SuricouRaven · · Score: 1

    It's the code that calculates the results from each molecular interaction.

  106. In Windows by jandersen · · Score: 1

    ... the boot sequence?

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

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

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

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

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

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

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

  115. NOP by eexaa · · Score: 1

    NOP.

    srsly.

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

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

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

  120. Windows System Idle Process by guygo · · Score: 1

    has to be the most executed code ever.

  121. 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.
  122. 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... ---
  123. BSOD() by kimgkimg · · Score: 1

    BSOD message handler?

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

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

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

  127. 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.
  128. BSOD by oldestgeek · · Score: 1

    over and over and...

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

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

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

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

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

  134. Re:Live CSS Fiddling tool by foobar+bazbot · · Score: 1

    Cool, thanks!

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

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

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

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

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

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