Hi, I'd like to know what you guys would use to develop an os.

Also, is there a disadvantage to using C?
Would things be slower if they were coded in C instead of in assembly?

Thanks.

- ~Steve~ -
Posted on 2005-06-05 01:16:45 by ~Steve~
I use a mix of C/C++ and assembly.

I wouldn't say there's any disadvantages to using C - unless you write very bad code and/or have a very bad compiler, you won't see much of a size/speed hit.

If you want to use C++, you'll have to be careful, and you should probably avoid new/delete and especially exception handling until "you know what you're doing".

I used to think that an OS kernel should be coded in all-assembly, but I don't see any reason for this anymore. Some routines have to be coded in assembly though, and others should. Ie, code to set up descriptor tables and paging, as well as low-level context switching, more or less have to be done in assembly. Routines for clearing and copying pages should be coded in assembly, so you can take advantage of MMX, or the cache-bypassing stores of SSE.


Would things be slower if they were coded in C instead of in assembly?

That depends on the quality of the assembly code you would have written instead, as well as the quality of the C code, as well as the quality of the compiler. In most cases, you won't be able to notice a difference, and unless you put some effort into the assembly, the compiler will beat you.
Posted on 2005-06-05 01:25:55 by f0dder
Thanks for the quick reply. :D

Well, uh, not much else to say since you answered all the questions I had. I guess I'll just see what happens and go on from there.

Thanks again.

- ~Steve~ -

EDIT: Ah, woops, wasn't sure what section this belonged in. Sorry!
Posted on 2005-06-05 01:44:14 by ~Steve~
I will not like to use C, I prefer to use asm, but Im not proud at it, and I know that is more posible that a compiler beat my asm code, but that will not stop me, tought Im thinking that perhaps I will write two versions of the same code, or start in asm then when the time come switch to a high level language, but I have my tought about it :D and I hope it will not be C/++, but that can change tought.
Posted on 2005-06-05 19:59:24 by rea
To me its simple, if your a better asm programmer than C programmer, make the whole OS in asm, but if you are better at C programming, do just the basic's in asm and the rest in C.

My OS is full asm, but i do not for one moment think it will be faster than if writen in C, its a control thing, i like to control and understand what is going on under my programs, you can never understand fully whats go on in windows or linux, that why i am making my own OS in the first place.

Dex4u.
Posted on 2005-06-05 20:27:06 by Dex4

Hi, I'd like to know what you guys would use to develop an os.

Also, is there a disadvantage to using C?
Would things be slower if they were coded in C instead of in assembly?

Thanks.

- ~Steve~ -


It depends:

- What is your knowledge of particular language (i.e. there is no point to write assembly code if it will became worst than a compiler generated one...)
- What is the purpose of the os. For example:
? - OS for particular device. Limited functionality. No need in regular update/improvement. Hardware restrictions. --- here is assembly choice would be wise.
? - Big and complicated os. Requires regular features update. Portability is required. --- C.
? - And the list with various combinations of above goes on...

Just don't forget, the most important decision is to choose the language you enjoy to use the most. It's all about fun afterall.
Posted on 2005-06-05 22:58:19 by arafel