An operating system is a software controlling the operation of a computer system and its resources. 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, and providing basic system services for them.
- 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.
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.
Current (2013) operating systems include:
- Windows
- OS X
- Linux
- FreeBSD
- Plan 9
There have been many other operating systems in the past, and many others currently which are not listed here. At any given time there are several projects to develop new operating systems in the works.
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 he or she 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.
- ...
What is a GUI about?
The Graphical User Interface 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).
Retrieved from OSDev