Well because operating systems are different, with respect to api calls and such. So are the processors operating on different architecture (such as arm vs x64). Usually with non portable code you have to recompile if you target another platform but you often have to make changes if you target another operating system. For instance, linux process creation is completely different than windows, so you code would not work if you use same code. But also windows expects one way a binary file is written (PE format starting with header MZ) while unix-derivatives (including some consoles) use elf binary file format.
As for why, well as a cpu designer you are free to do any sort of architecture you want. And for OS designer, again, api is usually completely free for you to choose.
Let’s say the Xbox has program commands written in English. PlayStation, in Japanese. You would have to translate your directions for how to make the game work between those two languages. They use different instructions for the same thing. So it’s the same, but a different language. So many things can be “automatically” translated by a computer for you. No problem. But some things require a programmer’s attention to rewrite the instructions for clarity.
Computers works basically in layers. From the Bios, then the OS and eventually the programs.
It works quite similarly to a building. The land, the foundation and then the house. You need a foundation that will work with the land you’re trying to live in, and a house that can stand on that foundation.
In programs, it’s mostly that OS can have different functions, or that similar function can work differently. As such let’s imagine that both IOS and WINDOWS have a function called “MAX” that allow you to get the maximum value. But IOS decided that “MAX” works by sending it two values. It then pick the highest of the two. Fast, simple, and can easily be expanded upon. But WINDOWS decided to go a step further. windows’ “MAX” works by sending it between 2 and 50 values. It then pick the highest of the 50. Now, it might seems better because it can go up to 50 values, but since there are more values, the function is more complex and can, in certain cases be slightly slowed. Honestly nothing the average joe will care about, but maybe google and its absurdly massive amount of data will care.
Regardless, both functions are slightly different. So if the program was making use of WINDOWS’ MAX, it need to be adapted to work with IOS.
This is a rough example of the issue. it’s of course not a simple problem of “max”, but these OS are foundation that programs lie on. Quite a few bits of the programs rely on it to work. If you change the OS, you need to make sure that the part that rely on the previous OS works with the new, and change what doesn’t.
Let’s say you own a company that makes subway cars for New York City, which uses standard gauge of 4’8″ (the distance between the tracks) and the cars are 8.6 feet wide. Now you want to make cars that work on the SF Bay BART system, where the cars are more than 10 feet wide and the rails are a wider gauge. Obviously you can’t just make everything a certain percent bigger, you have to re-design and re-engineer a lot of stuff. But, you probably don’t have to start from scratch either – a lot of the components of the design can be reused, just rearranged to work.
Same thing here. Operating systems and CPUs have similar functions but they’re different. Software needs to be adapted to take into account those differences.
Imagine the software is a book, and the operating system is the reader (you). The OS has a certain language that it reads, in your case it may be English. So books meant for you should be written in English.
Now the publisher decides they want to make the book (the software) accessible to some dude in France (a different OS). They can’t just give him the English version and expect him to know what to do with it.
Instead, they have to rewrite the book in French so that the French guy can understand it and read it.
Same thing with OSs: they don’t all use the same “language”. So when a company wants to release software on two different OSs, they have to release it in two different “languages”.
Latest Answers