Introduction: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
No edit summary
m Reverted edits by Strokegmd (talk) to last revision by Bzt
Line 1: Line 1:
== Welcome ==
== Welcome ==
Welcome to Operating System development; the great frontier.
Welcome to Operating System development; the great frontier.[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]


Not all "make it" in this field, many don't even pass the "Hello World" of OS development, but perhaps you will go further and create the next Linux? Or Windows? Or are your goals lower - MenuetOS? Or even CP/M?
Not all "make it" in this field, many don't even pass the "Hello World" of OS development, but perhaps you will go further and create the next Linux? Or Windows? Or are your goals lower - MenuetOS? Or even CP/M?


Whatever your goals, OSDev'ing is the great pinnacle of programming[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]. But, you're not alone. In fact, this entire website, including the [http://forum.osdev.org forums] and this Wiki, are dedicated to OSDev'ing. This is not only about great programming skills, but is about community and de[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]veloping friendships. Be those friendships between fellow forum members or IRQs and processes.
Whatever your goals, OSDev'ing is the great pinnacle of programming. But, you're not alone. In fact, this entire website, including the [http://forum.osdev.org forums] and this Wiki, are dedicated to OSDev'ing. This is not only about great programming skills, but is about community and developing friendships. Be those friendships between fellow forum members or IRQs and processes.


What do you need to succeed in OSDev'ing? You should read the [[Getting Started]] article. If you are going to use C/C++ as your language of choice, you are required to build a [[GCC Cross-Compiler]] first. And if you [[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]prefer to use other [[Languages]] then it is important to have some similar tools (e.g. compiler) or if there's no such tools it is often only your efforts that can help you. But going along with your preferred language can add some motivation and excitement during your work.
What do you need to succeed in OSDev'ing? You should read the [[Getting Started]] article. If you are going to use C/C++ as your language of choice, you are required to build a [[GCC Cross-Compiler]] first. And if you prefer to use other [[Languages]] then it is important to have some similar tools (e.g. compiler) or if there's no such tools it is often only your efforts that can help you. But going along with your preferred language can add some motivation and excitement during your work.


Good luck!
Good luck!
Line 34: Line 34:
* A Graphical User interface (though many modern operating systems incorporate a GUI as part of the OS).
* A Graphical User interface (though many modern operating systems incorporate a GUI as part of the OS).


While most operating systems are distributed with such tools, they are not themselves a necessary part of the OS. Some operating systems, such as Linux, may come in several different packaged forms, called ''distributions'', which may have different suites of applications and utilities, and may organ[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]ize some aspects of the system differently. Nonetheless, they are all versions of the same basic OS, and should not be considered to be separate types of operating systems.
While most operating systems are distributed with such tools, they are not themselves a necessary part of the OS. Some operating systems, such as Linux, may come in several different packaged forms, called ''distributions'', which may have different suites of applications and utilities, and may organize some aspects of the system differently. Nonetheless, they are all versions of the same basic OS, and should not be considered to be separate types of operating systems.

[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]
== What is a kernel? ==
== What is a kernel? ==


The kernel of an operating system is something you will never see. It basica[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]lly enables any other programs to execute. It handles events generated by hardware (called ''interrupts'') and software (called ''system calls''), and manages access to resources.
The kernel of an operating system is something you will never see. It basically enables any other programs to execute. It handles events generated by hardware (called ''interrupts'') and software (called ''system calls''), and manages access to resources.


The hardware event handlers (''interrupt handlers'') will for [[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]instance get the number of the key you just pressed, and convert it to the corresponding character stored in a buffer so some program can retrieve it.
The hardware event handlers (''interrupt handlers'') will for instance get the number of the key you just pressed, and convert it to the corresponding character stored in a buffer so some program can retrieve it.


The ''system calls'' are initiated by user-level programs, for opening files, starting other programs, etc. Each system call handler will have to check whether the arguments passed are valid, then perform the internal operation to complete the request.
The ''system calls'' are initiated by user-level programs, for opening files, starting other programs, etc. Each system call handler will have to check whether the arguments passed are valid, then perform the internal operation to complete the request.

[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]
Most user programs do not directly issue system calls (except for asm programs, for instance), but instead use a ''standard library'' which does the ugly job of formatting arguments as required by the kernel and generating the system call. (For example, the C function ''fopen()'' eventually calls a kernel function that actually opens the file.)
Most user programs do not directly issue system calls (except for asm programs, for instance), but instead use a ''standard library'' which does the ugly job of formatting arguments as required by the kernel and generating the system call. (For example, the C function ''fopen()'' eventually calls a kernel function that actually opens the file.)


The kernel usually defines a few ''abstractions'' like files, processes, sockets, directories, etc. which correspond to an internal state it remembers about last operations, so that a program may issue a session of operation more efficiently.
The kernel usually defines a few ''abstractions'' like files, processes, sockets, directories, etc. which correspond to an internal state it remembers about last operations, so that a program may issue a session of operation more efficiently.

[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]
== What is a shell? ==
== What is a shell? ==


Line 54: Line 54:
* Allow the user to select a program to be started, and optionally give it session-specific arguments.
* Allow the user to select a program to be started, and optionally give it session-specific arguments.
* Allow trivial operation on the local storage like listing the content of directories, moving and copying files across the system.
* Allow trivial operation on the local storage like listing the content of directories, moving and copying files across the system.

[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]
In order to complete those actions, the shell may have to issue numerous system calls, like "open file 'x'; open file 'y' and create it if it doesn't exist; read content from X, write into Y, close both files, write 'done' to standard output".[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]
In order to complete those actions, the shell may have to issue numerous system calls, like "open file 'x'; open file 'y' and create it if it doesn't exist; read content from X, write into Y, close both files, write 'done' to standard output".


The shell may also be used by programs that want to start other programs but do not want to do this themselves (e.g. completing file patterns like "*.mp3", retrieving the exact path of the program, etc.).
The shell may also be used by programs that want to start other programs but do not want to do this themselves (e.g. completing file patterns like "*.mp3", retrieving the exact path of the program, etc.).


Modern shells can also have various extra features, such as the following:
Modern shells can also have various extra features, such as the following:
EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY EIRILEY


* Auto-Completion: By pressing the TAB (or any preferred) key, the word the user is typing will be completed to a valid shell command, a file, directory, or something else. Pressing the auto-complete key multiple times cycles through other completion possibilities.
* Auto-Completion: By pressing the TAB (or any preferred) key, the word the user is typing will be completed to a valid shell command, a file, directory, or something else. Pressing the auto-complete key multiple times cycles through other completion possibilities.
Line 91: Line 90:
* [[Topic:9432|GUI design]]
* [[Topic:9432|GUI design]]
* [[Topic:9448|Handling input events in GUI]]
* [[Topic:9448|Handling input events in GUI]]

[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]
== Why develop an OS? ==
== Why develop an OS? ==[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]


There are various reasons why people choose to develop an operating system. Each individual developer may have their own, but some reasons are common among some (if not most) developers:
There are various reasons why people choose to develop an operating system. Each individual developer may have their own, but some reasons are common among some (if not most) developers:
Line 98: Line 97:
* Having complete control over the machine. When developing an application or other userspace program, the developer has to take the code written by others into consideration: the operating system, the libraries, other programs, etc. It is a powerful feeling for the only code to be running on a machine to be your own.
* Having complete control over the machine. When developing an application or other userspace program, the developer has to take the code written by others into consideration: the operating system, the libraries, other programs, etc. It is a powerful feeling for the only code to be running on a machine to be your own.


* Research. Quite a few operating system projects are started as homework or research projects. While starting an operating system as a homework assignment in a pre-tertiary or first-year environment is generally considered a bad idea (due to short deadlines), a long-term project is quite fine. Research projects are usually undertaken to improve on existing operating syste[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]ms. A common beginner mistake, however, is to underestimate the time needed to write an operating system from scratch.
* Research. Quite a few operating system projects are started as homework or research projects. While starting an operating system as a homework assignment in a pre-tertiary or first-year environment is generally considered a bad idea (due to short deadlines), a long-term project is quite fine. Research projects are usually undertaken to improve on existing operating systems. A common beginner mistake, however, is to underestimate the time needed to write an operating system from scratch.


* To replace the currently available operating systems. Maybe they don't have a particular feature that the developer wants. Maybe they just generally suck (Linux is bloated, Windows is unstable, etc.). This may be for profit; although any returns are likely to be a long time away.
* To replace the currently available operating systems. Maybe they don't have a particular feature that the developer wants. Maybe they just generally suck (Linux is bloated, Windows is unstable, etc.). This may be for profit; although any returns are likely to be a long time away.


* Because it's fun. Low level programming is a fun and exciting task, because you have to do everything. This may seem more difficult (it is, don't worry) but by the same reasons more fun. You know how everything works, how it all fits, and the inner-most workings of your program.
* Because it's fun. Low level programming is a fun and exciting task, because you have to do everything. This may seem more difficult (it is, don't worry) but by the same reasons more fun. You know how everything works, how it all fits, and the inner-most workings of your program.
[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]
Unfortunately, many operating system projects are undertaken for the wrong reasons. See [[Beginner Mistakes]] for a list.[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]


Unfortunately, many operating system projects are undertaken for the wrong reasons. See [[Beginner Mistakes]] for a list.
== See Also ==[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]

=== Articles ===[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]
== See Also ==
=== Articles ===


* [[Required Knowledge]]
* [[Required Knowledge]]
* [[Beginner Mistakes]]
* [[Beginner Mistakes]]

[[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]
[[Category:OS Development]]
[[Category:OS Development]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]][[File:Eiriley.jpg]]