An OS question?

Started by
7 comments, last by blizzard999 19 years, 3 months ago
I was wondering how much work it would be to code an OS. I dont mean something fancy to the tee like windows but something with only the basics like DOS. Also, has anyone on here ever tried to create an OS just for experimental purposes, and what languages would i use to code it?
Advertisement
You can code a very basic OS in C and ASM. However, an operating system throws in a whole new slew of topics: file systems, archiving, user input, memory management, display, etcetera. Then you have driver hell, where you need to make sure your software works on different architectures.

But getting a simple "hello world" bootloader OS up and running should be no sweat to the moderately experienced programmer.

Here are some resources:

OSDev
JOSH Tutorial
BonaFide OS Dev

Good luck!
Operating Systems are usualy coded in C with ASM where C cannot be used. One example of where C cannot be used is the bootloader which loads your OS when the computer boot. The JOSH project is a good place to look for a tutorial on building a simple console based OS, but it's a real-mode operating system which is different from Windows or Linux that are protected-mode operating systems (you'll learn the differences by learning the JOSH operating system tutorial).

Also consider that writing an operating system is not an easy task. There's a lot of work involved and many people don't go really farther than a simple "hello world".

You can also google for "operating system development" to find other resources like
osdev.org

hope that helps !
Matt

edit: typos
Matt
There are a few crucial turning points in developing an OS:

1) cramming your boot loader into the first sector of a device
2) jumping from that boot loader to the loaded OS bootstrap
3) jumping from that OS bootstrap to the real, loaded kernel
4) enabling interrupts
5) stopping going through the BIOS, and letting your own disk driver take over
6) turning on VM, while crossing your fingers and closing your eyes
7) scheduling over to another thread (or process)

Once you're past those hurdles, the rest is fairly straightforward, if still a lot of work. Especially the driver situation is annoying, if you want sound or graphics output.
enum Bool { True, False, FileNotFound };
Hmm. Well what im wanting to do is create an original OS that can run a basic program. This program being an OS wizard/editor.

It will act like a webpage wizar/editor to were you anyone can use the wizard to get their own original OS with only the stuff that they want on there, and since its a wizard it will be easy enough for anyone to use since it will be set up in a point and click format.

Then you will have the editor for the more experienced computer ppl out there so they can optimize the OS and do different things with it so they can make a specific-type OS, instead of having to build a specific-type CPU.

I know that is kinda hard to understand but heres how i look at it, say ya wanna buy a gaming PC, the first one that comes to mind is Alienware. Alienware comps can get into the 5k range and even higher so why not be able to make an OS thats specifically for gaming or an OS thats specifically for programming or one thats specifically for holding grandmas recipes.

This would give the consumer uber amounts of options. Does this make any sense to anyone?
That's hella work.

Until you got to the last two paragraphs, you sounded like you were going for making an OS which essentially /is/ a Scheme/Smalltalk/InteractiveC engine, with maybe the capacity to compile down to native code once a consumer builds the "system package" they like.

Once I read past there, however, you were pretty much sunk. There are computers made specifically for gaming; they're called Playstations, XBoxes, Gamecubes, et cetera. And if you want a computer made specifically for holding grandma's recipies, just write a full-screen clearly-labelled and intuitive (to grandma's tastes and abilities, mind you) recipe book program for your favourite freeware operating system.

Don't worry. Most everybody gets that dream at some point. It's just not feasible. A shell which is truly fully modifiable is far, far more work than you would ever want to do. Start with a paradigm and work with it, is the best thing to do.

Now, as far as your original post... just the basics?

Write a kernel that handles disk and port I/O, CGA/EGA graphics (VGA is ugly, VESA is a nightmare), and keyboard input. Add code to wrap around the task of talking to the network card, and building filesystems out of raw on-disk data. And go.
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
As much as I would hate to dampen your spirits. Unfortunately you have no idea of immense size of this task you are talking about. If you're only taking about something that might eventually be as basic as Windows 3.1, well... lets just say that by the time you're finished, current hardware would barely resemble todays hardware.

It's one of those "The more you know, the more you realise you don't know" things.

Write a compliler + virtual machine instead. It's much easier.
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms
It really depends what you mean by "Writing an OS".

Obviously OSs don't JUST consist of kernels otherwise they wouldn't be very useful. Before you can write your first line of user-space code, you will need:

- A boot method
- A kernel
- A C library (or library for whatever language you intend to use to your your user-space apps in)

Then of course you can knock up those tools which make the system work.

Do consider using an existing bootloader, kernel and C library, if you want any actual work done.

I don't mean that you HAVE to use Linux, but Linux is certainly the most developed publicly available kernel (IMHO).

Mark
Probably it is more 'simple' to derive your own Linux distro. And you can learn a lot about how a modern and 'real' OS works.

This topic is closed to new replies.

Advertisement