OSDev.org

The Place to Start for Operating System Developers
It is currently Mon Oct 14, 2019 12:34 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 118 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8
Author Message
 Post subject: Re: CompilerDev?
PostPosted: Sun Jan 18, 2015 10:48 am 
Offline
Member
Member
User avatar

Joined: Sun Jul 14, 2013 6:01 pm
Posts: 442
now i am support the theory that calim that its much harder to write a compiler. (i am in the middle of both problem for my platform)

maybe an os seems to be harder to write, especially on x86/arm, when there is a lot of special nonsense memory map locations, braindead interrupt vectors, dma, multiple cpu modes, but this things must be only written once, and after a few days of pain, they are working, and done.

on more simplyer systems, these problems arent even exist, only the functionality must be implemented.

for example, when somebody implementing malloc/free, it maybe seems a little complex, but after a few hours, he is basically alreday done, and after a little debugging, it works well, and thats it.

a compiler (c compiler) is much harder, however, its simplyer, if the people write it on a platform with registers, hardware stack, or at least some kind of segmentation. if not, then it becomes a very horroristic saga, becouse very special design needed to make the output binary work with normal speeds.

so basically it depends on the platform, how hard is to write an operating system and a compiler for it, but i would say that writing the c compiler is harder in every case. in some cases, extremely harder.

_________________
Operating system for SUBLEQ cpu architecture:
http://gerigeri.uw.hu/DawnOS/index.html


Top
 Profile  
 
 Post subject: Re: CompilerDev?
PostPosted: Sun Jan 18, 2015 1:42 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 981
Geri wrote:
so basically it depends on the platform, how hard is to write an operating system and a compiler for it, but i would say that writing the c compiler is harder in every case. in some cases, extremely harder.


If we don't try to make a great optimizing compiler and are OK with gcc -O0 level of performance, then I'd say a non optimizing ANSI C (or near ANSI C) compiler is easier and faster to implement than an OS. In the case of C, the language is standardized and quite compact. Something simpler than C or a smaller subset of C could be constructed as well in a fraction of time. I haven't yet implemented my OS and I'm not sure if I ever will. I have many parts laying around (MM, FAT FS, windowing manager, drivers, loaders, etc) and with some work a simple OS could be made out of these. But I expect that my Smaller C compiler is going to be smaller (source-wise) than the kind of simple OS I could build from the OS parts that I have. Right now the compiler appears to be at ~15 KLOC and the library is at ~8 KLOC. But there's no assembler or better preprocessor, which I estimate to take another 6-8 KLOC. So, ~30 KLOCs for a basic toolchain. At the same time the abridged version of MINIX 1.0 (printed in the book) had ~12 KLOC of code. There was no graphics or audio, no UI of any kind besides the simple text console, there was no network, no virtual memory, etc etc. Also, the abridged source didn't include tools. If you add up all those other things, which are essential part of an OS today, plus tools, you'll get more than double than those 12 KLOCs of the abridged MINIX 1.0 version. And it could be improved and extended indefinitely. :) Only a very tiny OS, likely an almost unusable one, would be smaller than a basic toolchain (C compiler, assembler, linker).


Top
 Profile  
 
 Post subject: Re: CompilerDev?
PostPosted: Sun Jan 18, 2015 2:47 pm 
Offline
Member
Member
User avatar

Joined: Sun Jul 14, 2013 6:01 pm
Posts: 442
number of lines are not necessary define the complexity. my game engine is 35k line (not counting loaders).
however, it was easyer than the compiler. my c compiler is now almost 14k line. i think it will be around 20k, when i finish it (~c99 +/- a few thing).

i cant give such precise numbers about my os, becouse its just throwed apart to separate files, its not a cohesive software now, but i would say it will beethwen 5-10k line, if i dont count the font rendering (which has ascii/utf8 fonts hardcoded inside).

_________________
Operating system for SUBLEQ cpu architecture:
http://gerigeri.uw.hu/DawnOS/index.html


Top
 Profile  
 
 Post subject: Re: CompilerDev?
PostPosted: Sun Jan 18, 2015 5:00 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3501
Location: Chichester, UK
A compiler is a much easier task than an OS. You only have to work at the machine level to generate the instructions themselves and don't have to worry about all the hardware details of the system other than the processor itself. An OS has to do a huge amount of work to determine what hardware is present, configure that hardware, and then manage it for the user programs. It also performs a far wider range of duties than a compiler, which is focussed on doing one very specific task.

There is no contest as far as I am concerned - both are difficult, but one is a project that will occupy months, the other one that will take years and, in truth, never be finished.


Top
 Profile  
 
 Post subject: Re: CompilerDev?
PostPosted: Sun Jan 18, 2015 11:46 pm 
Offline
Member
Member
User avatar

Joined: Mon Jun 16, 2014 5:59 am
Posts: 541
Location: Shahpur, Layyah, Pakistan
iansjack wrote:
A compiler is a much easier task than an OS. You only have to work at the machine level to generate the instructions themselves and don't have to worry about all the hardware details of the system other than the processor itself. An OS has to do a huge amount of work to determine what hardware is present, configure that hardware, and then manage it for the user programs. It also performs a far wider range of duties than a compiler, which is focussed on doing one very specific task.

There is no contest as far as I am concerned - both are difficult, but one is a project that will occupy months, the other one that will take years and, in truth, never be finished.

I agreed that OS Development is more time consuming task with much more lines of code. But, I think little theory is required for OS Development. For me, writing an OS is much easier than compiler. Writing a compiler is nearly impossible for me at this stage.


Top
 Profile  
 
 Post subject: Re: CompilerDev?
PostPosted: Mon Jan 19, 2015 12:43 am 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

muazzam wrote:
iansjack wrote:
A compiler is a much easier task than an OS. You only have to work at the machine level to generate the instructions themselves and don't have to worry about all the hardware details of the system other than the processor itself. An OS has to do a huge amount of work to determine what hardware is present, configure that hardware, and then manage it for the user programs. It also performs a far wider range of duties than a compiler, which is focussed on doing one very specific task.

There is no contest as far as I am concerned - both are difficult, but one is a project that will occupy months, the other one that will take years and, in truth, never be finished.

I agreed that OS Development is more time consuming task with much more lines of code. But, I think little theory is required for OS Development. For me, writing an OS is much easier than compiler. Writing a compiler is nearly impossible for me at this stage.


OSs range in complexity from "extremely simple" all the way up to "extremely complicated"; and compilers range in complexity from "extremely simple" all the way up to "extremely complicated".

The simplest possible compiler I can think of is something that takes pre-tokenised input for a stack machine and emits unoptimised output for a similar stack machine (e.g. where "compiling" is pure translation). The simplest OS I can think of is something like DOS but without a file system (where the OS does almost nothing and applications use the BIOS for almost everything). I don't know which of these would be easier.

The hardest compiler may include one or more OSs in its run-time, and the hardest OS may include one or more compilers. I don't know which of these would be easier.

Basically what I'm saying is that I doubt there's a proven method of accurately comparing subjective ranges.


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: CompilerDev?
PostPosted: Mon Jan 19, 2015 2:58 am 
Offline
Member
Member

Joined: Tue Aug 19, 2014 1:20 pm
Posts: 74
Geri wrote:
number of lines are not necessary define the complexity. my game engine is 35k line (not counting loaders).
however, it was easyer than the compiler. my c compiler is now almost 14k line. i think it will be around 20k, when i finish it (~c99 +/- a few thing).

i cant give such precise numbers about my os, becouse its just throwed apart to separate files, its not a cohesive software now, but i would say it will beethwen 5-10k line, if i dont count the font rendering (which has ascii/utf8 fonts hardcoded inside).


Maybe the best measurement of difficulty is how often you have to Google a question.

I've been working on automation tools for an online game, it's currently around 25,000 lines of code and it has been pretty simple while my OS is only around 2000 lines of code and has been quite tough.


Top
 Profile  
 
 Post subject: Re: CompilerDev?
PostPosted: Mon Jan 19, 2015 5:39 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 16, 2014 5:59 am
Posts: 541
Location: Shahpur, Layyah, Pakistan
Brendan wrote:
The hardest compiler may include one or more OSs in its run-time, and the hardest OS may include one or more compilers.

Right


Top
 Profile  
 
 Post subject: Re: CompilerDev?
PostPosted: Mon Jan 19, 2015 5:53 am 
Offline
Member
Member

Joined: Wed Oct 30, 2013 1:57 pm
Posts: 304
Location: Germany
muazzam wrote:
I agreed that OS Development is more time consuming task with much more lines of code. But, I think little theory is required for OS Development. For me, writing an OS is much easier than compiler. Writing a compiler is nearly impossible for me at this stage.
That's very subjective. For me, it's the other way around. Wrinting a compiler feels so easy for me, while actual OSdeving a hard task.

_________________
vineyard, a x86 OS.


Top
 Profile  
 
 Post subject: Re: CompilerDev?
PostPosted: Mon Jan 19, 2015 6:24 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3501
Location: Chichester, UK
I certainly find the idea that "little theory is required for OS development" a rather surprising one.


Top
 Profile  
 
 Post subject: Re: CompilerDev?
PostPosted: Mon Jan 19, 2015 7:15 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 16, 2014 5:59 am
Posts: 541
Location: Shahpur, Layyah, Pakistan
iansjack wrote:
I certainly find the idea that "little theory is required for OS development" a rather surprising one.

I said that little theory is required "as compared to" compiler. Also, little theory is required to develop OS like DOS.


Top
 Profile  
 
 Post subject: Re: CompilerDev?
PostPosted: Mon Jan 19, 2015 9:17 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3501
Location: Chichester, UK
Quote:
I said that little theory is required "as compared to" compiler.
Clearly I need to brush up on my reading skills as I failed to notice the words "as compared to" in your comment. Worse still, I still can't see them.


Top
 Profile  
 
 Post subject: Re: CompilerDev?
PostPosted: Mon Jan 19, 2015 10:07 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 16, 2014 5:59 am
Posts: 541
Location: Shahpur, Layyah, Pakistan
iansjack wrote:
Clearly I need to brush up on my reading skills as I failed to notice the words "as compared to" in your comment. Worse still, I still can't see them.

It was my mistake that I did not wrote "as compared to".


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 118 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group