von Neumann system:I/O: input device and output device CPU: Calculator: Compute Data Controller: Control program running CPU also registers and multilevel cache memory: Disk (external memory), memory (FAST): Power loss all data from disk to memory to CPU number From memory first to register and then CPU use
Computer language:Compiler language: The source code is natively compiled and loaded into the target machine's CPU instruction interpretation language: The source code by the Interpreter (Cpython, Ipython, PyPI, etc.) interpreted as bytecode (bytecode), run on the virtual machine, Virtual machines convert bytecode to physical CPU-aware commands to run (Python,java input interpreted language) Dynamic language: Variable types do not need to be declared beforehand and can be assigned to other types (Python) static languages at any time: variable types need to be declared in advance and cannot be changed (Java, C + +, C #等) strongly typed languages: non-operational between different types, must be converted to the same type (no implicit conversions, Python,java, etc.) weakly typed languages: can be manipulated between different types, auto-implicit conversion (JavaScript)
Python is an interpreted dynamic strongly typed languagePython is garbage collected GC mechanism, reference count increase and decrease, reference count reduced to 0 o'clock will be captured by GC, garbage collection at the appropriate time
source code, anti-code and complement:The data in the computer is in binary form, computer computing data (addition) with the complement to calculate the positive source code, anti-code and complement the same negative number: The source code into the complement: the symbol is unchanged the rest of the counter plus 1 complement to the source code example: 1-2 (equivalent to -2+1, the computer does not subtract) 1, first Take-2 and 1 of the complement, 2 complement is: 1110;1 's complement: 0001 2, two complement is: 1111 3, because 1111 is the complement, so need to convert it to the source code, and the complement of the complement for the source code 4, the 1111 symbol is the same as the rest of the bit After adding 1 to: 1001 5, so the result of the final operation is 1001 (source), converted to decimal is 1
bitwise operators (binary operations, negative numbers need to be converted to complement before bitwise operations):&: bitwise AND; all 1 is 1 (in positive integers for example: 1010&1100 is 1000) |: bitwise OR; There is a 1 that is 1 (take a positive integer as an example: 1010|1100 is 1110) ~: Bitwise inverse: You need to convert an integer to a complement after the reverse; Example: ~ 1, 0000 1100 (12 of the complement) 2, 1111 0011 (after the complement is reversed, the next step is to convert the complement to the source code) 3, 1000 1101 (the sign bit unchanged, its After the addition of 1 is the source) 4, the conversion to decimal is -13^: XOR: The same as 0, the difference is 1<<: Bitwise left SHIFT >>: Bitwise right SHIFT the use of bitwise operators is a way to improve efficiency Method. Skilled use of bitwise operators
Basic understanding of computer system and language