Computer operating system - Memory Management

Excerpt from github CS-Notes - computer operating system


First, the virtual memory

Abstract physical memory address space, each process has its own address space, the address space is divided into a plurality of blocks, each block is called a . These pages are mapped to physical memory , but does not need to be mapped to contiguous physical memory, you do not need all the pages must be in physical memory. The purpose is to make the physical memory to expand into larger logical memory, allowing the program to get more available memory.

1, the paging system address map

Physical memory address space and is responsible for converting memory management unit, wherein the page table stores the page (program address space) and page frames (physical memory space) of the map. Virtual address into a page number (16-bit address is the first 4 bits) and the offset stored . Decimal number corresponding to the index page of the page table, a page table entry indicates whether the last digit in memory, the first few pages is the first few frames.

2, page replacement algorithm

The program is running, the page if you want to access the memory page fault occurs so as not to be transferred to the page memory in. At this time, if the memory has no free space, from memory, the system must call up a page to disk swap space in to make room.

Page replacement algorithm main purpose is to make the page replacement lowest frequency .

    Big Box   computer operating system - Memory Management >
  • Best (OPT): The selected pages will be swapped out for the longest time is no longer accessible (theoretically without knowing the future use of the page)
  • Recently Least Recently Used ( the LRU): By the end of the list to ensure the maintenance page table is the least recently accessed costly
  • Not Recently Used : Each page has two status bits M and R
  • FIFO : Select swapped out pages are the first to enter the page
  • Second chance algorithm : Based on FIFO, R bit is set to 1 page when the page is accessed. If the R bit FIFO is 0, direct displacement, the R bit is 1, pages on the tail of the queue, continuing FIFO
  • Clock : opportunities for improvement second algorithm, connecting the first queue (list) through the FIFO pointer to FI page

Second, segments, and segments of page

1, segment

The address space is divided into a plurality of segments has an independent address space, the length of each segment may be different and may grow dynamically.

2, paragraph of page

Program's address space is divided into a plurality of segments independent address space, the address space on each segment is divided into the same size page. This will not only have a segmented system of sharing and protection , but also has a paging system virtual memory capabilities.

3, tab segment VS

  • Tab transparent to the programmer, the programmer needs to segment dividing each display segment

  • Paging is one-dimensional address space is two-dimensional segmentation

  • Immutable page size, the segment size may be dynamically altered

  • Mainly used for virtual memory paging, thereby obtaining a larger address space; segment mainly to make programs and data may be divided into separate logical address space and facilitate the sharing of protection and

Guess you like

Origin www.cnblogs.com/lijianming180/p/12026730.html