Forgot your password?
typodupeerror
Programming

Ask Slashdot: What's the Most Often-Run Piece of Code -- Ever? 533

Posted by Soulskill
from the and-how-quickly-could-EC2-win-the-crown dept.
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?"
This discussion has been archived. No new comments can be posted.

Ask Slashdot: What's the Most Often-Run Piece of Code -- Ever?

Comments Filter:
  • Obligatory (Score:5, Insightful)

    by fisted (2295862) on Saturday January 18, 2014 @06:58PM (#46001143)

    Every Ask Slashdot gets a comment pointing out that it's the dumbest Ask Slashdot ever, I know.

    This time, it's really, really the case.

  • Solved. Next? (Score:5, Insightful)

    by Anonymous Coward on Saturday January 18, 2014 @07:01PM (#46001171)

    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.

  • by dpbsmith (263124) on Saturday January 18, 2014 @07:03PM (#46001187) Homepage

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

    And for that matter, what is the definition of whether something is "the same" piece of code? For example, if the same source code compiles to different instructions on two platforms, are they running the same code?

    How about if one of them actually compiles code that gets executed, and the other optimizes it out?

  • Re:Obligatory (Score:5, Insightful)

    by Workaphobia (931620) on Saturday January 18, 2014 @07:13PM (#46001289) Journal

    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.

  • by Bing Tsher E (943915) on Saturday January 18, 2014 @07:13PM (#46001293) Journal

    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.

  • by stox (131684) on Saturday January 18, 2014 @07:15PM (#46001309) Homepage

    eg. Call timer code in the 5ESS switch. Countless millions of times a day for over 30 years now. Probably the oldest code that we all depend on every day.

  • Re:Bios code? (Score:2, Insightful)

    by ColdWetDog (752185) on Saturday January 18, 2014 @07:22PM (#46001389) Homepage

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

  • by Anonymous Coward on Saturday January 18, 2014 @07:23PM (#46001399)

    Perhaps a pixel shader in a modern video game on console or PC, executed per pixel at HD resolution, and for hours (average play time) on tens of millions of machines?

    Could be approaching 10^20 executions.

  • Re:Bios code? (Score:5, Insightful)

    by buchner.johannes (1139593) on Saturday January 18, 2014 @07:33PM (#46001467) Homepage Journal

    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.

  • by ihtoit (3393327) on Saturday January 18, 2014 @07:36PM (#46001493)

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

  • Re:Obligatory (Score:5, Insightful)

    by d33tah (2722297) on Saturday January 18, 2014 @07:55PM (#46001637)
    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.
  • by Anonymous Coward on Saturday January 18, 2014 @08:12PM (#46001751)

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

  • Re:Solved. Next? (Score:2, Insightful)

    by Anonymous Coward on Saturday January 18, 2014 @08:16PM (#46001765)

    Perhaps it would be better to say for most genes that you compile a protein from the DNA using a temporary (RNA) copy and your ribosomes as the compiler, and the protein is the executable version ... although the ribosomal RNA genes are the most ancient still used and among the few that few active components that are still used in RNA form (tRNAs as carriers probably would not count).

  • Re:Bios code? (Score:5, Insightful)

    by mhotchin (791085) <slashdot@hotchinNETBSD.net minus bsd> on Saturday January 18, 2014 @08:42PM (#46001899)

    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.

  • by TubeSteak (669689) on Saturday January 18, 2014 @08:55PM (#46001977) Journal

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

    How many piano tuners are there in Chicago? [wikipedia.org]

Men love to wonder, and that is the seed of science.

Working...