Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > how come OS be written in C

Reply
Thread Tools

how come OS be written in C

 
 
raashid bhatt
Guest
Posts: n/a
 
      08-17-2008
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

 
Reply With Quote
 
 
 
 
Antoninus Twink
Guest
Posts: n/a
 
      08-17-2008
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.

 
Reply With Quote
 
 
 
 
santosh
Guest
Posts: n/a
 
      08-17-2008
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.

 
Reply With Quote
 
Herbert Rosenau
Guest
Posts: n/a
 
      08-18-2008
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!
 
Reply With Quote
 
Bartc
Guest
Posts: n/a
 
      08-19-2008

"Herbert Rosenau" <> wrote in message
news:wmzsGguTDN6N-pn2-...
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Generally, are the programs written by C++ slower than written by C10% ? KaiWen C++ 102 09-14-2011 11:12 PM
Store in a file a web page written in chinese Antonio ASP .Net 0 10-25-2004 08:09 AM
Come One, Come All Jess Guim Digital Photography 0 12-02-2003 04:43 PM
Re: Can a usercontrol written in C# be used in Web Forms that is written in VB.Net? Steve C. Orr, MCSD ASP .Net 1 08-24-2003 12:06 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57