In-depth understanding of computer systems - Chapter roaming computer system

To start learning the system by tracking hello program life cycle, from the beginning it was the programmer to create, to run on the system, the output of a simple message, and then terminated.


1. The context information is the bit +

Speaking from hello.c source files, source (source) bit is actually composed of 0,1 (also called bits) sequence. 8 is composed of a group of bits, called a byte . Each byte represents some text characters in the program.

Most modern computer systems are using the ASCII standard to represent text characters, actually this way a unique integer value single byte to represent each character.

All the information system - comprises a disk file, a program memory, the user data stored in the memory and transmitting data on the network, are represented by a string of bits. So how do you distinguish between different data objects.
The only way is when we read these data objects context.

2. The program is translated into a different format other programs

Here Insert Picture Description

Pre-processing stage : the preprocessor (CPP) in accordance with the command beginning with #, modify the original C program. Another result to .i file extension.

Compilation phase : the compiler (ccl) text file hello, i translated into a text file hello.s, which contains an assembly language program. To change the main program includes defined functions, as shown below:
Here Insert Picture Description
Compilation Phase : assembler (as) the hello.s translated into machine language instructions, to package them into a known ** relocatable object program (relocatable object program) ** format, and save the result in the target file hello.o in. hello.o file is a binary file, open look, going on a pile of garbage.

Link stage : the linker (ld) is responsible for handling the merger printf.o and hello.o like this program, and ultimately get hello file, which is a target executable file (executable file).

3. System hardware composition

  1. Bus
    throughout the system to a set of tubes, referred to as a bus.
  2. I / O device
    mouse, keyboard, display, disk
  3. Main memory
    temporary storage device, for storing the data processing program and a program.
    Physically the main memory random access memory (DRAM) chips by a dynamic set.
    Logically, the memory is a linear array of bytes, each byte has its own unique address (array index), scratch address.
  4. The processor
    central processing unit (CPU), referred to as a processor, is interpreted (or executed) Engine instructions stored in main memory. core cpu is a word size of a memory device (register), referred to as a program counter (PC). At any time, PC points to a machine language instruction in the main memory (i.e., containing the address of the instruction)

4. Run the file hello

When we load executable file via shell commands, these instructions will hello target file in the code and data from the copy disk to the main memory . It includes a character string data will eventually be outputted "hello, world \ n".

By DMA (direct memory access), data may not reach the main memory directly from the processor through the disk.

5. Cache

The system will be designed to cache as a temporary area, store the information processor may require the near future.

Locality principle: That program has access in the local area and trend data code by allowing data may be stored in cache frequently accessed, most of the memory operations can be done in fast cache.

6. The storage hierarchy

Here Insert Picture Description

In some network systems with distributed file system, a local disk is cached in other systems on the disk data storage.

7. Virtual Memory

The basic idea: is to a process virtual memory content is stored on disk, then use main memory as a disk cache,

8. File

File is a sequence of bytes.

Guess you like

Origin blog.csdn.net/shaoye_csdn1/article/details/90692517