首先,先说说什么是操作系统。
What is operating system?
An operating system(OS) is system software that manages computer hardware and software resources and provides common services for computer programs. All computer programs, excluding firmware, require an operating system to function.[1]
Operating system provides interfaces between applications that running on system with hardware they are using.
OS must ensure 'fair': every application get fair share of resources.
OS must ensure one application won't corrupt the work done by another application.
所以总的来说,操作系统就是software that manages the resources of a machine. 这里的management of resource主要指四个方面:process management; memory management; file system management; device management.
Memory Management
内存管理指的是对于Primary Memory(Main Memory)的管理。Primary Memory指的就是我们通常说的RAM(random access memory)主存储器。Main memory is a large array of words or bytes where each word or byte has its own address. 因为可以直接与CPU交互,所以RAM的存储速度很快。对于正在执行的程序,即进程,它一定是在主存里的。
通常RAM对所有进程来说都不太够用,因为RAM很贵。limited amount RAM but large amount disk。
Another crucial job performed by the operating system is memory management. There is usually insufficient(不足) RAM for all of the processes running on a machine. Since RAM is relatively expensive, portions of disk (often called swap regions) are used to extend the amount of memory that is available to an application.
The total amount of memory that appears to be available for a process to use is called virtual memory. The memory manager is responsible for moving pages of processes into and out of memory as needed by the CPU. This will normally happen without the knowledge of the applications.
The memory manager gives each process its own view of memory, represented by a logical address space, arranges for this to be translated into physical memory resources and protects each process from accidentally overwriting other process' address spaces.
An Operating System does the following activities for memory management −
Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part are not in use.
In multiprogramming, the OS decides which process will get memory when and how much.
Allocates the memory when a process requests it to do so.
De-allocates the memory when a process no longer needs it or has been terminated.
*If there are many applications running at the same time, each will require memory to store variables, etc. The physical memory in the system must be partitioned and shared amongst the tasks.
Process Management
In multiprogramming environment, the OS decides which process gets the processor when and for how much time. This function is called process scheduling.
An Operating System does the following activities for processor management −
Keeps tracks of processor and status of process. The program responsible for this task is known as traffic controller.
Allocates the processor (CPU) to a process.
De-allocates processor when a process is no longer required.
Device Management
An Operating System manages device communication via their respective drivers.
The physical devices attached to the system, for example printers, scanners and modems as well as internal devices such as disks. Often programs need direct access to these devices.
It does the following activities for device management −
Keeps tracks of all devices. Program responsible for this task is known as the I/O controller.
Decides which process gets the device when and for how much time.
Allocates the device in the efficient way.
De-allocates devices.
* 在device management中,还有一个特殊情况是connectivity to other system, 即网络。由于network这些年越来越重要,所以我们把connectivity拿出来,与上面的file system management, memory management, process management, device management 放一起,作为第五个部分。
Network capabilities, allowing systems to communicate with each other. This could be viewed as a special case of device accessing as described above, but networking and distribution is such an important part of today's systems architectures that it is correct to treat it separately.
File Management
A file system is normally organized into directories for easy navigation and usage. These directories may contain files and other directions.
The file storage of the system, giving long term storage capabilities to applications.
An Operating System does the following activities for file management −
Keeps track of information, location, uses, status etc. The collective facilities are often known as file system.
Decides who gets the resources.
Allocates the resources.
De-allocates the resources.
Other Important Activities
管理计算机硬件和软件资源的各种程序。其管理功能分为处理机管理、存储管理、设备管理和文件管理等四大部分。是提高计算机利用率,方便用户而设计的软件。[2]
An operating system is a program that acts as an interface between the user and the computer hardware and controls the execution of all kinds of programs.
什么是CPU(中央处理器 Central Processing Unit)
中央处理器(CPU,Central Processing Unit)是一块超大规模的集成电路,是一台计算机的运算核心(Core)和控制核心( Control Unit)。它的功能主要是解释计算机指令以及处理计算机软件中的数据。
中央处理器主要包括运算器(算术逻辑运算单元,ALU,Arithmetic Logic Unit)和高速缓冲存储器(Cache)及实现它们之间联系的数据(Data)、控制及状态的总线(Bus)。它与内部存储器(Memory)和输入/输出(I/O)设备合称为电子计算机三大核心部件。[5]
The CPU provides the basic execution resource for each application.
[1].https://en.wikipedia.org/wiki/Operating_system
[2].http://hanyu.baidu.com/zici/s?wd=%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F&query=%E4%BB%80%E4%B9%88%E6%98%AF%20%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F&srcid=28204&from=kg0&from=kg0
[3].https://baike.baidu.com/item/%E8%BF%9B%E7%A8%8B/382503?fr=aladdin
[4].https://www.tutorialspoint.com/operating_system/os_process_scheduling.htm
[5].https://baike.baidu.com/item/%E4%B8%AD%E5%A4%AE%E5%A4%84%E7%90%86%E5%99%A8/284033?fr=aladdin&fromid=368184&fromtitle=%EF%BC%A3%EF%BC%B0%EF%BC%B5