Computer system roaming

Source: Internet
Author: User

1.1 Information is bit + context

All the information in the system is composed of a string of bits, the so-called bit is a bit, every eight bits is a byte that is byte, in theory all the files can be divided into two, one is composed of ASCII characters, which we also called text files (in fact, other character encoding, not considered here), The rest is called a binary file. So how exactly a file will be translated actually depends entirely on the context.

1.2 programs are translated into different formats by other programs

The text cited the example of C language:

The source file (SRC.C) undergoes the preprocessor (CPP) to generate the modified source file (SRC.I) and then the compiler (CCL) generates the assembly code (SRC.S) and then the assembler (as) generates the Relocatable target program (SRC.O, which is the binary file from here), and finally the linker (LD) generates an executable File.

Here I explain the relocation, so-called relocation is the address, because only after the previous compilation process to get the final data segment (. data) and the final size of the code snippet (. Text), relocation is to allocate the actual system space for directives and global variables.

1.3 Understanding how the compilation system works is beneficial

If you can understand how the compilation system works, you can have a more comprehensive understanding of performance optimizations, troubleshooting link errors, and avoiding security breaches.

1.4 Processor reads and interprets devices stored in memory
    1. First, a basic understanding of the hardware composition of the system:
        • The bus is used to carry information bytes throughout the system, and the bytes transferred are called words, the number of bytes in the word is a basic system parameter is also called word length, generally 32-bit or 64-bit.
        • IO device is the connection between the system and the outside world, more common such as input device keyboard mouse, input device monitor disk.
        • Main memory (DRAM) is what we usually say, from a physical point of view, we can see the linear array.
        • The processor is an engine that interprets or executes instructions stored in main memory.
    2. Then a program runs mainly the following process: When we call the SRC executable using./SRC (which is the default in the Linux shell), the shell executes a series of instructions to load the src file, copying the data from the src file into memory. The processor then starts executing the machine instructions contained in the data, which copy the HelloWorld to the register (this is referred to as HELLOWORLD.C) and then copy it from the register to the display device (display) to display on the desktop.
1.5 Cache is critical

The simple example in 1.4 reveals an important problem, that the system spends a lot of time moving data from one place to another, but the actual execution of the machine instructions is only a small part, so if the data can be replicated as quickly as possible, it will be able to speed up the execution of the computer. In response, people invented cache memory, which is much smaller than the main memory, but the data access speed is almost as fast as register, so we can put the frequently accessed data in the cache, in such a way to speed up access.

1.6 Hierarchical structure of storage device formation

With the development of computers, the idea of inserting smaller, faster storage devices between processors and large memory devices (main memories) has become a universal concept. This gradually makes the computer domain storage devices organized into memory hierarchies, which follow the following characteristics: the larger the space, the slower the speed.

1.7 Operating System Management hardware

In fact, it says that when the shell loads and executes the src file, we all overlook a key concept that is the operating system, which means that the shell and the executing SRC program do not have direct access to disk memory, and so on, they are all through the operating system to complete these steps. The operating system has two basic functions:

    1. Provides a simple and consistent mechanism for the application to control complex and disparate low-level devices.
    2. Since it provides an interface for operating hardware, it can naturally be used to prevent hardware from being abused by runaway programs.

The operating system provides the following basic abstract concepts: files, virtual memory, processes (the scope of the concept is more and more extensive after travel).

    1. Running the program on the operating system creates the illusion that only the program is currently using the processor, memory, and IO devices, and these artifacts are realized through the concept of a process. Process is actually an abstraction of a running program, a system can run multiple processes at the same time, each of which seems to be in exclusive use of hardware, and the reality is that they are often interleaved, the operating system interleaved between different processes is called the context switch mechanism. In the same process, there is a similar concept called threading, a process in a modern program is often more than one thread to complete, sharing code between threads and global data, because they are more easily shared data, often threads more efficient.
    2. Virtual memory is another abstraction, which makes each process look like an exclusive use of memory, each process sees a consistent memory, called the virtual address space, the structure from the first address to the high address is:
      • program code and data: This is the same for all programs, where the code begins with a fixed address, followed by the data location corresponding to the global variable in the C language.
      • Heap: The runtime heap, which dynamically expands and shrinks when you call malloc or free.
      • Shared library: A place to store code and data like the standard library in C language.
      • Stack: The compiler implements function calls with the same ability to dynamically scale as a heap.
      • Kernel Virtual Storage: The kernel is part of the operating system, which is left to the kernel, does not allow the program to read or write to this part of the space, or invoke kernel code-defined functions.
    3. Every IO device, including disks, monitors, keyboards, and even networks, can be called files, and all of the input and output of the system is done through a system function called Unix I/O and read-write files.

1.8 Communication between systems

Computers do not exist in isolation, and each computer system is usually connected to each other through the network, and the network can be an IO device.

1.9 Important topics
    1. Parallelism and concurrency
      • Thread-level concurrency: It is generally done with thread switching, and later multi-processor systems and multicore systems improve system performance.
      • Instruction set Concurrency: The use of pipelining intelligently handles multiple instructions at the same time.
      • Single instruction multi-data parallelism: SIMD parallelism, modern processors allow an instruction to produce multiple executable operations to speed up execution.
    2. Abstract is a very important concept in the computer, it hides internal hardware and software internal implementation details, with a simple unified perspective to simplify the study.

Computer system roaming

Related Article

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.