Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Programming

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

Hugo Villeneuve writes "What piece of code, in a non-assembler format, has been run the most often, ever, on this planet? By 'most often,' I mean the highest number of executions, regardless of CPU type. For the code in question, let's set a lower limit of 3 consecutive lines. For example, is it:
  • A UNIX kernel context switch?
  • A SHA2 algorithm for Bitcoin mining on an ASIC?
  • A scientific calculation running on a supercomputer?
  • A 'for-loop' inside on an obscure microcontroller that runs on all GE appliance since the '60s?"
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:
  • Re:Bitcoin (Score:5, Informative)

    by The Mighty Buzzard ( 878441 ) on Saturday January 18, 2014 @07:18PM (#46001341)
    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.
  • Re:Bios code? (Score:5, Informative)

    by Orp ( 6583 ) on Saturday January 18, 2014 @07:36PM (#46001499) Homepage

    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?

  • Re:For / While in C (Score:5, Informative)

    by Dahan ( 130247 ) <khym@azeotrope.org> on Saturday January 18, 2014 @07:42PM (#46001533)

    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 [coding-guidelines.com] gives "some other implementation-defined manner." as one of the options for main's definition. It notes in 5.1.2.2.3 [coding-guidelines.com] that "If the return type is not compatible with int, the termination status returned to the host environment is unspecified."

  • by kenh ( 9056 ) on Saturday January 18, 2014 @08:02PM (#46001699) Homepage Journal

    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.

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

    by 0123456 ( 636235 ) on Saturday January 18, 2014 @09:49PM (#46002273)

    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.

  • Re:Obligatory (Score:2, Informative)

    by abhi_beckert ( 785219 ) on Sunday January 19, 2014 @02:26AM (#46003447)

    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.

  • Re:For / While in C (Score:5, Informative)

    by jones_supa ( 887896 ) on Sunday January 19, 2014 @04:49AM (#46003909)

    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 .

A morsel of genuine history is a thing so rare as to be always valuable. -- Thomas Jefferson

Working...