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.
    提供基本的交互以及api接口
    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.

——osdev.wiki

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.

推荐阅读更多精彩内容