Unix and C
Fraser Wilson
fraser at bilby.cs.uwa.oz.au
Thu Nov 8 15:27:21 AEST 1990
In <4458 at mint39.UUCP> gunda at motcid.UUCP (Indira Gunda) writes:
>richb at railnet.UUCP (Richard Banks) writes:
>>How can Unix be written in C ? I thought all OS`s had to be written
>>in assembly language, else they'd have the same interrupts as the
>>OS you booted your complier language under to write the program ?
>Yes ... Why and how can UNIX be written in C? I'd also like to know.
Why? Because it makes it very portable. Any machine that has a C
compiler and a few kernal routines (actually a fair number) can run Unix
fairly easily. If Unix were written in assembly, it would have to be
completely rewritten for every new computer it runs on.
How? Well, you have a few system calls to assembly routines, and then
write lots of C to use them. The C compiler itself is written in C.
The very first one was written with assembly, but every other compiler
(in theory) can then be written in C. Once you have a C C compiler, it
becomes very easy to port to different machines, just by changing the
target language.
>_____________________________________________________________________
>Indira Gunda Motorola C.I.D.
>uunet!motcid!gunda 1501 W. Shure Drive
> Arlington Hts., IL 60004
======================================================================
Fraser Wilson | Of all the knights in Appledore
fraser at bilby.cs.uwa.oz | The bravest was Sir Thomas Tom
| He multiplied as far as four
There can be only one! | And knew what nine was taken from
- CM | To make eleven. He could write
| A letter to another knight. - A.A Milne
More information about the Comp.lang.c
mailing list