Third, operating system knowledge (2)

Source: Internet
Author: User

3. Storage Management

Object: main memory (RAM)

Memory: The main place of key resource information storage in computer system.

Main functions: Allocating and recovering memory space, improving the utilization of primary memory, and effectively protecting the stored information (master)

Development direction: High speed, large capacity, small volume

  

Virtual address: That is, relative address, program address, logical address, symbolic address, name address

Name Space--(assembly or compilation, link editing process) > Logical address space (relative address space)--(address relocation) > Physical Address space (absolute address space)

Storage space: Logical address space (address space), Physical address space (storage space), collection of addresses

Address relocation: Logical address transformation to primary physical address

Resolving the correspondence between address (instruction, data) and main memory address in an executable file

Completed by loader loader, address relocation mechanism

Classification:

1. Static Relocation: Loader is complete without the need for address relocation mechanism support. There is no change during execution. Disadvantage: Allocate contiguous storage area, cannot expand storage space during execution, cannot move in main memory, and can not daydream the copy and data of the same program in main memory.

2. Dynamic re-position: Swap in, swap out main memory, solve main memory tension; move in main memory, fragment concentration, make full use of space; using small main memory blocks, you do not have to allocate contiguous space; share

Storage Management:

Objective: To solve the problem of multi-user using main memory

You must allocate enough space for each job in order to load all the information. When the main memory space can not meet the job requirements, the job can not be loaded into main memory execution.

Classification:

1. Partitioned storage: The user area of main memory is divided into several regions, each assigned to a user job.

(1) Fixed partition: When the system is generated, the size can be unequal. There is no unused space in the allocated area.

(2) Variable partition: When the job is loaded, the number is variable and the partition size is equal to the job size. The best adaptive algorithm, the worst adaptive algorithm, the first adaptive algorithm, the first adaptive algorithm. Continuously distributed, recycled, resulting in outer fragments.

(3) Reposition partition: Move all allocated to make it a contiguous partition. Resolving fragmentation issues

Purpose of partition protection: Prevent unauthenticated users from accessing the partition.

Upper bound/Nether register protection, base/limit Register protection

2. Paging Storage

Advantages: The paging process is done by the operating system, transparent to the user, the user does not have to care about the paging process

Cons: Sharing is not easy to achieve

(1) Pure paging: The process address space is divided into several areas of equal size, called the page, and the main memory space is divided into several physical blocks of the same size as the page, called block, Page box. Each page of a process is assigned to multiple physical blocks of main memory in a discrete way.

      

Page table: Ensure that the physical block corresponding to each page is found in main memory. Implements an address mapping from the page number to the physical block number.

Address mapping: Access to at least two main memory. 1. Get the data physical address, 2. Access data, if the data is an indirect address, but also need to change

      

Address transformation mechanism: Use the page table to transform the logical address in the user program into the physical address in main memory (the user program is transformed into main memory of the physical block number). Page table register, Physical address register, or out-of-bounds interrupt

Fast table: Small-capacity Lenovo memory, composed of a set of fast memory. Save the page number and related information for a few active pages with a high frequency of current visits.

Find the corresponding physical page number in Lenovo memory based on the logical page where the data resides. Finding the Lenovo memory and finding the main memory page table is done in parallel. Once the matching logic is found in the Lenovo memory, stop looking for the main memory page table

Level two page table mechanism: In order to reduce the contiguous memory space occupied by the page table

Each process page table occupies main memory space is continuous, if the page table occupies a large, continuous is not realistic.

Principle: Page tables are paginated. Each page size is the same size as the main memory physical block, and each page is stored separately in a different physical block. Outer Page Table: The First Level page table, the physical address of a page table; second-level page table: the physical block number that holds the page.

        

3. Segmented storage Management: The address space of a job is divided into segments, each of which is a complete set of logical information. (Main program segment, subroutine segment, data segment, stack segment ...) Each segment is assigned a contiguous partition, and the segments in the process can be assigned to different partitions of main memory in a discrete way.

Advantages: Easy to achieve segment sharing, the protection of the segment is simple.

    

Cong: Create a Segment mapping table for each process. Logical section, physical main memory

      

      

4. Segment-Page storage:

Having the advantage of paging system to effectively improve main memory utilization ratio, it also has the advantages that segmented system can meet users ' needs well.

First, the whole storage is divided into equal size storage block (page shelf), the user program according to the logical relationship of the program into several segments. Each paragraph is divided into pages, which are distributed on a page shelf in discrete units.

    

The system must also configure the Segment table, the page table

    

Virtual Storage Management:

The job is only partially loaded into main memory to start the run, the remainder is temporarily left on the disk, and then loaded into main memory when needed.

Advantages: Can effectively use main memory space. From the user's point of view, the system has more memory capacity than the actual main memory capacity.

Program Locality principle: The program executes the local law (in a period of time, the execution of the program is confined to a certain part, the storage space accessed is also confined to a certain area).

Performance: Time limitation (cyclic operation), spatial limitation (sequential execution)

Virtual Storage:

Function: request incoming, replace

Only the part of the job can be loaded into main memory to run the job, can logically expand the capacity of main memory

Logical capacity: determined by main memory, the sum of external memory capacity, and the range of CPU addressable. Operating speed is close to main memory speed, low cost.

Classification:

1. Request a paging system:

2. Request a staging system

3. Requesting a section-page system

      

    

Third, operating system knowledge (2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.