Basic operating system development

Started by
19 comments, last by Bregma 11 years, 7 months ago

1.Do you know in any good sense how GUIs work with OS kernels, how hardware interrupts work, how memory in kernels works, how kernels allocate user space for the user portion of programs to execute under a GUI or program/window structure for this process or purpose of using a text-editor?


GUIs? There's an enormously long road to follow before one can even start to think about writing a graphical system for an OS. It's probably a very good idea to not incorporate a graphical system at all for a first OS. Same goes for multi-core kernel design as it's hard enough to get a kernel to play nicely with a single CPU.

Knowledge of an assembly language for your hardware platform is a must, I'll even go as far as to say that you need quite some expertise in it as well, even if you're writing the majority of your system in a language like C. A solid understanding of an assembly language implies a good knowledge of what a CPU actually does under the hood, and that understanding is absolutely crucial if you're going to write a system which runs entirely on bare metal.

OS development is one of the most advanced topics you could tackle in computer science with almost no rewarding results, and it'd be wise to keep this in mind at all times.

I gets all your texture budgets!

Advertisement
It is worth considering a 'dumbed-down' VM, designed for learning OS development.

One of my professors wrote CLOWN, which was used in our Operating Systems design course. It's basically a much-simplified x86-style processor with minimal added complexity (just RAM, console I/O, hard drive, and interrupts). Takes an awful lot of the pain away, compared to learning on real hardware.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

OS development is very exciting and rewarding, often filled with Fun. YOLO.

Here's some tips:

(1) stick to C as much as possible, and limit your assembly to inline assembly where you can (and that's almost everywhere)
(2) start with an existing bootloader to get up and running (grub, redboot, das u-boot with the latter two particularly suited to ARM)
(3) use an emulator like qemu or bochs rather than real hardware until you've at least booted to a userland command interpreter because they tend to follow published specs better than real hardware and you can use gdb instead of jtag for debugging

Good luck.

Stephen M. Webb
Professional Free Software Developer

I cant give any advice because I dont even know the slightest thing involved in making an OS, however I gotta say it sounds like a fun thing to do biggrin.png I am sure you will learn a lot from it


As i said before i realise the enormity of the above task. If you wish to know how this connects to game development, i like the idea of working on something for something i have done, rather than a pre existing os because i would rather be satisfied by my achievement rather than anybody playing it.


They say making an engine is like reinventing the wheel, therefore making an OS would be like creating the universe.

Have fun with your project and good luck smile.png

Edit: Doing a quick search I came across this, not sure if its useful at all http://www.academicearth.org/courses/operating-systems-and-system-programming
"Operating Systems: Design and Implementation" is the definitive text on the subject. Grab a copy of the book and the latest source for Minix 3 and you'll be off to a good start.


"Operating Systems: Design and Implementation" is the definitive text on the subject. Grab a copy of the book and the latest source for Minix 3 and you'll be off to a good start.

Thanks, like linus, didnt he based the original linix kernel off minix or something

[quote name='xenobrain' timestamp='1347932254' post='4981098']
"Operating Systems: Design and Implementation" is the definitive text on the subject. Grab a copy of the book and the latest source for Minix 3 and you'll be off to a good start.

Thanks, like linus, didnt he based the original linix kernel off minix or something
[/quote]

+1 on that one, it's great. Microkernels bring about some really interesting issues.
On the rest: I think most people replying are overly negative, it's not that hard. Especially if you make your bootloader take you to pmode directly, plus, if you want fancy resolutions GRUB (which is the loader I've used the most) can hand you off in some VESA mode.
Booting from a floppy is easy-peasy, I think USB can even emulate a floppy drive...? Anyway, if you want to split your system into many files without implementing a floppy driver and filesystem, you can - wait for it - let GRUB load it as a module. So easy!
What do you mean by a "basic API"? Syscalls to support libc, for example? If you strip down your memory protection, you don't need any API.
To write an editor (assuming console-based), you need to implement screen scrolling (maybe you can get this in hardware though), moving the carret, setting letters on-screen, etc. If you want a proper GUI, you have to draw the characters yourself, pixel by pixel.
For the languages, some people like to make their whole system in asm but I prefer to stick with C as long as I can. Some things need to be in asm (multitasking and configuration thingies, for example).
It sounds like a fun project, and not crazy at all!

What do you mean by a "basic API"? Syscalls to support libc, for example?

i mean like a basic graphical library, like curses or allegro. Should of clarified that.

And i am not planning a "GUI" as such, more of a command line interface, a la DOS or the (as far as i know) the original Unix.
Maybe this guy can help: http://mikeos.berlios.de/write-your-own-os.html

It helped straighten things out for me in many ways.
Yes, this is red text.
For a more complete experience, it might be useful to learn via xv6, a simple Unix-like teaching operating system.

Here are some relevant resources:
http://pdos.csail.mit.edu/6.828/2011/xv6.html
http://pdos.csail.mit.edu/6.828/2011/xv6/book-rev6.pdf // even if you don't decide to use xv6 for learning, I'd still recommend to read Chapter 0
https://github.com/duckinator/xv6#readme

6.828 @ MIT:
http://pdos.csail.mit.edu/6.828/
// note: this links to the current version; the 2011 version above might have more lectures available

CS422/522 @ Yale:
http://zoo.cs.yale.edu/classes/cs422/2011/info#texts
http://zoo.cs.yale.edu/classes/cs422/2011/sched
http://zoo.cs.yale.edu/classes/cs422/2011/reference

W4118 @ Columbia:
http://www.cs.columbia.edu/~junfeng/12sp-w4118/syllabus.html

See also V6 (more of historical interest, since xv6 has replaced it):
http://www.lemis.com/grog/Documentation/Lions/

See also:
Operating Systems: Three Easy Pieces: http://pages.cs.wisc.edu/~remzi/OSTEP/

This topic is closed to new replies.

Advertisement