Computer systems a programmer's Perspective (deep understanding of computer systems) Chapter 1 Reading Notes

Source: Internet
Author: User

Chapter 1Computer System roaming

1.1Information is bit+Context

SourceProgramIt is actually0And1A bit (also called a bit) sequence, which is organized8A group of bytes. Each byte represents a text character in the program.

All information in the system is represented by a string of bits. The only way to differentiate different data objects is the context when we read these data objects.

 

1.2Programs are translated into different formats by other programs.

UNIX> gcc-O hello. cTranslate into an executable target fileHelloFour stages:

Preprocessing phase: pre-processor based on#Start with the command, modify the original program to get another program, usuallyIIs the extension.

Compilation phase: the compiler will. ITranslated. SFile, including an assembly language program.

Assembly phase: the assembler willHello. sTranslate into machine language commands. Change. OThe machine language instruction rather than the character when encoding its bytes.

Link stage. SimilarPrintfFunction (Printf. o), And the result isHelloFile, which is an executable target file. After the executable file is attached with the path storage, the system is responsible for executing the file.

 

1.3It is of great benefit to understand how the compilation system works.

Optimizes program performance, understands Link errors, and avoids security vulnerabilities.

 

1.4The processor reads and interprets commands stored in memory.

CPU:Central Processing Unit;Alu;Arithmetic/Logical unit;PC;Program counters;USB:Universal Serial Bus.

Bus: bus carries information bytes and is responsible for transmission between components. Generally, the bus is designed to transmit fixed-length bytes, that is, words. The number of bytes is a basic system parameter, which varies with systems. Assume that the length is4And assume that the bus transmits only one word in turn.

 

IoDevice: keyboard, mouse, display, disk

Primary storage: composed of a groupDRAMChip composition. Memory is composed of a linear array, and each byte has its own unique address (array index). These addresses start from scratch.

 

Processor:CPUThese operations may be performed as required by the command.

Load: copy a byte or word from the primary storage to the Register to overwrite the original content of the register.

Storage: copy a byte or word from the Register to a location in the primary storage to overwrite the original content at this location.

Update: depends on the content of two registersAlu, ALUAdd the two words and store the results in a register.

IoRead: FromIoCopy a byte or word from the device to the Register.

IoWrite: copy a byte or word from a storage toIoDevice.

Transfer: extract a word from the command itself and copy the word to the program counter to overwritePCThe original value.

 

When you enter./HelloAfter,ShellThe program reads characters to registers one by one and stores them in memory.

 

After entering the information,ShellExecute a series of commands that willHelloIn the target fileCodeAnd data is copied from the disk to the primary storage to loadHelloFile, including the final output string"Hello, world \ n"

 

Once the program adds the channel memory, the processor starts to execute the machine language commands in the main program. These commands willHello world \ nThe Byte in the memory is copied from the memory to the register file, from the register file to the display device, the final line to the screen

 

1.5High-speed cache

It is used to store information that may be needed by the processor in the near future.

 

1.6Storage devices with Hierarchical Structure

1.7Operating system management hardware

The operating system can be regarded as a layer of software inserted between applications and hardware, relying on the services provided by the operating system. All applications must use the operating system to perform hardware operations.

The operating system has two basic functions to prevent application misuse of out-of-control hardware. It provides simple and consistent methods for applications to control complex and generally different low-level hardware. (Process, virtual memory, files)

The file isIoThe abstract representation of the device. The virtual memory is for the primary storage and diskIoThe abstract representation of a device. A process is a pair of processors, primary storage, andIo.

A process is an abstraction of the operating system for running programs. In fact, commands of one process and those of another process are staggered. Context switching is a cross-execution mechanism.

Context switch: Save the context of the current process, restore the context of the new process, and transfer control to the new process. The new process starts from where it was last stopped.

Thread: A process is composed of multiple threads. Each thread runs in the context of the process. Share the same code and global data. Multithreading is easier to share data with multiple processes.

Virtual Memory: it is an abstract concept. Each process sees the same memory, which is called a virtual address space.

1.8Use the network system to communicate with other systems

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.