473,946 Members | 13,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how come OS be written in C

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

Aug 17 '08 #1
6 1538

"raashid bhatt" <ra**********@g mail.comwrote in message news:
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
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.

Aug 17 '08 #2
On 17 Aug 2008 at 17:20, Malcolm McLean wrote:
"raashid bhatt" <ra**********@g mail.comwrote 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.

Aug 17 '08 #3
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.de velopmentbut
check their FAQ and make a quick search of past posts before asking
elementary questions.

Aug 17 '08 #4
On Sun, 17 Aug 2008 10:02:06 -0700 (PDT), raashid bhatt
<ra**********@g mail.comwrote in comp.lang.c:
how is it possible to create a OS in c as firstly it require compiler
So far, so good. It does require a compiler. That compiler does not
need to run on the OS that it is building, nor does it even need to
run on the same type of computer, or even processor architecture, that
it is generating executable images for. Google for "cross compiler".
and requires support external libraries
What makes you think that an OS requires external libraries?
for example on windows printf function is statically linked with
MSVCRT.DLL export
Maybe the printf() function that you call from application (not
operating system) code that you write with your compiler ends up
calling a function in a Microsoft DLL. There are other C compilers,
even for Windows, that provide their own standard library
implementation of printf() to have functionality that Microsoft does
not support, such as IEEE extended precision long double, or 64-bit
integer support.

In fact, Microsoft's own Visual Studio 2008 must use a different
printf() implementation, because this program:

#include <stdio.h>

int main(void)
{
long long x = 4294967297LL;
printf("%lld\n" , x);
return 0;
}

....generates the output "4294967297 ".

The closest equivalent build under MSVC6:

#include <stdio.h>

int main(void)
{
__int64 x = 4294967297i64;
printf("%lld\n" , x);
return 0;
}

....generates the output "1".

So even Visual Studio 2008 does not use the same printf()
implementation as VC6.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Aug 18 '08 #5
On Sun, 17 Aug 2008 17:02:06 UTC, raashid bhatt
<ra**********@g mail.comwrote:
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!
Aug 18 '08 #6

"Herbert Rosenau" <os****@pc-rosenau.dewrote in message
news:wm******** *************** ****@JUPITER.PC-ROSENAU.DE...
On Sun, 17 Aug 2008 17:02:06 UTC, raashid bhatt
<ra**********@g mail.comwrote:
>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

Aug 19 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2402
by: Daniel | last post by:
when writing out a file from .net, when is the file created? after the bytes are all written to the hard drive or before the bytes are written to the hard drive?
1
717
by: Daniel | last post by:
System.IO.StreamWriter Close or Flush method to shut down the computer in such a way that just part of the file is written? or an empty file is written? Also if the Close or Flush is to a streamwriter writing to a network share, is it possible for the network to go down in such a way that the tartet file is only partialy written? or are there some kind of check sums to prevent this.
13
2259
by: Ben | last post by:
Could anyone suggest an open source project that has particularly well written Python? I am especially looking for code that people would describe as "very Python-ic". (Not trying to start any kind of war - just wanted some good examples of a well written Python app to read.) Thanks! -Ben P.S. - Sorry if this has been discussed at length before - I searched the group before I posted, but didn't come up with what I was looking
12
25511
by: Unbiased_me | last post by:
Hi There I recently read in book that the C compiler is written in C. I unable to comprehend the concept behind this. How is the compiler design started...Where dodoes one start. I tried Googling for the answer that C is written in C, however the web search proved futile. C # and .net is written in .net...What!, and the list goes on
132
4939
by: Kevin Spencer | last post by:
About 2 years ago, and as recently as perhaps 1 year ago, I can recall seeing many posts about what language to use with ASP.Net. The consensus was that employers paid more for C# programmers, and it seems that C# became the darling of the ASP.Net crowd. In the meantime, I have observed an interesting phenomenon. Originally, employers hired programmers who used C# because it was based on C, and the prevailing opinion was (and may still...
4
1698
by: switzerland qunatium computer | last post by:
Machine intelligence- can this program be written ?? Machine intelligence- can this program be written ??
3
1598
by: KidSensation | last post by:
Hello all, I ran into a couple applications written in c#, but we do not have the full version of visual studio.net 2003, so I thought they were most likely written in the beta version. After some research, I found out that sooner or later the applications written in beta would just stop working. This is going to be a major problem and I was hoping that there was some way I could find out if they were in fact written in the beta...
14
10473
by: Franz Steinhäusler | last post by:
Hello NG, wWhat are the best programs in your opinion, written entirly in pyhton, divided into categories like: a) Games b) Utilities/System c) Office d) Web/Newsreader/Mail/Browser ....
61
7025
by: giveitawhril2008 | last post by:
I'm just learning about Python now and it sounds interesting. But I just read (on the Wiki page) that mainstream Python was written in C. That's what I was searching for: Python was written in what other language? See, my concern was something like: OK, if Python is so hot, then, hopefully someone is writing it in assembly language for each MPU chip out there. Otherwise, if, say, they've written it in C#, then it looks like the REAL,...
0
1287
by: Phil Runciman | last post by:
On 20 jul, 19:50, giveitawhril2...@gmail.com wrote: ".. if Python is so hot.." Python represents progress not the ultimate goal. Thank goodness we are continuing to learn from past mistakes. All compilers and interpreters started out being written in another language. You do not help us by stating the obvious. This is even true of the interpreter in your own brain that processes English. IMHO The latter still has some bugs in it....
0
10159
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9981
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9886
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8250
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7423
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6111
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6331
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4940
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3541
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.