Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How many instructions are there ?

  1. May 14, 2007 #1
    I was trying to figure out how many instructions there are in the world. Now cobol is said to have 100 billion lines of code and I guess all the other languages combined could reach maybe 100 billion lines of code. All other languages include fortran, c, c++, java, basic, and all the microcontroller programs written in assembler.

    Now that is without repetition. I mean that is considering just one sample of each distinct program. So maybe 200 billion lines of code, translated into assembler then may reach A TRILLION LINES OF ASSEMBLY LANGUAGE IN ALL!

    Now if you consider repetition you can reach 10 to the 18 lines of assembler code in the whole world. Wow, that is alot of code floating around.

    Now who on earth is going to maintain and take care of it all ?

    I like big numbers, so sometimes I try to calculate how many equivalent IBM PCs of computer power is currently installed in the world. If you consider that the 1981 model could do 300 thousands instructions per second, today you could maybe estimate at least 100 times that for each PC. SO there are a billion computers in the world today so you get 100 billion equivalent IBM PCs of computing power floating around in the world. WOW! that is alot!

    If you consider that the first basic programs that just opened a file and printed out all the lines containing a string with the famous INSTR($Target,$Pattern) instruction could already be done for a few thousand records in 1981, THAT IS TO SAY THAT 90 % OF ALL REAL SOFTWARE PROBLEMS WERE ALREADY SOLVED IN 1981 ON THE SIMPLE IBM PC WITH THAT GREAT LANGUAGE CALLED BASIC, you can see how much excess capacity is just hanging around. All software problems have been basically solved already in the early 1980s.

    Today the same problem is solved in DOS by executing this simple program in perl:

    c:\>perl -ane"print if/put your pattern in here/" inputfile

    you can also naturally run it off a unix prompt. So most software has been done in one line....
    Last edited: May 14, 2007
  2. jcsd
  3. May 14, 2007 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    :uhh: Most software problems were solved in BASIC in 1981... Right. Because 90% of all software problems are just pattern matching in text. Riiiight. Who are you trying to kid, oldtobor?

    - Warren
  4. May 15, 2007 #3
    Hmm, I'd have to disagree with you Oldtobor. New problems are emerging in computing every day, and BASIC is probably one of the worst languages ever devised; things started getting good when C was developed.

    What does it matter how much code is out there? None of it will be maintained forever, it will all be discarded and replaced by new, more capable code. People work that way too, you know?

    You remind me of those people that say modern medicine hasn't done anything positive for humanity. But here we are living, on average, twice what we used to.

    Good grief.

    - Old MacDonald
    Last edited: May 15, 2007
  5. May 16, 2007 #4
    Actually it is the exact opposite: Basic was (and still is, there are alot available on the internet to download) a very good language, that is why people used it to program during the 1980s and until the early 1990s on PCs.

    Just some programmers were disorganized and created sloppy code. Just because one guy said Basic was bad, everyone started saying the same thing, what clueless people!

    And actually turbo pascal was even better, AND IT WAS WHEN C STARTED TO BECOME POPULAR THAT IT STARTED TO BECOME HARDER TO PROGRAM. C SUCKS, IT IS USELESSLY HARD! The same programs I could do in an hour in pascal took many more to do in C because of the crappy pointers, memory management etc. What crap, and C++ is even worse! Java and object oriented programming is a huge PILE OF HYPE! That is why there are still 100 billion lines of cobol, because good programs are created with easy languages.

    Now back to the main topic:

    Since there are a trillion instructions in the world, how are you going to show ballmer that you didn't copy some of them to create linux ? so he wins and linux becomes just another Microsoft product.

    Aside from the fact that ballmer probably wrote linux too back in 1990, and trovalds (the finnish communist) just stole his code.

    Now lets bring this up to another level. How many transistors are there in the world ? so a cpu can have a millon, so you get 10 to the 15 transistors, but then you must consider that there are a trillion electronic machines in the world; look at your washing machine, refrigerator, car, watch etc.

    So then maybe 10 to the 18 transistors. WOW!, the same number as assembler instructions ? no, something must be wrong.

  6. May 16, 2007 #5


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Oh, I get it. You're not trying to make a valid point about anything -- you're just insane.

    Let's examine your insanity, bit by bit.

    People used BASIC in the 1980's because it is the best language that has ever existed (having nothing to do with the fact that better languages did not yet exist).

    Object oriented programming is a "pile of hype" because of crappy pointers (even though many object oriented languages don't have pointers).

    There are more lines of Cobol than any other language because Cobol is better than all other languages (even though Cobol was just one of the first languages in existence).

    Ballmer wrote Linux in 1990, and Torvalds stole it (even though Ballmer isn't a programmer, Torvalds wrote the original Linux kernel from scratch, and Microsoft has never produced a Unix-like operating system).

    Because there are almost as many transistors as instructions in the world, we have loads of excess capacity (even though the number of transistors and the number of instructions have no causal relationship to one another).

    Gee, oldtobor... it almost seems like all you ever do on PF is post incoherent rants about how things were better so long ago than they are now. Oddly, you're using a modern web browser running on a graphical operating system, connected nearly instantaneously to thousands of people all around the globe to do it.

    - Warren
  7. May 16, 2007 #6
    Microsoft wrote XENIX.

    Now lets bring this up to another level. How many instructions have been executed since 1945 ? so a billion computers running a million instructions per second would make 10 to the 15. Multiply to 10 to the 7 seconds and you get 10 to the 22 instructions have been executed in the world. WOW! that is alot of instructions:

    Last edited: May 16, 2007
  8. May 16, 2007 #7


    User Avatar
    Science Advisor

    FYI, a processor needs to always run an instruction, all the time. When there's nothing to run it runs an empty instruction.

    What would be a waste is to have it run empty instructions instead of running something useful.
  9. May 16, 2007 #8


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    No, it didn't. Microsoft bought it from AT&T. Your facts are always wrong.

    - Warren
  10. May 16, 2007 #9

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    How many instructions are there? Just one. The proof:
    Code (Text):
    #include </dev/tty>
    Invoke the compiler, carefully prepare user inputs, and—voilà!—a program that plays chess. Do it again, and presto changeo, an accounting program.
  11. May 16, 2007 #10


    User Avatar
    Gold Member

    You take so long to program in C becuase you cannot program in C properly. Take some time and become proficient in the language.
    A Basic programmer claiming that C sucks...

    Your thread is useless. An you claim that Linus is a communist...I pity your ignorance.
    Can't you write exponents properly?
  12. May 16, 2007 #11
    What? Let's not confuse C's difficulty with your inability.

    That comparison only shows that you aren't a very good programmer.
    What you can do in an hour in Pascal or BASIC is by no means comparable to what I, for example, can do in C in an hour.

    Here is an example of about an hours worth of experimentation in C:

    It's a nifty little fluid surface dynamics simulator. Check out my home page for the much more mature version. It won't run on an old IBM PC though. :yuck:

    Well you are half right, Java is a lot of hype. I mean it's better than BASIC and can be quite powerful in the hands of a good programmer (as can any tool). But it's not the solution to world hunger, contrary to popular belief.

    Good programs are created by good programmers, regardless of the language (tool) they choose to use; the language has nothing to do with it.

    - Old MacDonald

    P.S. Though COBOL may have been a good language for the time and purpose it was created, it is by no means a good language now. Anything that COBOL can do, Python can do better. And that's not including all of the things that Python (and other modern tools) can do that COBOL simply cannot.
    Last edited: May 16, 2007
  13. May 16, 2007 #12


    User Avatar
    Science Advisor
    Gold Member

    This thread cracks me up :tongue2:
  14. May 16, 2007 #13


    User Avatar
    Science Advisor

    Why is Java alot of hype again?
  15. May 16, 2007 #14
    Java is aggrandized as some major revolution in computing by a lot of people and organizations. It's not a bad technology, but it's not some supreme answer for everything under the sun.

    The fact that it's easier for new programmers is great, but I think they tend to view it with cult reverence, which is silly. I used be in that camp at one time, even. But then I grew up and realized that there are better tools. Plus, there is nothing better than C/C++ for low-mid level programming.
    Last edited: May 16, 2007
  16. May 16, 2007 #15


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    In other words, he was a Java cheerleader until I introduced him to Python. Now he's a Python cheerleader. :tongue:

    - Warren
  17. May 16, 2007 #16


    User Avatar

    Staff: Mentor

    Anyone ever play Yeager 2.0 on an old IBM PC? That remains the best flight simulator of all time...
  18. May 16, 2007 #17
    Touché Warren, even if it is a bit of an anachronism.
    Last edited: May 16, 2007
  19. May 17, 2007 #18
    Hey SNOBS take a look at the Java bytecode:

    13: if_icmpge 31
    16: iload_1
    17: iload_2
    18: irem # remainder
    19: ifne 25
    22: goto 38
    25: iinc 2, 1
    28: goto 11
    31: getstatic #84; //Field java/lang/System.out:Ljava/io/PrintStream;
    34: iload_1
    35: invokevirtual #85; //Method java/io/PrintStream.printlnI)V
    38: iinc 1, 1
    41: goto 2

    looks alot like BASIC doesn't it ? What, all those GOTOs ? How dare you, but then again ALL THE ASSEMBLER INSTRUCTIONS FOR ALL CPUS ARE JUST A BUNCH OF GOTOS WRITTEN LIKE JMP , JNZ, etc.

    But then again GOTOs are even more understandable then the DIRECT JUMPS or the JUMPS IF ACCUMULATOR IS ZERO, etc.

    At least you know that the code is going someplace else. Get a clue and don't follow all the HYPE.
  20. May 17, 2007 #19
    hahaha... Ballmer is a Business manager, I doubt he has wrote a line of code in his life. You are totally mad.
    Last edited: May 17, 2007
  21. May 17, 2007 #20
    No, actually it doesn't look at all like BASIC. The fact that they both use a GOTO instruction has little bearing on overall similarity. And if I had to choose, I would program in direct Java bytecode over BASIC any day. BASIC is just too limiting.

    What?! Are you bashing conditional branch instructions now?! Are you not aware that conditional branches are probably the most necessary instructions in any ISA? :cry: Are you aware that your beloved BASIC interpreter/compiler has literally thousands of conditional branch instructions to make it operate?

    I was willing to consider that you were just an old timer, stuck in his ways, but this just changes everything!

    Good God, man!
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook