1 |
Apparently, though unproven, at 16:09 on Friday 26 November 2010, Stroller did |
2 |
opine thusly: |
3 |
|
4 |
> On 26/11/2010, at 6:07am, sam new wrote: |
5 |
> > Thanks all, I have a question , when we build the system, always use host |
6 |
> > client to build the toolchain , then GCC Glibc ...kernel some unity ... |
7 |
> > from source ,but where the frist system come from ,does it build using |
8 |
> > the Assembly language or machine language? I mean just give you X86 |
9 |
> > hardware and power , no OS, no livd cd . I am afraid it is out of this |
10 |
> > topic.but it always puzzled me :-) |
11 |
> |
12 |
> I think you want to know which came first - the chicken or the egg? |
13 |
> |
14 |
> For a few years, operating systems were indeed written in assembler. Then, |
15 |
> c 1970, Unix was the first operating system written in a higher-level |
16 |
> programming language, C. Likewise, I guess, the first compilers would be |
17 |
> written in assembler, until one was written that could compile itself and |
18 |
> become "self-hosting". |
19 |
> |
20 |
> Thus new compilers and operating systems can now be written in higher-level |
21 |
> languages (although C isn't very high-level) and compiled using an |
22 |
> existing compiler. |
23 |
> |
24 |
> That Unix was written in C is what has lead to its ubiquity - until then |
25 |
> every different brand of computer had its own operating system, usually |
26 |
> written by the manufacturer. Written in assembly, these were non-portable. |
27 |
> Writing the operating system in C allowed it to be ported to different |
28 |
> hardware architectures, and programs could be written that would run on |
29 |
> all the different systems out there (as long as those ran Unix). |
30 |
> |
31 |
> Linux was written on a Minix system, Minix was written c 1987 and so might |
32 |
> have been written on one of the BSDs that was around then; the BSDs were |
33 |
> probably written on an AT&T Unix. |
34 |
> |
35 |
> When Intel produce a new chip - or gcc wants to support a new architecture |
36 |
> - they rewrite the compiler (the "backend" part of it) to output machine |
37 |
> code to suit the new chip's instruction set (which will be different from |
38 |
> that of other chips - PPC vs ARM vs MIPS vs x86). The compiled code is |
39 |
> then transferred to the new machine and fingers are crossed as everyone |
40 |
> waits to see if it boots. |
41 |
> |
42 |
> http://en.wikipedia.org/wiki/History_of_Unix |
43 |
> http://en.wikipedia.org/wiki/Compiler |
44 |
> |
45 |
> Stroller. |
46 |
|
47 |
One could ask the question "where did the first assembler come from?" |
48 |
|
49 |
Just as the first OSes and compilers were written in assembler to bootstrap C, |
50 |
so the first assemblers were written in hex codes to bootstrap the assembler. |
51 |
But hex code editors ran software, so where did the first hex code input |
52 |
gadget come from? |
53 |
|
54 |
And the answer to that is that it was written in binary. Yes that's right - a |
55 |
panel with 16 toggle switches and a few pushbuttons. Those didn't require |
56 |
software as everything was implemented in hardware. |
57 |
|
58 |
So now you know :-) |
59 |
|
60 |
|
61 |
-- |
62 |
alan dot mckinnon at gmail dot com |