Why do programs work on any PC?

In summary, a PC is a computer with an Intel i5 or AMD FX processor, and a PC with a different CPU instruction set is not able to run the same program.
  • #1
jack476
328
125
Last year I took introductory computer architecture. The course focused mainly on microcontrollers rather than PCs (I'm taking that one next year), and we learned about things like instruction sets. But the discussion was mainly limited to microcontrollers and very simple architecture. I also know nothing about compilers, so that might be a cause for my lack of understanding.

So what I'm wondering is, how does a program run both on a PC with one kind of CPU (say, an Intel i5) and a PC with another kind of CPU (say, an AMD FX processor)? Is the instruction set standardized across the industry, and compilers use the standard instructions?
 
Technology news on Phys.org
  • #2
Intel and AMD instructions sets are largely compatible.
There are some instructions which are unique, however applications designed to run under popular PC operating systems would usually be compiled using only the common instructions.
The developer can have a choice for the target architecture when compiling, but the default choice would be to use just the common instructions set.
 
Last edited:
  • #3
It's history time.

A long time ago, there were a handful of manufacturing giants, but the only ones that really mattered for personal computers were Motorola and Intel. IBM was the computer king, they chose to use Intel chips for all of their computers. Apple rose as their competition, who used Motorola chips, so for a long time you had either an "IBM Compatible" or an "Apple" computer. There were no PC/Macs yet.

Because Apple and IBM became so huge, other manufacturers wanted to remain compatible to one of them. IBM became way more popular to clone because Apple wrote their own software and OS, where IBM licensed DOS. Microsoft's license allowed them to sell to other manufacturers as well, so it was actually DOS that became the standard and the Intel chipset became a secondary cause of that. Software needs to interact with the computer too, so they're very reliant on a standard operating system. That's why PCs will forever be Intel instruction sets and why Apple was able to switch from Motorola, to PowerPC, to Intel chips without much difficultly.

AMD came on the scenes and they wanted to penetrate the pre-existing market. So they had to conform to what was already in place, that's why their chipset is just like Intel's.

Now in a word of just in time compilers and virtual machines, those lines are getting blurred. I have a Macbook, I'm constantly opening Linux machines in virtual computers, and even opening Windows programs directly in OSX with an emulation layer. Everything works everywhere now (to an extent) because of this.
 
  • #4
Awesome, thanks guys! I'm not really as knowledgeable about computer science as I'd like to be, so thanks for the help, this has been a question on my mind for ages.
 
  • #5
newjerseyrunner said:
A long time ago, there were a handful of manufacturing giants, but the only ones that really mattered for personal computers were Motorola and Intel. IBM was the computer king, they chose to use Intel chips for all of their computers. Apple rose as their competition, who used Motorola chips, so for a long time you had either an "IBM Compatible" or an "Apple" computer. There were no PC/Macs yet.
The IBM PC was released in August 1981, wiki article:

http://en.wikipedia.org/wiki/IBM_Personal_Computer#History

The Macintosh was released in Jan 1984, wiki article:

http://en.wikipedia.org/wiki/Macintosh#History

The earliest (1974) popular home computer was an Altair 8800 kit system, but some companies built the kits and sold ready to run systems, wiki article:

http://en.wikipedia.org/wiki/Altair_8800

Between 1974 and 1981, there were home computer's like Apple II, Atari 8 bit series (400, 800, 65XE, 130XE), Commodore Pet, ... , and for office and office like personal computers, CP/M systems, some based on the S100 bus, wiki article:

http://en.wikipedia.org/wiki/CP/M

The 1981 IBM PC didn't sell that well, but the next versions IBM PC XT, and IBM PC AT, became very popular. Compaq had the first popular PC clone, that was portable as it came in a luggable suitcase like enclosure. By the time the 286 was released, there were many clone makers. When the 386 was released, IBM chose to use it's own micro channel bus (with the PS/2), while the clone makers went with an extended version of the original iSA bus called EISA, and those became the most popular. The transition to PCI bus versions occurred around 1994 (starting in 1991), some for 486's, but mostly with the Pentium and later Intel X86 type processors.

Getting back to the original question, programs don't work on any PC, since most programs also target a specific operating system, dos/windows, unix type systems, or one of the Mac operating systems. As posted before, there's a common part of the instruction set for X86 compatible processors, and programs written to run on any PC with a particular operating system will only use the common instruction set.
 
Last edited:
  • #6
newjerseyrunner said:
It's history time.

A long time ago, there were a handful of manufacturing giants, but the only ones that really mattered for personal computers were Motorola and Intel. IBM was the computer king, they chose to use Intel chips for all of their computers. Apple rose as their competition, who used Motorola chips, so for a long time you had either an "IBM Compatible" or an "Apple" computer. There were no PC/Macs yet.
This is not correct. Before the IBM PC (and long before the Mac), the microprocessor market was split between the MOS Technology 6502 (e.g. Apple II, Commodore PET) and Zilog Z80 (e.g. generic CP/M machines, ZX Spectrum, Tandy TRS-80) - the latter was based on and backwards compatible with but faster and more powerful than the Intel 8080 which fell by the wayside, whilst Motorola's 6800 never found its way into a successful consumer product.

It was only when IBM chose Intel's 8088 for its PC that Intel began to push aside both the Apple II and Z80/CP/M machines that dominated business microcomputer use, and it was 3 years later when Apple chose Motorola's 68000 for the Macintosh.
 
  • #7
Also IBM championed the PowerPC chip designed by IBM, built by Motorola and used in Apple products and IBM RISC 6000 machines. The chip evolved into the Cell processor used in MS Xbox and Sony Playstation machines.

Basically chip history much more complex than 6800 vs 8080 chip architectures and you can read more about PowerPC history here:

https://en.wikipedia.org/wiki/PowerPC

and here for Cell:

https://en.wikipedia.org/wiki/Cell_(microprocessor)
 
  • #8
Just to add to the thread, no one has yet mentioned the language a program is written in. You do not see many releases of source code like in the old days, but most professional programs are written in some variation of C. From the source code, you compile it on the hardware you want to use it on. With a few exceptions of debugging for hardware dependencies, something written in C can be compiled on any machine, Windows, MAC, Linux, UNIX, ect. The compiler does all the changes needed at the assembly language level.
 
  • #9
Joe Ciancimino said:
Just to add to the thread, no one has yet mentioned the language a program is written in. You do not see many releases of source code like in the old days, but most professional programs are written in some variation of C. From the source code, you compile it on the hardware you want to use it on. With a few exceptions of debugging for hardware dependencies, something written in C can be compiled on any machine, Windows, MAC, Linux, UNIX, ect. The compiler does all the changes needed at the assembly language level.

So the OS contains a compiler that tells the computer how to run the code? But how would it know how to compile it for the hardware it's running on?
 
  • #10
A human configured the compiler to tell it what OS to code for usually via command line flags. Gnu compilers are designed for cross compiling that is working on one machine and compiling code for another machine.
 
  • #11
jack476 said:
So the OS contains a compiler that tells the computer how to run the code? But how would it know how to compile it for the hardware it's running on?
The software you buy and install on your PC is already compiled to machine code when you get it. Same with the operating system, be it Windows or something else, which is a special program that runs all the time and allows the computer operator to make, store and retrieve files, run programs, control the video display, etc.

A software developer writes a set of instructions for a program in a programming language like C or Fortran or whatever and uses the compiler to turn those human-readable instructions into code which the computer can execute. Once the compiled code is generated, it can be used over and over again, until the program is changed or re-written, without the need to compile every time before running the program.

A similar process is done to write software for microcontrollers. Once the microcontroller code is finished and compiled, it can be stored in a ROM chip and then run constantly so that the microcontroller knows what to do.
 
  • #12
rcgldr said:
The 1981 IBM PC didn't sell that well, but the next versions IBM PC XT, and IBM PC AT, became very popular.

According to this article, the IBM PC reportedly racked up 100,000 sales in its first year, which wasn't bad for a business machine:

https://en.wikipedia.org/wiki/IBM_Personal_Computer

The PC XT was not introduced until March 1983, and the sales of the PC by the end of that year totaled some 750,000 units, which was more units than Apple had sold. IBM was shipping 40,000 units a month and demand was not even close to being satisfied.
 
  • #13
SteamKing said:
According to this article, the IBM PC reportedly racked up 100,000 sales in its first year, which wasn't bad for a business machine.
It was just the first year of the original PC, with less that 100,000 sold, but it's still a good number. In 1983, about 750,000 units were sold. It seemed the big jump in sales occurred with 286 and later 386 "AT" clones (IBM chose to use it's micro channel PS/2's for 386). Some articles claim that Mac's outsold PC's in 1984, but the trend reversed over time, with Mac having about 20% of the personal computer market, most of which was clones by the early 1990's, in the 386 / Wintel (Windows 3.0 / 3.1) era. This was also a time when clones dominated the market place. During one year in the early Wintel era, the top 20 PC makers only accounted for 50% of PC sales, the rest were clones made of common components (motherboards, video cards, ... ) sold by small PC shops. Also during this era, with Mac's increase in prices (1989) and release of Windows 3.0 and later 3.1, Mac sales went from 20% market share to about 5% market share, although much of this was due to a big increase in total sales of personal computers, again a lot of no-name clones.
 
Last edited:
  • Like
Likes Silicon Waffle

Related to Why do programs work on any PC?

1. Why can programs work on any PC?

Programs are designed to be compatible with a variety of different computer systems. This is achieved through the use of programming languages, such as Java or Python, which are platform-independent and can be executed on any computer with the necessary software installed.

2. What factors contribute to a program's compatibility with different PCs?

The use of standardized programming languages, as well as the availability of software libraries and frameworks, helps ensure that programs can work on any PC. Additionally, advancements in virtualization and cloud computing have made it easier to run programs on different systems without compatibility issues.

3. How do programs adapt to different hardware configurations on different PCs?

Programs are designed to be modular, with different components responsible for specific tasks. This allows them to adapt to different hardware configurations by using the appropriate components for each system. In some cases, programs may also prompt users to select or configure certain settings to optimize performance on their specific PC.

4. Are there any limitations to a program's compatibility with different PCs?

While most programs are designed to be as compatible as possible, there may be some limitations when it comes to older or specialized hardware. In some cases, certain features or functions may not work properly on certain systems due to hardware limitations or outdated software versions.

5. What can be done if a program is not working on a specific PC?

If a program is not working properly on a specific PC, there are a few steps that can be taken. First, make sure that the necessary software and hardware requirements are met. If the issue persists, try updating the program or using a different version. If all else fails, contacting the program's developer or technical support team may provide further assistance.

Similar threads

  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
6
Views
3K
  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
6
Views
3K
  • Programming and Computer Science
Replies
20
Views
2K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
1
Views
2K
  • DIY Projects
2
Replies
62
Views
7K
Back
Top