1 |
On 26/11/2010, at 6:07am, sam new wrote: |
2 |
|
3 |
> Thanks all, I have a question , when we build the system, always use host |
4 |
> client to build the toolchain , then GCC Glibc ...kernel some unity ... from |
5 |
> source ,but where the frist system come from ,does it build using the |
6 |
> Assembly language or machine language? I mean just give you X86 hardware and |
7 |
> power , no OS, no livd cd . I am afraid it is out of this topic.but it |
8 |
> always puzzled me :-) |
9 |
|
10 |
I think you want to know which came first - the chicken or the egg? |
11 |
|
12 |
For a few years, operating systems were indeed written in assembler. Then, c 1970, Unix was the first operating system written in a higher-level programming language, C. Likewise, I guess, the first compilers would be written in assembler, until one was written that could compile itself and become "self-hosting". |
13 |
|
14 |
Thus new compilers and operating systems can now be written in higher-level languages (although C isn't very high-level) and compiled using an existing compiler. |
15 |
|
16 |
That Unix was written in C is what has lead to its ubiquity - until then every different brand of computer had its own operating system, usually written by the manufacturer. Written in assembly, these were non-portable. Writing the operating system in C allowed it to be ported to different hardware architectures, and programs could be written that would run on all the different systems out there (as long as those ran Unix). |
17 |
|
18 |
Linux was written on a Minix system, Minix was written c 1987 and so might have been written on one of the BSDs that was around then; the BSDs were probably written on an AT&T Unix. |
19 |
|
20 |
When Intel produce a new chip - or gcc wants to support a new architecture - they rewrite the compiler (the "backend" part of it) to output machine code to suit the new chip's instruction set (which will be different from that of other chips - PPC vs ARM vs MIPS vs x86). The compiled code is then transferred to the new machine and fingers are crossed as everyone waits to see if it boots. |
21 |
|
22 |
http://en.wikipedia.org/wiki/History_of_Unix |
23 |
http://en.wikipedia.org/wiki/Compiler |
24 |
|
25 |
Stroller. |