how come OS be written in C

Discussion in 'C Programming' started by raashid bhatt, Aug 17, 2008.

  1. how is it possible to create a OS in c as firstly it require compiler
    and requires support external libraries
    for example on windows printf function is statically linked with
    MSVCRT.DLL export
    raashid bhatt, Aug 17, 2008
    #1
    1. Advertising

  2. On 17 Aug 2008 at 17:20, Malcolm McLean wrote:
    > "raashid bhatt" <> wrote in message news:
    >> how is it possible to create a OS in c as firstly it require compiler
    >> and requires support external libraries
    >>

    > You use a cross compiler. The compiler runs on a VAX or Apple Mac or
    > something, and the first program for the target is created - the OS. The
    > second program is the C compiler.


    Or historically, I guess people wrote a rudimentary C compiler in
    assembly, which was good enough to compile version 0.1 of their C
    compiler, which could then compile version 0.2 of the compiler, and so
    on.
    Antoninus Twink, Aug 17, 2008
    #2
    1. Advertising

  3. raashid bhatt

    santosh Guest

    raashid bhatt wrote:

    > how is it possible to create a OS in c as firstly it require compiler
    > and requires support external libraries
    > for example on windows printf function is statically linked with
    > MSVCRT.DLL export


    Almost all parts of an operating system can be written in C (or in many
    other high-level languages for that matter). An OS isn't really as
    magical as it may seem to beginners. It's simply a program with
    intimate knowledge of the system's hardware and usually running under
    a "privileged mode" which protects it from damage by ordinary programs.
    A small amount of an OS's code is usually platform specific assembler,
    but the vast majority can be written in C. In fact C was expressly
    designed by it's author for writing OSes and is very suited to do so
    till this day.

    For more such queries please use the group <news:alt.os.development> but
    check their FAQ and make a quick search of past posts before asking
    elementary questions.
    santosh, Aug 17, 2008
    #3
  4. On Sun, 17 Aug 2008 17:02:06 UTC, raashid bhatt
    <> wrote:

    > how is it possible to create a OS in c as firstly it require compiler
    > and requires support external libraries
    > for example on windows printf function is statically linked with
    > MSVCRT.DLL export
    >


    This is the same as how to get a computer to boot because you needs a
    program to load before it can loaded?

    It is simply magie!

    O.k., look up:

    you writes a very small program in hex code that will be able to read
    and translate assembler and translate that assember to hex and stor
    that to disk. Then you writes a simple program in hex that can
    translate a basic C language to assembler. Then yoou use that to write
    a more comfortable C compiler in that basic C to get assembly
    translated to mashine code. Then you will use that simple compiler to
    write a more complx compiler. You'll in a recursion until you have
    created a full compiler. Then you'll write a kernel, linker and some
    tools to get an operating system up and running.

    When you owns already a computer that runs an operationg system and a
    full flagged compier you will only write a new backend for that
    compier and use that to translate the existent operating system and
    compiler with the new backend to translate that for the new computer.

    Easy, eh?
    --
    Tschau/Bye
    Herbert

    Visit http://www.ecomstation.de the home of german eComStation
    eComStation 1.2R Deutsch ist da!
    Herbert Rosenau, Aug 19, 2008
    #4
  5. raashid bhatt

    Bartc Guest

    "Herbert Rosenau" <> wrote in message
    news:-ROSENAU.DE...
    > On Sun, 17 Aug 2008 17:02:06 UTC, raashid bhatt
    > <> wrote:
    >
    >> how is it possible to create a OS in c as firstly it require compiler
    >> and requires support external libraries
    >> for example on windows printf function is statically linked with
    >> MSVCRT.DLL export
    >>

    >
    > This is the same as how to get a computer to boot because you needs a
    > program to load before it can loaded?


    > you writes a very small program in hex code that will be able to read
    > and translate assembler and translate that assember to hex and stor
    > that to disk.


    I've actually done something similar. In my case, I had to wire up the
    hardware first. Then the first programs were written in binary, not hex
    (using push-buttons). (Although, since at first there was no display, only
    LEDs, and no keyboard, these were not very exciting programs.)

    With a text display and keyboard added, the next programs allowed entry via
    the keyboard, using hex. After that, using hex machine code, some sort of
    primitive editor and assembler. Then, writing in assembler now, a very
    primitive high-level language. And this was used to do stuff with 3d
    graphics and video capture (this was a big deal in 1981).

    > Then you writes a simple program in hex that can
    > translate a basic C language to assembler.


    Think you mean, in assembler.

    > Then you'll write a kernel, linker and some
    > tools to get an operating system up and running.


    If you've managed to get this far without an OS then you might also realise
    that you don't need one! That'll save a bit of time.

    --
    Bartc
    Bartc, Aug 19, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Sitka
    Replies:
    0
    Views:
    346
    John Sitka
    Jul 17, 2003
  2. Steve C. Orr, MCSD
    Replies:
    1
    Views:
    556
    reaway lee
    Aug 24, 2003
  3. ska4reak

    where did they come from?

    ska4reak, Nov 14, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    311
    Bill Priess
    Nov 14, 2003
  4. Eric Lawrence [MSFT]

    Re: read cookies come from asp page in asp.net page

    Eric Lawrence [MSFT], Feb 26, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    372
    Eric Lawrence [MSFT]
    Feb 26, 2004
  5. KaiWen
    Replies:
    102
    Views:
    2,709
    Jorgen Grahn
    Sep 15, 2011
Loading...

Share This Page