<<The Philosophical Principles of Computer's Mind Operating System>>Induction 2

1. What is memory management

Memory management is to manage the memory architecture. The memory architecture is as shown in the figure below.


 

Users do not need to worry about where their programs exist, anyway, the results of input, calculation and output are the same. The way to make memory management transparent to this medium is virtual memory, which provides users with an address space that is much larger than physical main memory.

 


 2. As programs are swapped between memory and disk, the memory will become more and more fragmented, assuming there are 8 programs,



 At this time, the total memory is sufficient, but due to fragmentation, it cannot provide a continuous 200KB address space. This slack space scattered between processes is called external fragmentation.

 

Solution: Defragment , export the data in the memory to the hard disk, and then reload it to the memory in order, but this method is time-consuming.

 

A Better Solution: Pagination

 

3. The principle of paging

Both virtual memory and physical memory are divided into equal-sized portions, called pages, which are then allocated per page. If the program is too large, part of it is placed in the page and part in the hard disk, so that it can run a large program


 

4. The principle of address translation



 

How does MMU complete the translation? Look up the page table

A page table is a hardware data structure

 

5. The multi-level page table adopts the same method. Only the top-level page table and the secondary page table are stored in the memory to the disk, and then put into the memory when needed.

Implementing multi-level page tables requires multiple accesses to memory, which reduces efficiency. How to solve this problem? It is solved by hardware TLB. TLB is hardware, so the result can be obtained quickly.

 

6. The paging is too large, a page is not used up completely, and the remaining part is internal fragmentation. The way to reduce internal fragmentation is to reduce the size of the paging, but if the paging is too small, the page table records will increase, the number of page table levels will increase, and the efficiency will be reduced.

 

7. Memory thrashing

The virtual memory accessed for many times is not in the physical memory, and a page fault interrupt is issued, and the efficiency of the entire system drops sharply. This phenomenon is called memory jitter.

 

8. Segmentation management system

Disadvantages of paging system: difficult to share; address space is limited as data grows. how to solve this problem?

 



 

In this segmented memory management mode, when running a program, all segments of the program must be placed in the memory, and the previous problem is faced. Therefore, people paging the segments, and the segmented page memory management model appears.

 

9. The file system is the abstraction of the disk

 

10. The file system makes the disk easy to use, and the user does not need to know the details of data storage

 

11. When the user gives a file name, the file system will find out all the data blocks of the file on the disk. How to find the data block specifically? It is to translate the file name into the address where the data block is stored on the disk

 

12. Chunk files

Block files are about input and output devices. Specifically, the block file is analog input and output. For each input and output device, we represent it as a file. When data exchange with the device is required, this file is used to replace it. In this way, the input and output and the file system are connected. unified.

 

13. Temporary files

It is created to save the intermediate results of the program. After the process ends, the temporary file is deleted.

 

14. Given a filename, how does the operating system know where the file is on disk?

This of course requires a data structure to record, and this data structure is the folder. The role of the folder is to track files, which stores the mapping of file names to disk addresses, which is equivalent to the translation from virtual addresses to actual addresses.

 

15. Why does the disk have to be partitioned?

The reason for partitioning is the use of disk space. The length of the computer's memory word is limited, and the disk address needs to be stored in the memory word. Therefore, the number of addresses that the operating system can access is a limited value. If the disk space is large, the operating system will not be able to access the extra space.

 

16. The structure of the disk is as follows


 

17. Why can only one file system be created for a partition?

A disk has multiple sectors, and the 0th sector is of great significance. This sector stores the master boot record, which is a small program used to start the computer. If the sector is damaged, the partition will not be available. After the master boot record is the disk partition table, which gives all the partitions of the disk and their start and end addresses. One of the partitions is the main partition, the operating system is loaded in this main partition, and the first part of the main partition is the boot record.


 

18. Implementation of the file

The realization of a file, in the final analysis, is to be able to store the contents of the file in a suitable place, and to be able to read the data easily when needed.

 

The implementation of the file needs to solve the following problems:

  • 1. Allocate disk space for files
  • 2. Record the location of these disk spaces
  • 3. Put the file content in these spaces

19. FAT file system

 The table of the FAT file system is too large. The size of the FAT table is related to the size of the physical disk and the size of the disk data block. This is the same as the memory paging. If it is too large, it will occupy a large space. How to solve this problem? level index.



 

 

20. Implementation of hard links



 

A hard link is to add the address mapping of the file directly to the link directory

 

21. Mounting of the file system

Mounting is a method of merging one filesystem into another,


 

CD, U disk itself is also a file system, when we want to access the U disk, we must mount the U disk to "My Computer"
 

22. File system access control

How is address protection implemented?

There are two ways, one is from the perspective of the file, the other is from the perspective of the user.

From this, the access control list and the capability list are generated

 

23. Protected Domains

Both access control lists and capability lists have the disadvantage that individual access controls need to be set for individual files.

The protection domain is to organize files and objects with the same access control rights into the same domain, and a process must be in a certain domain.



 

 

24. Features needed for documentation to be consistent

transaction, log. However, when transactions and logs are replicating data, the source data is temporarily unavailable. What should I do at this time?

Using the shadow technology, the shadow is to maintain two versions, and then change the data after the copy or update is completed.

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326564972&siteId=291194637