What is an Operating System?什么是操作系统


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.


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.