Day 1 Computer basics, day Computer Basics
Computer Basics 1. Why learning computer basics? The role of programming languages: commands that humans use to make machines understand and act. It is similar to English in human society. Relationship: Computer Hardware-Operating System (OS)-software (finished programming language, learning results ). Hardware: There is an operating system on the hardware layer for control, while software on the OS, humans through the software to make the hardware layer Action reaction. Computer hardware: refers to the hardware foundation of the computer's visible part. Operating system: it is a basic computer program. The operating system controls the hardware to reduce the tangle of the user base layer. Software: the objective result of learning the programming language, running software programs, allowing users to control hardware more friendly and direct through the operating system, to achieve the target behavior. The path to Python programming: Computer Hardware basics → Operating System Basics → Python programming II. Programming of computer hardware development history is an important definition of general computer. Iii. Introduction to computer hardware 1. Central Processing Unit (CPU) 2. Memory (Memory) 3. Input/Output (IO) Devices) 4. system Bus 5. other communication devices: CPU, memory, and disk relationship: the CPU is responsible for computing, and the disk is the terminal storage device for data, memory is a high-speed temporary storage device between CPU and disk. 1. The Central Processing Unit (CPU) is a super-large-scale integrated circuit. It is the Core and Control Unit of a computer ). Execution Process: Getting commands → decoding → execution registers: it is an integral part of the CPU. High-speed storage components with limited storage capacity for temporary storageCommand,DataAndAddress. Categories: 1) General registers: Save variables and temporary results 2) program counters: SaveToThe memory address of the next instruction is 3). Stack index: points to the top of the current stack in the memory. STACK: a data structure in which data items are arranged sequentially. Data items can only be inserted and deleted at one end. Key points: heap, queue first, first-in-first-out. Stack, advanced and later. 4) Program Status Register (Program Status Word, PSW): bar code bit. CPU priority. Mode (user or kernel) and various other control bit. Two CPU modes: Kernel Mode and user mode. There is a binary bitwise control mode in PSW. Kernel Status: CPU running status. All commands in the instruction set can be executed, including all functions of hardware. User State: the execution status of the user software. Only one subset of the entire CPU instruction set can be executed. Switch between kernel mode and user mode: software working in user mode cannot operate hardware. Use System Call to switch to the kernel state, enable the operating System, and obtain the service. 2. Memory Cache L1 is always in the CPU. L2 Intel multi-core chips, AMD memory in the cpu: RAM is stored in a volatile manner. After power failure, all data disappears. ROM non-volatile random access to storage. EEPROM (Electrically Erasable PROM) Electrically Erasable Programmable ROM flash memory non-volatile CMOS: volatile, holding current time and date, battery drive. At the same time, you can save the configuration parameters, such as which one is the boot disk and consumes very little power at the same time. 8-bit (BIT) = 1 Bytes 1024 * Bytes = 1KB 1024KB = 1 MB 1024 MB = 1 GB 1024 GB = 1 TB 3. Disk Head: read/write ends of the manipulator track: A new region cylindrical record that can be read by each head: all tracks at each arm position combined sectors: Minimum disk-level read/write unit: bytes default byte operating system level minimum read/write unit: 1 BLOCK = eight sectors of data are stored in the sector of the Sector segment, that is, a small circle in the circle of the track. Reading a piece of data from the disk requires the seek time and delay time. Virtual Memory: in linux, swap 4 and I/O devices include the device controller and the device itself. Controller: Generally, the control over the device is very complex and specific. The task of the controller is to shield the operating system from these complex and specific tasks, provide a simple and clear interface driver for the operating system: There are relatively simple interfaces and standards, so that everyone can write the driver for it. To call a device, you must compile a complex and specific program based on this interface. Therefore, a controller provides the device driver interface to the operating system. The device driver must be installed in the operating system in sequence. 5. Bus North Bridge (PCI bridge): connection to high-speed device south bridge (ISA Bridge): connection to slow devices 6. Start the Basic Input Output System (BIOS) Program of the computer. Operating System Startup Process: 1), computer power-on 2), BIOS operation, detection of hardware cpu, memory, hard disk, etc. 3) when the BIOS reads parameters from the CMOS memory, select start device. 4) read the content of the first sector from the boot device. 5) read the BootLoader boot device module according to the partition information and start the operating system. 6) Ask the OS for the BIOS to obtain the configuration information. For each device, the system checks whether the device driver exists. If not, the system requires the user to follow the device driver. Once all the device drivers are available, the operating system transfers them to the inner core. Then, start the related tables (such as the progress table), run the required processes, and start the logon program or GUI on each terminal. Application startup process: double-click the software and run the CPU operations. The memory calls out commands from the hard disk to start executing the software.