Computer Basics-day1, day1

Source: Internet
Author: User

Computer Basics-day1, day1

Programming Language Introduction

Language is the medium for communication between people. Simply put, programming language is also the medium for communication between our programmers and computers. Common programming languages include php, which is well-known for web development, java for Android applications, and c, c #, and c ++, which are widely used, as well as the popular advanced languages such as python, r, and go, as well as the most grounded low-level language assembly language, regardless of which language, what our computer can recognize is only machine language (a binary machine code consisting of 0 and 1 ).

Applications, operating systems, and hardware

Because computer hardware can only recognize machine languages, application software such as script files and execution programs written by all our programming languages according to the corresponding syntax cannot directly interact with hardware, the operating system platform must run on top of the hardware and drive the hardware through the operating system. Therefore, a complete computer system must be composed of three parts: applications, operating systems, and computer hardware.

 

          

 

Computer Hardware System

A complete computer is composed of a processor, memory, hard disk, motherboard, input and output devices, and is a product of artificial intelligence.

Processors can be viewed as human brains, responsible for thinking

Memory can be viewed as human memory, responsible for storing information for a short period of time

Hard disks can be seen as the media used by humans to permanently record information, such as ancient slate, animal bone, Turtle, and modern paper.

Input and Output devices can be viewed as human facial features and are responsible for receiving and transmitting information.

The motherboard can be seen as a human body and used to connect the head and limbs. The bus on the motherboard can understand the nerves of the adult body and transmit signals from various parts of the human body.

 

Central processor of computer hardware

The central processor (CPU) is a computer computing and judgment component. The CPU contains a micro-instruction set. The functions supported by the CPU are determined by the internal micro-instruction set. The data processed by the CPU is derived from the memory, the memory data comes from the hard disk. When a program in the hard disk is executed, the program is first written into the memory, and then the CPU takes a certain instruction from the memory for calculation, however, the CPU cannot directly process the instruction data provided by the memory. The CPU will convert the data called from the memory to the instruction that can be identified by itself, and finally execute the feedback.

The CPU running speed is much higher than the memory. To solve the difference between the CPU and memory speed, there are some registers in the CPU used to save variables and temporary data.

Register: Solves the speed difference between the cpu and memory. The cpu obtains data from the Register.

General registers: used to save key variables and temporary data or results

Program counter: a cpu can only process one command at a time, but the computer usually executes multiple tasks. When switching tasks, the paused Task Command Processing breakpoint results will be stored as a program counter.

Stack pointer: Index of Data Location in memory

Program Status Register: The status is represented by 0 and 1

User State: the user State is not authorized. During code execution, only the instruction set for computing in the CPU can be obtained.

Kernel state: privileged state. All instruction sets in the CPU can be obtained during code execution, including the instruction sets that control hardware, such as the instruction sets written to disks.

When the program code is executed, it is in the user State. When the program code needs to be called to the operating system to access hardware or call the operating system to access peripherals, it will switch from the user State to the kernel state, the program will frequently switch between the user and kernel States during execution.

Computer Hardware Memory

In computer systems, in addition to memory and hard disk storage, there are also a variety of memories. For example, to solve the problem of speed difference between memory and CPU, the L1/L2 cache is added at the CPU level, used to store BIOS settings such as CMOS

Memory types include:

L1 cache: registers, which are made of the same material as the CPU. The cache speed is the same as that of the CPU. The memory size is smaller than 1 kb.

L2 cache: the high-speed cache of the CPU, which exists in the cache of the CPU L1 and interacts with the main memory. When a program needs to read data, it first checks whether the cache exists, if the request exists, you do not need to initiate a request to the primary memory. This process is called cache hit. Compared with L1 cache, there is no time delay. Generally, it takes 1-2 ns to access L2 cache. Currently, some CPUs are added with L3 cache on the outer layer of L2 to interact with memory.

RAM: volatile random access to storage, data loss after power failure, is the computer's main memory

ROM: non-volatile read-only storage. It can only be read and cannot be modified after programming is completed. It is mainly used to store BIOS programs.

*

Flash Memory: it is mainly used for SSD, Which is slower than RAM and faster than HDD.

CMOS: volatile storage, but it can be used as a battery drive to store lost data. A battery can be used for several years and is mainly used to store system time and BIOS configuration.

Mechanical hard drive: Mainly used for computer storage and non-volatile storage

        

Disk: Data Storage Carrier

Head: read/write data on disks

Spindle drive: Drive disk Rotation

Drive Shaft: control head swing addressing

        

Track: the track of several concentric circles defined manually on the disk, starting from 0 in the outward direction

Cylinder: a cylinder consisting of the same track on all disks. It is numbered from 0 in the external disk.

Sector: The track is divided into several arc segments of the same size, starting from 1. Each sector can store 512 or 4 K bytes. The first sector stores the MBR information of the hard disk.

MBR consists of three parts: the Master Boot Program (446 bytes) is used to forward system control to an operating system specified by the user during hard disk startup and registered in the partition table.

Partition information (64 bytes) consists of four partition tables

Bytes (2 bytes)

Disk access time

Average seek time: the time required for the hard disk head to move from the initial position to the disk. The smaller the time, the better.

Average latency: refers to the time required to access the slice where data in the track is located. It is generally the time required to rotate the disk for one week.

Virtual Memory and MMU

When the program is running, it needs to occupy the memory. When the program exceeds the memory size, you can put the program segments that are not used temporarily into the virtual memory to allow the computer to execute programs larger than the memory, the memory management unit (MMU) is responsible for managing the ing between virtual memory and physical disks)

 

Tape

Computer tapes are mainly used for external memory of computers and are generally used for data backup.

 

Device Drivers and controllers

Device Driver: an interface between the operating system and hardware. The driver is responsible for transferring requests from the operating system to commands that can be understood by the controller of a specific physical device.

Controller: allows the operating system to perform simple operations on physical devices. In addition to complex operations, it provides a simple management interface for the operating system.

 

Bus and South Bridge and North Bridge

Bus: an internal structure of a computer that transmits information between the cpu, memory, and input/output devices. Each part of the computer is connected through the bus, the external device is connected to the bus through the corresponding interface circuit

Nanqiao (ISA Bridge): mainly responsible for the control of some peripheral interfaces such as I/O interfaces.

North Bridge (PCI bridge): mainly responsible for the control of high-speed devices such as CPU, memory, and primary memory

 

Operating System Startup Process

1. computer power-on

2. the BIOS starts to run and performs hardware detection, including cpu, memory, and hard disk.

3. the BIOS selects the boot device by reading the parameters in the CMOS memory.

4. Read the Master Boot Record of the first sector from the Startup Device

5. Read the boot loader module and start the operating system according to the partition information of the Master Boot Record.

6. The operating system then asks the BIOS for configuration information. For each device, the system checks whether the driver of the device exists. If not, the system requires the user to install the device driver. Once all the device drivers are available, the operating system calls them into the kernel. Then, start the relevant table (such as the progress table), create the required process, and start the login program or GUI on each terminal.

 

Application Startup Process

1. Double-click an application to send a command to the operating system.

2. The operating system receives commands, executes user operations, and reads program data.

3. The program data is read and transferred to the memory.

4. The CPU starts to process the data and transfers the program data from the memory to the cache.

5. The CPU reads program data from the cache and starts processing.

6. After the program completes data processing, return the processing result to the operating system.

7. After receiving the result, the operating system returns the result to the user through the output device.

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.