# How many instructions are there ?

1. May 14, 2007

### oldtobor

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. May 14, 2007

### chroot

Staff Emeritus
: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

3. May 15, 2007

### eieio

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
4. May 16, 2007

### oldtobor

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.

THIS IS ALL CALLED EXCESS CAPACITY.

5. May 16, 2007

### chroot

Staff Emeritus
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

6. May 16, 2007

### oldtobor

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:

THAT IS CALLED EXCESS CAPACITY.

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

### -Job-

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.

8. May 16, 2007

### chroot

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

- Warren

9. May 16, 2007

### D H

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

10. May 16, 2007

### ranger

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

Can't you write exponents properly?

11. May 16, 2007

### Mech_Engineer

This thread cracks me up :tongue2:

12. May 16, 2007

### -Job-

Why is Java alot of hype again?

13. May 16, 2007

### eieio

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
14. May 16, 2007

### chroot

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

- Warren

15. May 16, 2007

### Staff: Mentor

Anyone ever play Yeager 2.0 on an old IBM PC? That remains the best flight simulator of all time...

16. May 16, 2007

### eieio

Touché Warren, even if it is a bit of an anachronism.

Last edited: May 16, 2007
17. May 17, 2007

### oldtobor

Hey SNOBS take a look at the Java bytecode:

13: if_icmpge 31
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;
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.

18. May 17, 2007

### Anttech

hahaha... Ballmer is a Business manager, I doubt he has wrote a line of code in his life. You are totally mad.
Crackpot

Last edited: May 17, 2007
19. May 17, 2007

### eieio

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

20. May 17, 2007

### chroot

Staff Emeritus
I'd just like to point out that your beloved BASIC has an IF statement, which is necessarily implemented in machine instructions with some kind of conditional branch instruction. There's no way to implement an IF statement with nothing but a GOTO, after all.

BASIC must really suck too, then, eh? It's so new-fangled and hyped up! I hear every major programming problem was solved back in 1960's when they developed the GOTO instruction on punched-card computers the size of houses.

- Warren

Last edited: May 17, 2007