Python learning-day1. Computer Basics
First, the hardware components of the computer system:
Big three of the computer: memory, hard disk, CPU
Second, the role of programming language and the relationship between operating system and hardware:
A: 1, the role of programming language is to communicate with the computer, and can be used in programming languages on the operating system to write programs, so as to achieve the purpose of developing application software
2, the operating system is used to manage the computer hardware resources
Third, the application-"operating system-" hardware:
Mount the application in the operating system on the hardware-mounted operating system
1, the application refers to the programmer development of the running software
2, the purpose of the operating system is to manage the computer hardware
3, Hardware: CPU, hard disk, memory, keyboard, mouse system called computer hardware
The relationship between the three is that the application can not directly manipulate the hardware, the application needs to launch a system through the OS call instructions, then the operating system to operate the hardware hard disk files, the hard disk files read into the operating system, and finally feedback to the application software.
Four, cpu-memory-disk:
CPU: is responsible for the operation and control, is the core component of server performance
(Note: CPU can only do "one thing" at the same time)
Memory: Memory is volatile, is a temporary memory, power loss, memory data will be lost
Disk: Hard disk is based on magnetic work, is a permanent storage of data
(Note: The memory runs faster than the hard disk, and the CPU runs much faster than the memory)
The relationship between the three is: Write a program file is saved in the hard disk, want to run this file is to put the data into memory, and then the CPU to memory read data-decoding-finally run
Five, CPU and register, the kernel state and the user state how to switch:
A register is a storage device that is designed to improve the CPU's processing efficiency, and the CPU is for computing, and the register is to store what the CPU needs to compute, the registers and CPUs run the same speed, and the registers can alleviate the difference between the CPU and the memory.
Register Classification:
1, General Register: is used to store the CPU needed to use the key data and variables
2, program counter: Because the CPU at the same moment can only do "one thing", but the fact that the CPU switching speed can be fast enough to let users feel that the CPU can run "many things" at the same time, and the CPU in the run "many things", the role of the program counter is when the first thing is not finished running, Save it first, then run the second thing, and when the second thing is not finished, you can cut back to the location where the first thing you saved was run, and then run it again .
3, Stack pointer: advanced to go out after the analogy of "spit"
4, the program status Word register: The CPU has its own instruction set, to control the operation of the CPU, when a program needs to be handed to the CPU to run, and because the operating system and application software both need to be converted to CPU instructions to run, the CPU can operate the hardware, and because the operating system can operate the hardware, But the application software can not operate the hardware, so the CPU needs to rely on the program status Word register to release instructions, to distinguish between the operating system and application software who can operate the hardware
kernel state: The kernel state is the operating system's CPU state, which is characterized by the full release of the CPU to the operating system (including all functions using hardware)
User state: The user state refers to the instructions that the application shuts down the operating hardware when the CPU is issued an instruction, making it unable to operate the hardware
How to switch between the kernel state and the user state:
The switch between the kernel state and the user state is switched by the binary status bit in the program State Register, which has the same speed as the CPU.
VI, Memory series, L1 cache, L2 cache, memory (RAM), EEPROM and Flash, CMOS and BIOS batteries
(1) Memory series: tape, hard disk, memory, cache, register all belong to the memory series, its speed is compared to the tape "hdd" Memory "cache" Register
its capacity comparison is tape > hard disk > Memory > Cache > Register
(2) L1 cache and L2 cache: 2 or 4 full processor CPU chips in 1 CPU processors
Inter 1 CPUs have 4 cores, each of which has its own 1-level cache, or L1 cache (register), which respectively share data to the 2-level cache as the L2 cache (cache);
AMD 1 CPUs have 4 cores, each core has its own 1-level cache is the L1 cache (register), and each L1 cache has its own 2-level cache is L2 cache (cache), because there was no shared data before, it is very difficult to maintain four L2 cache consistency
Note: L1 cache is a register is the data that the CPU needs to use immediately; L2 cache is the data that the CPU often needs
(3) memory (RAM): Memory is volatile, is a temporary memory, power loss, memory data will be lost
(4) EEPROM and Flash Memory: EEPROM is erasable ROM can be written (nonvolatile random access storage); Flash memory is also non-volatile, based on the principle of electricity, more for solid-state drives, so that the speed of the SSD is much higher than the mechanical hard disk (based on the principle of magnetic), but the number of flash erase too many, Easy to wear
(5) CMOS and BIOS battery: CMOS memory is generally used to maintain the current time and date of the computer, but it is volatile, power loss, the data will be lost, so need to install the BIOS battery
VII. disk structure, average seek time, average delay time, virtual memory and MMU
(1) disk structure: The disk is roughly composed of mechanical arm, disc, head, motor, 2 disks roughly 4 mechanical arms, one per side
(2) Average seek time: when the operating system writes data to the hard disk, when the disk rotates, the manipulator finds the time spent in the circle where the track data is located, but does not know the specific location of the data specific circle
(3) Average delay time: It is the mechanical arm to find the correct track and also need to find the sector section of the data, this time is called the average delay time
(4) virtual memory and MMU: virtual memory is the space on the hard disk, do memory things, so that the computer can run more than the physical memory of the program; MMU is a mapping between the address of a memory and the address of a hard disk
Eight, tape
Large tape capacity, stronger than hard drive mobility, usually used for database backup
Nine, equipment drive and controller
1, the device driver is the software, is the controller's operating system, different computer operating systems need different device drivers
2, the controller is to control the I/O device
Ten, the bus and South Bridge and North Bridge
Bus: The bus is connected to a component, the transmission of data
Bridge, PCI: Connect high-speed devices (such as cache, CPU, hard disk)
ISA bridge: Connecting a slow device (such as USB, monitor, printer, sound card)
Xi. operating system Start-up process:
1. Plug in (connect power)
2, Computer load BIOS program, detect CPU, memory, hard disk, etc.
3, the BIOS read the CMOS system disk is which, and then start the device
4. Second, read the contents of the first sector from the system disk.
5, then the computer is responsible for the operating system to read all the code into memory to start the operating system
6, the last operating system will ask the BIOS boot which device, will ask the BIOS which kind of program driver device exists, if present, direct call, does not exist, will ask the user to install the drive device, once all the device drivers, the operating system will transfer them into the kernel. Start the login program.
12. Application start-up process:
1, double-click (The double-click operation to the input device, input device to the controller, the controller to the operating system (operating system monitoring at any time)
2, the operating system to find files on the hard disk, to read in memory, and then the program started running
Python learning--day1. Computer Basics