web space | free hosting | Business WebSite Hosting | Free Website Submission | shopping cart | php hosting

Building an Operating System, Introduction

I guess the first question we should ask ourself is what is an OS (Operating System)?

The answer is less sophisticated then you might expect, an OS is basically two things:

1. An interface between the computer hardware and the user programs,
2. Software which controls the user programs.

That's not so bad is it? But it does not really answer the question, what does an OS do? Well basically when an OS loads(1) it does several things:

1. It initializes its own internal data structures, we will take a closer look at all this later on.
2. It loads various system services which may (or may not) require initializing hardware.
3. It prepares the operating environment for the first process to run.
4. It context switches into the first process.
5. When an interrupt(2) occurs the operating system handles the interrupt if it knows how, otherwise (depending on the mood of the OS designer) the OS might crash, give an error message, or leave a big intimidating blue screen with lots of text on it.(3)

Overall the workings of an OS are rather straight forward but actually doing it right is not only hard, but even figuring out what "doing it right" should mean is near impossible. For example, if a user program starts making requests for memory that is outside the bounds of that tasks memory area should the OS crash or should it terminate the program, or should it only ask the user if it should crash or terminate the program?

In case you are wondering Micosoft answered that question (in Windows NT / 2000 / XP) with a fellow named Doctor Watson who terminates the program, and they call that particular error an Access Violation.
In Unix the program is terminated with the error message "segmentation violation" and possibly a core dump occurs. But all of this will be studied in greater detail later on.

And now, onto the tutorials.

[BACK] Take me back to the table of contents.

Point of terminology because I am old fashioned in this respect, you launch rockets and load programs. I hate when people say: "launch blah", where blah is some program. It is also not convention to say "launch this program".
Interrupts are the way hardware and user programs tell the operating system "hey big guy - wake up I need you to do something please" We will take a closer look in the first few chapters of this tutorial and you may want to have a look at
this book for more details.
If the OS designer was either very silly or very nasty the OS might ignore the interrupt and go on with business as usual in which case the user is left to wonder why the printer keeps printing pages with lots of letter P's on them or why the user can not type letter Q anymore.