Recently began to chew Csapp, bought English version, see relatively slow. Only by understanding the system can we learn more about its essence in more ways.
Chapter1:
* A compilation of HELLO.C code is divided into four stages: 1.pre-processor: Compile preprocessing, which is to add the library code after # include to the program, generate HELLO.I files. 2.Complier: Use the compiler to translate HELLO.I C code into assembly language, and generate: Hello.s file. (Assembly language is an intermediate process for high-level languages to machine code) 3.Assembler: Assembler translates assembly language into machine binary code and generates HELLO.O files. 4.Linker: Connect the PRINTF.O of your hello.o and library functions to generate the executable object program.
* Both the adapter and controller are a converter connecting the bus and the hardware device, the difference being that the adapter is usually plugged into a slot on the motherboard (video card, sound card), and the controller is motherboard integrated.
* Principle of CPU execution: The CPU has a set of its own instructions (instrctions set), which specifies what to do with reading that instruction set. And the program is a sequence of a specific set of instructions, stored in memory (Main memories), the CPU PROGRM counter (PC), always refers to the memory of an instruction, the CPU will read the current instruction and perform the corresponding operation, and adjust to the next command, And these instructions are not contiguous regions in memory, it is a kind of chain list that is scattered in memory.
* The HELLO.C program performs a process overview on the computer: first the UNIX computer is in shell mode, and the CPU's PC points to one of the instructions in memory. Then the person enters "hello" from the keyboard and presses ENTER, this "Hello" is generated by the keyboard controller and the I/O bus reaches the I/O bridge, and then the system bus reaches the register file in the CPU. Register is only temporarily stored, and after analysis the CPU will transfer the name to memory by the system bus, I/O bridge, and memory bus. Then the CPU will go to disk in the memory of the program name to find the actual machine code, and it through the I/O bus, I/O bridge, memory bus does not go through the CPU directly to the memory (DMA technology). A program that moves into memory is actually a sequence of instructions, the CPU reads the instructions and executes them sequentially until it reads the instruction of the output "Hello World" string, which is stored as data in memory, and the CPU reads the data into the register. Then through the bus to the graphics adapter, graphics adapter decode the data and display it.
* Cache: CPU processing speed, greater than the speed of reading and writing data from memory, which produced processor-memory gap, in order to solve this inefficient gap, there is the cache memories. The cache memories typically has two to three cache tiers, with the first capacity being the smallest (but larger than the register), the fastest (but smaller than the register), and then the subsequent two cache performance varies according to the hierarchy. When running the program, put the usual instructions in the cache instead of memory, which will improve the speed of data read and write, solve Processor-memory gap.
* Storage Hierarchy System: A computer system consisting of a storage hierarchy with the fastest top, smallest capacity, and the highest cost per byte register, down to several levels of cache, memory, external memory, other system storage ... The entire system exists to match the performance of the CPU with the performance of the storage system at minimal cost.
* OS is an over-layer between the application and the underlying hardware, and he presents the complex and cumbersome underlying abstraction to the application.
* Process Concept: The process is an abstraction of the currently executing program of the OS. When a process is transitioning to another process, it maintains all current state information, and then reads the state information of the other process and runs another program.
* Multithreading (multi-threading) is a highly efficient concurrency-running technology.
* Virtual Memory: The program is run often is not the actual memory address, is the operating system allocated virtual memory area. This virtual memory area includes both memory (main memories) and disk. Then the OS gives it a virtual continuous address, from high to low, at the address of the strict hierarchical. The lowest level is the code and data of the program itself, then the heap (heap), then the program and data of the library file, then the user stack (stack), the top of the operating system's core code area.
* File: The essence of Unix philosophy is that everything is a document. In fact, the file is a series of bits (byte) composed. All I/O devices can be considered as files, and the operation of a device actually reads or writes files to its buffer. This thought greatly simplifies, the programmer's use difficulty! We don't need to understand how the deep-seated hardware is connected to the software, just to manipulate it like a file.
* Concurrency (concurrency) and (parallelism) concept differences: Concurrency means that the computer processes multiple processes at the same time. The process refers to the use of concurrent means to make the computer run faster.
* Thread-level parallelism: A CPU consists of multiple cores, while one core can execute two threads at a time, the level one or two cache is independent, but they share a third-level cache for thread-level parallel processing, greatly improving efficiency. And the use of multi-threaded CPU to use multithreading to greatly improve the execution speed of the program, it is necessary to adopt multi-threading method.
* Instruction-level parallelism: a clock cycle because the CPU executes multiple instructions at the same time, averaging each clock cycle is equivalent to executing a few instructions, and without concurrency, each clock cycle can only perform one step of one instruction.
* SIMD parallelism: Refers to single instructoin,multiple Dates. is an instruction that performs multiple operations.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
"In-depth understanding of computer Systems" chapter I reading notes