Read "In-depth understanding of computer systems" Chapter1
The foundation is weak to make up.
1. Representation of information in a computer
We know that the bottom of the computer is a bunch of integrated circuit components, each IC element has a lot of pins, each pin above the DC voltage only 0v/5v, so each can only represent two states, it is doomed to computer information data can only be processed in binary form, such as 1,0,10,00 ... But when all the information is represented in that form, the same string of binary sequence codes may represent different data in different environments or directives to be executed, so the context in which these data objects are read is the only way to differentiate between different data objects. Thus the representation of information in the computer is位(二进制)+上下文
2. Hardware components of the system
The components of the von Neumann structure computer include: 运算器、控制器、存储器、输入设备和输出设备
where the operator and controller correspond to the CPU in the normal computer (central processing Unit), the memory corresponds to the RAM and the hard disk, and the input/output device corresponds to the usual mouse, keyboard, monitor, etc.
Typical hardware components in the system include:
- Bus
- I/O devices
- Memory
- Processor
2.1 Bus
The bus runs through a set of electronic pipelines in the system that carry information bytes and are responsible for passing between the parts. Typically, a fixed-length chunk of bytes is passed-the word
number of bytes in each word is a parameter to the system, and the 32-bit operating system we use, the 64-bit operating system, refers to the number of bytes in each word (32 bits is 4 bytes long, 64 bits is 8 bytes in length).
2.2 I/O devices
is the link between the system and the outside world, each I/O device is connected to the IO bus via a controller/adapter, and the controller/adapter is used for transmitting information between the IO bus and IO devices
2.3 Main Memory
A temporary storage device in the running of a computer that is used to store the data that the program and program needs to process when executing the program.
Is physically composed of a set of DRAM chips logically consisting of a set of linear byte arrays (house model) with one address per byte (starting from 0)
2.4 Processors
A short name for the CPU, which is the engine used to interpret or execute instructions stored in main memory. Its interior has four components: an operator, a controller, a register, and a clock. The registers are divided into many kinds, in which the program counter (PC) is used to store the address of a machine language instruction in main memory.
The instructions that the CPU will perform may include:
- loading : main Memory---> registers
- storage : Register---> main memory
- Action : Operation processing based on the value of the register and the directed content instruction
- Jump : Override value in Program counter (PC)
3. Caching
The access between the storage devices in the computer is very large, the register accesses very fast but its storage capacity is small, main memory is slower than the register access, but it is more than the amount of data that the register can store. The same is true of the difference between the main memory and the hard disk, the local hard disk and the network. In order to shield the effect of this difference on computer processing, a 中间层:缓存
method is introduced, which uses the local principle to store the data of some slow-access devices to achieve good access performance. The storage device designed for the difference between the register and main memory in a computer processor is called a cache memory. Usually divided into L1 and L2 level two cache (based on the static random access memory cardinality SRAM, there are currently L3 cache). Storage device hierarchy diagram in a computer system:
4. Operating system
The operating system can be seen as an abstraction layer between compute hardware and the application, which is used primarily for
- Prevent hardware resources from being manipulated illegally
- Shielded operation differences between different underlying hardware, providing easy and unified hardware operation
It makes some abstractions in the computer hardware:
- A. File : Abstraction of I/O device (file is byte sequence)
- B. Virtual memory : I/O devices + abstraction of main memory
- c. Process : I/O device + abstraction of main memory + processor
Where the process is an abstraction of the program being executed in the system. Multiple processes can run concurrently on a system, and each process looks like an exclusive use of hardware. Virtual memory makes the process look like an exclusive use of main memory, each process sees the same amount of RAM, and each process sees the virtual address space.
4.1 Virtual address space
Space map:
Component (from bottom to top, memory address increases gradually)
- read-only program + data "The program is machine language."
- run-time heap "The runtime expands and shrinks dynamically, requiring the program to request an available memory address to store objects and reclaim objects that are no longer in use (Java has the JVM to do this for us)"
- Shared Library Memory
- User Stack The compiler implements the function call. It also expands and shrinks dynamically during the run of the program, but the operation code required to extend and shrink is automatically generated when the compiler compiles it into a machine language .
- Kernel virtual memory
4.2 Parallel and concurrent
In a nutshell, concurrency is an instruction in which a CPU alternately runs multiple processes, and parallelism refers to the instructions of multiple CPUs executing multiple processes at the same time.
The context switch of the process is involved in the concurrency process. The context is the state information that the processor needs to keep track of the process, such as the process processing is the value in the register file, the value in main memory, and so on. During context switching, the context information of the original process needs to be saved, the context information of the new process is restored, and control is left to the new process, and the new process resumes from where it was last paused. The switch is controlled by the kernel, so switching between user space and kernel space is involved in switching.
I. Thread-level concurrency
线程
This finer-grained execution unit is introduced into the modern operating system in the process. A process contains multiple threads, all of which run in the context of the process and share their code with the data. Multi-threaded concurrency is becoming more and more important, given the ease with which sharing data between multiple threads is more convenient than sharing data between processes.
II. Instruction-level parallelism
The processor executes multiple instructions at the same time.
Iii. single instruction, multi-data parallelism
SIMD, the same instruction can produce multiple operations that can be executed in parallel. Many are designed to improve the execution speed of processing image, sound, and video data applications.
5. Summary
- Abstract
- Many problems in the computer are solved by introducing the middle layer.
- Principle of locality: time and Space
"Reference" [in-depth understanding of computer Systems] Third Edition
Sv
Source: https://www.cnblogs.com/sv00
Copyright NOTICE: This article is copyright to the author and the blog Park is shared, welcome reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to give the original link.
Read "In-depth understanding of computer systems" Chapter1