Should I learn ASM first or read about OS Desgin?
Should I learn ASM first or read about OS Desgin?
I've always been very interested in how an operating system works, what makes them tick, etc. Therefore, creating my own CLI operating system has always seemed interesting to me. But I know very little programming and so it is clearly beyond me at the moment. I am realistic and therefore don't expect to be able to develop even the simplest OS for at least a few years. I have lots to learn. The only thing is I need to know what I should start on. Would it be a good idea to go strait into assembly programming or would I be better advised to spend time on reading about OS Design?
Keep in mind that I am a student and therefore wish to spend as little money on this as possible. I have this website on OS design. Looks good but I haven't looked at it in depth yet;
http://cdsmith.twu.net/professional/osdesign.html
Any other good resources I should check out?
My hope is that within a couple of years from now I'll know enough to build and UNDERSTAND the code behind a bootloader and have it boot an OS with a CLI which will accept a few simple commands like time, date, shutdown, etc. Is this hoping for to much or should I be able to manage that?
Thanks for any help.
Keep in mind that I am a student and therefore wish to spend as little money on this as possible. I have this website on OS design. Looks good but I haven't looked at it in depth yet;
http://cdsmith.twu.net/professional/osdesign.html
Any other good resources I should check out?
My hope is that within a couple of years from now I'll know enough to build and UNDERSTAND the code behind a bootloader and have it boot an OS with a CLI which will accept a few simple commands like time, date, shutdown, etc. Is this hoping for to much or should I be able to manage that?
Thanks for any help.
I would recommend at least learning some basic ASM, the rest you could pick up as you go along. At least that's what I did.
Here are some good OS programming references
http://www.osdev.org/wiki/Main_Page
http://www.osdever.net/index.php
http://my.execpc.com/CE/AC/geezer/osd/
http://www.nondot.org/~sabre/os/articles
just to get you started.
Oh and the Intel manuals from http://www.intel.com/products/processor/manuals/ are great, especially 3A and 3B
Here are some good OS programming references
http://www.osdev.org/wiki/Main_Page
http://www.osdever.net/index.php
http://my.execpc.com/CE/AC/geezer/osd/
http://www.nondot.org/~sabre/os/articles
just to get you started.
Oh and the Intel manuals from http://www.intel.com/products/processor/manuals/ are great, especially 3A and 3B
Thanks, I've bookmarked those sites and will look at them later tonight.
I've just read that I shouldn't bother writing my own bootloader because it's not the OS and takes a lot of time and then go on to recommending bootloaders like GRUB and LILO. These are very advanced bootloaders while the bootloadres I've seen in OS dev tutorials are usually quite short. Can someone tell me what they think about the matter. I'm very new to this. I take it the bootloader loads the kernel? So I need to go strait on to develop a kernel?
I've just read that I shouldn't bother writing my own bootloader because it's not the OS and takes a lot of time and then go on to recommending bootloaders like GRUB and LILO. These are very advanced bootloaders while the bootloadres I've seen in OS dev tutorials are usually quite short. Can someone tell me what they think about the matter. I'm very new to this. I take it the bootloader loads the kernel? So I need to go strait on to develop a kernel?
Last edited by alehel on Mon Jan 29, 2007 5:26 pm, edited 1 time in total.
Re: Should I learn ASM first or read about OS Desgin?
Maybe try your hand at some C, C++, Perl, PHP, anything really. Basically learn basic programming techniques. Don't worry about assembly if you don't know that kind of stuff. Assembly is simple anyway (That is, to most.) as it consists of instructions that do very small tasks themselves. The only hard part about it is learning how to combine those instructions together to do more complex things.alehel wrote: But I know very little programming
alehel wrote:My hope is that within a couple of years from now I'll know enough to build and UNDERSTAND the code behind a bootloader and have it boot an OS with a CLI which will accept a few simple commands like time, date, shutdown, etc. Is this hoping for to much or should I be able to manage that?
Sure!!! A couple of years? (Meaning two right?) Yeah! I actually started osdev almost immediately after I learned how to program in C. (C++ actually, but they're nearly identical.) Oh, and please don't spend all your time with the bootloader. It isn't that complicated; It just follows the computer's boot process. (Use GRUB! )
Have fun!
C8H10N4O2 | #446691 | Trust the nodes.
I expect the C language is the most useful language to learn in conjunction with OS design and implementation. As far as I've understood C++ does have limitations which makes it slightly difficult to code an OS. I have the second edition of The C ANSI Programming Language by Brian W. Kernighan and Dennis M. Ritchie so I'll work my way through that.
C++ does work, if that's your kinda thing. With very little work. (I have made a small C++ kernel. Not that different from C really.) Yet, I really isn't worth it, because C looks cooler.alehel wrote:I expect the C language is the most useful language to learn in conjunction with OS design and implementation. As far as I've understood C++ does have limitations which makes it slightly difficult to code an OS.
That's a deep book. One of my personal favorites. Awesome, just awesome.alehel wrote: I have the second edition of The C ANSI Programming Language by Brian W. Kernighan and Dennis M. Ritchie so I'll work my way through that.
On the matter of boot loaders, I suggest you just use GRUB. It works, it does what you want it to. However, when you get to the point when GRUB is becoming more of a hassle than a blessing, then write your own. This allows you to get into the main aspects of osdev instead of playing around with the beginnings.
Toodles!
C8H10N4O2 | #446691 | Trust the nodes.
When I started I know nothing about Assembly and nearly knowthing about C. I started with the most basic bootsector tutorials that will teach you how to write "hi" on the screen when the computer started and experimented my way from there.
It took be about a year or so (with great help from the osdev and MT forums) to actually understand how to do stuff on my own, but i've never regretted learning it this way. As a bonus, you get good understanding of other languages too.
EDIT: I would strongly advise against using bootloaders such as GRUB if you don't know much about programming and hardware, playing with your own bootsector will teach you many valuble lessons.
It took be about a year or so (with great help from the osdev and MT forums) to actually understand how to do stuff on my own, but i've never regretted learning it this way. As a bonus, you get good understanding of other languages too.
EDIT: I would strongly advise against using bootloaders such as GRUB if you don't know much about programming and hardware, playing with your own bootsector will teach you many valuble lessons.
Hi,
However, GRUB is adequate and can boot your OS from a wide variety of sources (e.g. from many different file systems, from network, etc). If you're writing a kernel, then using GRUB makes things easier because you don't need to worry about writing and maintaining the boot loader code.
Unfortunately, IMHO GRUB is only "adequate". Sooner or later, depending on your OS, you may need more than GRUB provides, and/or you might want to get rid of GRUB for other reasons. For example, I normally have a menu driven tool that allows the user to select a default video mode during boot (that relies on BIOS functions that aren't available in protected mode after GRUB boots) that's used when the OS doesn't have a native video driver (which is likely considering how impossible it is to get information for most video cards). I also have several different kernels and auto-detect which kernel is the most appropriate for the computer during boot, and need to handle multi-CPU (where extra CPUs start in real mode, not protected mode). Lastly, GRUB can be complicated to install, may not support your OSs native file system (and if you're OS is "different" it may be hard to port GRUB's installer to your OS), and you may or may not want to include code licensed as GPL in your project.
I'd recommend trying to write your own boot loader as a learning excercise, then using GRUB for a hobby kernel (also as a learning excercise). Then (after getting the hobby kernel to a "good enough" stage) you should've learnt enough to decide for yourself if GRUB is suitable for your next kernel or not....
Cheers,
Brendan
For people who are used to writing applications it can be a little hard to get used to the idea of having nothing - no file system, no DLLs or shared libraries, no executable format, no memory management, no standard library, etc. In this case writing your own boot loader can give you experience in having very little to rely on, and can also help you to understand some of the complexities of the CPU and other hardware that are normally hidden by an OS. This experience can help when you start looking at writing a kernel (where there's even less to rely on, and even more you need to know about the complexities of the CPU and hardware).alehel wrote:I've just read that I shouldn't bother writing my own bootloader because it's not the OS and takes a lot of time and then go on to recommending bootloaders like GRUB and LILO. These are very advanced bootloaders while the bootloadres I've seen in OS dev tutorials are usually quite short. Can someone tell me what they think about the matter. I'm very new to this. I take it the bootloader loads the kernel? So I need to go strait on to develop a kernel?
However, GRUB is adequate and can boot your OS from a wide variety of sources (e.g. from many different file systems, from network, etc). If you're writing a kernel, then using GRUB makes things easier because you don't need to worry about writing and maintaining the boot loader code.
Unfortunately, IMHO GRUB is only "adequate". Sooner or later, depending on your OS, you may need more than GRUB provides, and/or you might want to get rid of GRUB for other reasons. For example, I normally have a menu driven tool that allows the user to select a default video mode during boot (that relies on BIOS functions that aren't available in protected mode after GRUB boots) that's used when the OS doesn't have a native video driver (which is likely considering how impossible it is to get information for most video cards). I also have several different kernels and auto-detect which kernel is the most appropriate for the computer during boot, and need to handle multi-CPU (where extra CPUs start in real mode, not protected mode). Lastly, GRUB can be complicated to install, may not support your OSs native file system (and if you're OS is "different" it may be hard to port GRUB's installer to your OS), and you may or may not want to include code licensed as GPL in your project.
I'd recommend trying to write your own boot loader as a learning excercise, then using GRUB for a hobby kernel (also as a learning excercise). Then (after getting the hobby kernel to a "good enough" stage) you should've learnt enough to decide for yourself if GRUB is suitable for your next kernel or not....
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.
Just to toss in another "vote", go for a very solid understanding of at least one programming language, backed up by at least one non-trivial user-space project carried through. "Understanding" includes the language proper, the tools involved, versioning control, documentation etc. etc.
If your main aim is toying around with OS development, I strongly suggest C as first and main language. C++, ASM, and a couple of others would do, and have their individual pro's and con's, but C is the best choice for the hobbyist because of its good tradeoff between low-level control and high-level structure as well as the majority of tutorials and prior art being in C.
When you're "done" with gathering user-space experience (which will take most of your preparation time, mind you!), get two books on OS design / inner workings, and make up your mind if you really want this.
Then get the CPU manuals of your choice platform (most likely, IA32/AMD64) in their latest version, a good ASM tutorial (I recomment "Art of Assembly", DOS edition - google for it!), and start...
Being a "novice programmer", as you stated, I would recommend not thinking about OS development for at least another two years. Others will cry bloody murder and tell you how quick they learned to do OS coding, but it is my opinion that it takes an experienced if not veteran programmer to make an OS "work" and having fun in the process.
If your main aim is toying around with OS development, I strongly suggest C as first and main language. C++, ASM, and a couple of others would do, and have their individual pro's and con's, but C is the best choice for the hobbyist because of its good tradeoff between low-level control and high-level structure as well as the majority of tutorials and prior art being in C.
When you're "done" with gathering user-space experience (which will take most of your preparation time, mind you!), get two books on OS design / inner workings, and make up your mind if you really want this.
Then get the CPU manuals of your choice platform (most likely, IA32/AMD64) in their latest version, a good ASM tutorial (I recomment "Art of Assembly", DOS edition - google for it!), and start...
Being a "novice programmer", as you stated, I would recommend not thinking about OS development for at least another two years. Others will cry bloody murder and tell you how quick they learned to do OS coding, but it is my opinion that it takes an experienced if not veteran programmer to make an OS "work" and having fun in the process.
Every good solution is obvious once you've found it.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
I think you can easily do both together. reading OS books shouldn't prevent you from doing ASM experiments. You'll need both do to some OS deving anyway.Would it be a good idea to go strait into assembly programming or would I be better advised to spend time on reading about OS Design ?
i wouldn't. Unless you're experienced enough in ASM and/or C to write your own bootloader correctly, writing your own bootloader might put your system at risk, and will imho mostly teach you that the PC architecture never received a clear way to instruct a program how much RAM is installed, etc.I would strongly advise against using bootloaders such as GRUB if you don't know much about programming and hardware, playing with your own bootsector will teach you many valuble lessons.
Well I'm now working my way through the C ANSI book and so far it's going quite well. I've also started reading the Common Man's Guide to Operating System Design Architecture to get an understanding for how operating systems work, while listening to theJazz, a new radio channel here in England .
Thanks for all the advice guys (and gals).
Thanks for all the advice guys (and gals).
Getting started
I'd like to add a welcome and good luck with the learning.
I'd read and experiment with C. Get GCC or minGW (if you are windows) for a free compiler.
Once you start to get the hang of the language syntax I would look at writing some of the fundamental computer algorithmns - linked lists, sorting etc. You'll find you may need them in your OS.
I suspect OS dev can be a very long lasting hoby. I'm currently on v2 of mine - currently thinking about devices and drivers.
I'd read and experiment with C. Get GCC or minGW (if you are windows) for a free compiler.
Once you start to get the hang of the language syntax I would look at writing some of the fundamental computer algorithmns - linked lists, sorting etc. You'll find you may need them in your OS.
I suspect OS dev can be a very long lasting hoby. I'm currently on v2 of mine - currently thinking about devices and drivers.