1.4.1 Hardware Organization of a System
Buses
Buses are typically designed to transfer fixed-sized chunks of bytes known as words.The number of bytes in a word (the word size) is a fundamental system parameter that varies across systems. Most machines today have word sizes of either 4 bytes (32 bits) or 8 bytes (64 bits). We will assume a word size of 4 bytes, and we will assume that buses transfer only one word at a time. (bus: 想象是32根数据引脚线)
I/O Devices
Processor
At its core is a word-sized storage device (or register) called the program counter(PC).
1.7 The Operating System Manages the Hardware
processes
The operating system keeps track of all the state information that the process needs in order to run. This state, which is known as the context, includes information such as the current values of the PC, the register file, and the contents of main memory.
Threads
In modern systems a process can actually consist of multiple execution units, called threads, each running in the context of the process and sharing the same code and global data.
Virtual Memory
Virtual memory is an abstraction that provides each process with the illusion that it has exclusive use of the main memory. Each process has the same uniform view of memory, which is known as its virtual address space.
For virtual memory to work, a sophisticated interaction is required between the hardware and the operating system software, including a hardware translation of every address generated by the processor. (MMU)
Files
A file is a sequence of bytes, nothing more and nothing less.
This simple and elegant notion of a file is nonetheless very powerful because it provides applications with a uniform view of all of the varied I/O devices that might be contained in the system. (应用程序调用open, read, write接口操作设备。操作系统提供对应的drv_read, drv_write)
1.9.2 The Importance of Abstractions in Computer Systems
On the processor side, the instruction set architecture provides an abstraction of the actual processor hardware. With this abstraction, a machine-code program behaves as if it were executed on a processor that performs just one instruction at a time.
On the operating system side, we have introduced three abstractions: files as an abstraction of I/O, virtual memory as an abstraction of program memory, and processes as an abstraction of a running program.
The virtual machine, providing an abstraction of the entire computer.
The operating system kernel serves as an intermediary between the application and the hardware. It provides three fundamental abstractions: (1) Files are abstractions for I/O devices. (2) Virtual memory is an abstraction for both main
memory and disks. (3) Processes are abstractions for the processor, main memory, and I/O devices.