Introduction: Difference between revisions

From OSDev Wiki
Jump to navigation Jump to search
(31 intermediate revisions by 22 users not shown)
Line 1: Line 1:
== Welcome ==
== Welcome ==
Welcome to (削除) Operating System (削除ここまで)development; the great frontier.
Welcome to (追記) operating system (追記ここまで)development; the great frontier. (追記) 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 OSDev, 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. 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. (追記ここまで)


(削除) Whatever (削除ここまで)you (削除) goals, (削除ここまで)OSDev'ing (削除) is (削除ここまで)the (削除) great pinnacle (削除ここまで)of (削除) programming. But (削除ここまで), you(削除) 're not alone (削除ここまで). (削除) Infact, this entire website, including the 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 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 OSDeving? You should read this article: [[Getting Started]] (削除ここまで)
(追記) Good luck! (追記ここまで)


(削除) Do you want (削除ここまで)to (削除) read (削除ここまで)a (削除) step (削除ここまで)-(削除) by (削除ここまで)-(削除) step tutorial (削除ここまで)to (削除) writing (削除ここまで)a (削除) basic (削除ここまで)kernel you can (削除) build upon (削除ここまで)? (削除) You should (削除ここまで)read (削除) [http (削除ここまで):(削除) //osdever (削除ここまで).(削除) net/bkerndev/Docs/intro (削除ここまで).(削除) htm Bran (削除ここまで)'(削除) s Kernel Development Tutorial] (削除ここまで), and the (削除) article (削除ここまで)about (削除) [[Bran (削除ここまで)'s (削除) Known Bugs]] (削除ここまで).
(追記) == What is an Operating System? == (追記ここまで)
(追記) An operating system is a software controlling the operation of a computer system and its resources. Among other things, there's one very important criteria common (追記ここまで)to (追記) all operating systems:<blockquote>Capable of loading and executing user programs providing standardized (hardware-independent) input / output interface for them.</blockquote>Major functions of operating systems may include: (追記ここまで)
(追記) * Managing memory and other system resources. (追記ここまで)
(追記) * Imposing security and access policies. (追記ここまで)
(追記) * Scheduling and multiplexing processes and threads. (追記ここまで)
(追記) * Launching and closing user programs dynamically. (追記ここまで)
(追記) * Providing a basic user interface and application programmer interface. (追記ここまで)
(追記) Not all operating systems provide all of these functions. Single-tasking systems like MS-DOS would not schedule processes, while embedded systems like eCOS may not have a user interface, or may work with a static set of user programs. (追記ここまで)
(追記) An operating system is '''not''': (追記ここまで)
(追記) * The computer hardware. (追記ここまで)
(追記) * A specific application such as (追記ここまで)a (追記) word processor, web browser or game. (追記ここまで)
(追記) * A suite of utilities (like the GNU tools, which are used in many Unix (追記ここまで)-(追記) derived systems). (追記ここまで)
(追記) * A development environment (though some OSes, such as UCSD Pascal or Smalltalk (追記ここまで)-(追記) 80, incorporate an interpreter and IDE). (追記ここまで)
(追記) * 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 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. (追記ここまで)
(追記) == What is (追記ここまで)a kernel(追記) ? == (追記ここまで)
(追記) 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 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. (追記ここまで)
(追記) 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. (追記ここまで)
(追記) == What is a shell (追記ここまで)? (追記) == (追記ここまで)
(追記) A shell is a special program that is usually integrated in an OS distribution, and which offers humans an interface with the computer. The way it appears to users may vary from system to system (command line, file explorer, etc), but the concept is always the same: (追記ここまで)
(追記) * 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. (追記ここまで)
(追記) 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.). (追記ここまで)
(追記) Modern shells can also have various extra features, such as the following: (追記ここまで)
(追記) * '''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. (追記ここまで)
(追記) * '''Character Insertion''' (追記ここまで): (追記) The user can move around in what they entered by using the arrow keys. When typing new characters in the middle of a sentence, characters will get "inserted" (追記ここまで).
(追記) * '''Shell History''': By using the up and down arrow keys, the user can scroll through previous input (追記ここまで).
(追記) * (追記ここまで)'(追記) ''Scrolling''': When there are more lines than the console is high (追記ここまで), (追記) save the output in a buffer and allow the user to scroll up (追記ここまで)and (追記) down in (追記ここまで)the (追記) console. (追記ここまで)
(追記) * '''Scripting''': Some shells have custom scripting languages. Examples of scripting languages are Bash or DOS batch. (追記ここまで)
(追記) * etc. (追記ここまで)
(追記) == What is a GUI (追記ここまで)about(追記) ? == (追記ここまで)
(追記) The graphical user interface (GUI) is the most visible part of any operating system that has one. Its role goes beyond a simple drawing library; it must also be able to: (追記ここまで)
(追記) * Catch user input events (keyboard, mouse, etc.) and dispatch them to the proper object. (追記ここまで)
(追記) * Update the internal information of what is to be displayed where on the screen, determining which parts of the screen need to be redrawn. (追記ここまで)
(追記) * Update the ''visible'' screen contents, redrawing the necessary parts. (追記ここまで)
(追記) * Do so in a way that feels natural, intuitive, and responsive to the user. (追記ここまで)
(追記) === Desktop Environment, Window Manager, Widget Library === (追記ここまで)
(追記) When you are launching into a KDE or Windows session, that is a ''desktop environment'', i.e. a graphical shell providing the functional environment for all lower-level functions. (追記ここまで)
(追記) The part of the system responsible for organizing the windows of the various running programs, their resizing/closing gadgets, window borders, scrollbars etc. is the ''Window Manager''. (追記ここまで)
(追記) Finally you have the subsystem that does the drawing of control elements, rendering documents on screen etc.; this is commonly called the ''widget library''. However, there are alternatives to widget libraries, usually in the form of declarative languages (e.g., Mozilla's XUL, Qt (追記ここまで)'s (追記) QML) (追記ここまで).
(追記) === GUI-related forum threads === (追記ここまで)


(削除) Good luck (削除ここまで):(削除) ) (削除ここまで)
(追記) * [[Topic (追記ここまで):(追記) 8783|Will you implement a GUI?]] (追記ここまで)
(追記) * [[Topic:9432|GUI design]] (追記ここまで)
(追記) * [[Topic:9448|Handling input events in GUI]] (追記ここまで)


== (削除) What is (削除ここまで)an (削除) Operating System (削除ここまで)? ==
== (追記) Why develop (追記ここまで)an (追記) OS (追記ここまで)? ==
(削除) Computer systems in general (削除ここまで)are (削除) a finite resource (削除ここまで). (削除) Their entire purpose is to execute a set of instructions (削除ここまで), (削除) something we commonly call a "program." This concept has (削除ここまで)not (削除) changed much (削除ここまで)over the (削除) years (削除ここまで). (削除) Early main-frame (削除ここまで)system (削除) administrators had (削除ここまで)the (削除) job of taking program execution requests (削除ここまで), (削除) assigning them (削除ここまで)a (削除) priority, and giving them (削除ここまで)a (削除) time frame (削除ここまで)to (削除) run (削除ここまで). (削除) These concepts are the basis of any (削除ここまで)operating system(削除) , they just tend to occur thousands of times per second (削除ここまで). (削除) The (削除ここまで)operating system (削除) can allow execution of multiple programs so quickly that it (削除ここまで)is (削除) virtually unnoticeable (削除ここまで)to a (削除) human user (削除ここまで), (削除) making it seem as all (削除ここまで)the (削除) programs are running at (削除ここまで)the (削除) same time (削除ここまで). (削除) Many things (削除ここまで)have (削除) to occur in order to allow multiple programs to execute in such (削除ここまで)a (削除) manner (削除ここまで). (削除) The priority (削除ここまで)is (削除) safety (削除ここまで), (削除) because if the system crashes and becomes unusable (削除ここまで), (削除) not much else matters (削除ここまで). (削除) Second (削除ここまで)is (削除) security, denying the capability of malicious programs, such as viruses (削除ここまで)and (削除) worms (削除ここまで), to (削除) wreak havoc on the system is a must (削除ここまで). (削除) Even (削除ここまで)more (削除) so (削除ここまで)is (削除) security-related software (削除ここまで), (削除) denying access to such software (削除ここまで)'(削除) s memory space is imperative (削除ここまで). (削除) The last major issue is speed; If software runs slow or takes up valuable system resources (削除ここまで), it (削除) makes a run (削除ここまで)-(削除) away impact on the rest (削除ここまで)of the (削除) system (削除ここまで).
(追記) 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: (追記ここまで)
(追記) * '''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 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. (追記ここまで)
(追記) * '''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. (追記ここまで)
(追記) Unfortunately, many operating system projects are undertaken for (追記ここまで)the (追記) wrong reasons. See [[Beginner Mistakes]] for a list (追記ここまで).
(追記) == See Also == (追記ここまで)
(追記) === Articles === (追記ここまで)


(削除) ==Why develop an OS?== (削除ここまで)
* (追記) [[Required Knowledge]] (追記ここまで)
(削除) There are a number of reasons why people choose to develop an operating system. Although each individual developer their own reasons, there are a number that are common between some (if not most) developers: (削除ここまで)
* [[Beginner Mistakes]]
* (削除) Having complete control over the machine. When developing an application or other userspace program, the developer has to take into consideration the code written by others: 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 longer term project is quite fine. Research projects are usually undertaken to improve on the 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. (削除ここまで)
(削除) * 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. (削除ここまで)
(削除) Unfortunately, operating system projects are undertaken for the wrong reasons. See (削除ここまで)[[Beginner Mistakes]] (削除) for a list. (削除ここまで)


[[Category:OS Development]]
[[Category:OS Development]]

Latest revision as of 19:10, 19 November 2024

Welcome

Welcome to operating system development; the great frontier. 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. But, you're not alone. In fact, this entire website, including the 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 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!

What is an Operating System?

An operating system is a software controlling the operation of a computer system and its resources. Among other things, there's one very important criteria common to all operating systems:

Capable of loading and executing user programs providing standardized (hardware-independent) input / output interface for them.

Major functions of operating systems may include:

  • Managing memory and other system resources.
  • Imposing security and access policies.
  • Scheduling and multiplexing processes and threads.
  • Launching and closing user programs dynamically.
  • Providing a basic user interface and application programmer interface.

Not all operating systems provide all of these functions. Single-tasking systems like MS-DOS would not schedule processes, while embedded systems like eCOS may not have a user interface, or may work with a static set of user programs.

An operating system is not:

  • The computer hardware.
  • A specific application such as a word processor, web browser or game.
  • A suite of utilities (like the GNU tools, which are used in many Unix-derived systems).
  • A development environment (though some OSes, such as UCSD Pascal or Smalltalk-80, incorporate an interpreter and IDE).
  • 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 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.

What is a kernel?

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 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.

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.

What is a shell?

A shell is a special program that is usually integrated in an OS distribution, and which offers humans an interface with the computer. The way it appears to users may vary from system to system (command line, file explorer, etc), but the concept is always the same:

  • 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.

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.).

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

  • 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.
  • Character Insertion: The user can move around in what they entered by using the arrow keys. When typing new characters in the middle of a sentence, characters will get "inserted".
  • Shell History: By using the up and down arrow keys, the user can scroll through previous input.
  • Scrolling: When there are more lines than the console is high, save the output in a buffer and allow the user to scroll up and down in the console.
  • Scripting: Some shells have custom scripting languages. Examples of scripting languages are Bash or DOS batch.
  • etc.

What is a GUI about?

The graphical user interface (GUI) is the most visible part of any operating system that has one. Its role goes beyond a simple drawing library; it must also be able to:

  • Catch user input events (keyboard, mouse, etc.) and dispatch them to the proper object.
  • Update the internal information of what is to be displayed where on the screen, determining which parts of the screen need to be redrawn.
  • Update the visible screen contents, redrawing the necessary parts.
  • Do so in a way that feels natural, intuitive, and responsive to the user.

Desktop Environment, Window Manager, Widget Library

When you are launching into a KDE or Windows session, that is a desktop environment, i.e. a graphical shell providing the functional environment for all lower-level functions.

The part of the system responsible for organizing the windows of the various running programs, their resizing/closing gadgets, window borders, scrollbars etc. is the Window Manager.

Finally you have the subsystem that does the drawing of control elements, rendering documents on screen etc.; this is commonly called the widget library. However, there are alternatives to widget libraries, usually in the form of declarative languages (e.g., Mozilla's XUL, Qt's QML).

GUI-related forum threads

Why develop an OS?

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:

  • 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 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.
  • 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.

Unfortunately, many operating system projects are undertaken for the wrong reasons. See Beginner Mistakes for a list.

See Also

Articles

Retrieved from "https://wiki.osdev.org/index.php?title=Introduction&oldid=29300"