20210223 Computer Science Crash Course 40 Episodes (18-25)

CrashCourse Computer Science Crash Course 40 Episode 40 Station B
18. Operating System: Early computers can only run one program at a time, so the program that allows the computer to automatically run the program appears, that is, operating systerm. The OS has special permissions to operate the hardware and can run and Manage other programs. The operating system acts as a medium between software and hardware. More specifically, the operating system provides APIs to abstract hardware, called "device drivers". Programmers can use standardized mechanisms to interact with input/output hardware. Later operating systems have a multitasking function mutitasking to reduce CPU idleness caused by differences in CPU and I/O hardware efficiency. But the problem with multitasking is that each program occupies memory. Even the temporarily dormant program still occupies memory. The solution is to provide each program with a dedicated memory module. But it will bring a new problem. The same program may be stored in multiple discrete memory modules. The solution is to map virtual memory to physical memory. This mechanism allows the size of the program memory to be flexibly increased or decreased, which is called "dynamic memory allocation". For the program, the memory appears to be continuous.
19. Memory&storage media memory&storage: The earliest storage media is a paper card, which is slow to read and write and is disposable. Delay memory, only one of them can be read at the same time, so it is also called sequential memory or cyclic memory, and what we want is random access memory, which can access any location at any time. Magnetic core memory. Tape storage. Drum storage. Disk storage. Flopp disk. ssd.
20. File System File&File Systerm: file format, programmers occasionally invent new file formats, but it is best to use existing standards, such as JPEG, MP3. Take the WMA file as an example. At the beginning of the file is metadata, followed by a series of numbers representing the amplitude of the sound at different times. Bitmap bitmap, the beginning of the BMP file is also metadata, including image width, image height, and color depth. All files, the bottom layer is a string of binary numbers, in order to know what the file is, the file format is very important. In order to store multiple files on the storage medium, a special file is needed to record the location of other files. This special file has many names, which are collectively referred to as Directory File. This file often exists at the forefront, which is located at position 0. In the catalog file, all other file names are stored in the format of "file name. extension". The catalog file also stores file metadata, such as creation time, modification time, file owner, and whether it can be read or written. The most important thing is that the catalog file has the starting position and length of the file. If you want to add, delete, modify the file name, etc., you must update the catalog file. In order to solve the problem of subsequent file coverage caused by file increase or decrease, modern memory divides the storage space into one block, resulting in some "reserved space" to facilitate modification and management. At the same time, the file is split and stored in different blocks. To delete a file, you only need to delete the file-related records in the directory file to make the corresponding block space available. Note that this does not delete the data, but deletes the record, so the data can be restored. Disk fragmentation is caused by the addition, deletion, and modification of files, and it is inevitable. In fact, files may be stored in hundreds of blocks, and they are not continuous. In order to improve reading efficiency, disk defragmentation is required, that is, data is moved back and forth and arranged in the correct order. Hierarchical file system, that is, folder nested folders, in the directory file, we need additional metadata to distinguish whether it is a file or a directory file.
21. Compression: Minimize the space occupied by data. Run-length encoding is suitable for files with the same value often appearing. DFTBA: Need a dictionary to store the correspondence between code and data. Huffman Tree Huffman Tree. Both run-length coding and dictionary coding can achieve lossless compression. Lossy compression removes some unrecognizable information or unimportant information. For example, the voice of a person on the phone is different from the actual voice. The compressed audio is to allow more people to call at the same time. Compared with uncompressed WMA and FLAC, compressed file MP3 can be more than 10 times smaller, saving a lot of storage space. This coding method that deletes data that humans cannot perceive is called "perceptual coding". In JPEG, we are good at seeing sharp contrasts, such as the edges of objects, but we can't see subtle changes in colors. JPEG uses this to decompose images into 8 8 pixel blocks, and then delete a lot of high-frequency spatial data. Video compression MPEG-4 is a common standard, which can be 20 to 200 times smaller than the original file.
22. Command Line Interface Keyboards&Command Line Interfaces: The command line is very powerful and omnipotent. Now programmers still use the command line to access remote servers.
23. Screens&2D Graphics: Early screens were only used to display intermediate states, not to output results. Use paper to print the results. Raster scan. Because early screen pixels occupies a large amount of memory, early computers did not store a large number of pixel values, but stored symbols. 80 to
25 symbols are the most typical, with a total of 2000 characters. For this reason, the computer needs additional hardware to read characters from the memory and convert them into rasters. Graphics, so that they can be displayed on the screen, this hardware is called a character generator, which is the first-generation graphics card. Vector graphics, any graphics are composed of line segments instead of pixels, so vector graphics occupies less space.
24. The Cold War and Consumerism:
25. The Personal Computer Revolution:

Guess you like

Origin blog.csdn.net/foundliving/article/details/113984207