1 / 24

STORAGE MANAGEMENT

STORAGE MANAGEMENT. Chapter 9. MEMORY MANAGEMENT. Contents. Background Logical versus Physical Address Space Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging. 1. Background. Memory management For efficient sharing of limited memory resource

lonna
Download Presentation

STORAGE MANAGEMENT

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. STORAGE MANAGEMENT Chapter 9. MEMORY MANAGEMENT

  2. Contents. • Background • Logical versus Physical Address Space • Swapping • Contiguous Allocation • Paging • Segmentation • Segmentation with Paging

  3. 1. Background • Memory management • For efficient sharing of limited memory resource • 현재는 limited 자원에서 unlimited 자원으로 바뀌어가고 있음. • Process의 address space를 관리하는 측면이 중심 • 각기 다른 address space로 Process의 protection domain을 정함

  4. source compile linking loading Background • 프로그램의 실행과 메모리 관리 • 프로그램을 실행하기 위해서 프로그램은 반드시 프로세스 메모리에 올라와 있어야 한다. • Address Binding • Instruction이나 data가 사용되어질 address의 결정(binding)은 compile, link, load 할 때 이루어 질 수 있다. • Compile time • Link time • Load time • Execution time

  5. Linking & Loading • Linking • Symbol resolution • Compile된 object code 간의 address space를 하나의 address space로 옮기는 과정 • Dynamic Loading • Loading program segment into the memory when it is needed • Overlays : physical memory의 한계로 인해 메모리 부분 부분을 겹쳐서 로딩하는 방식 • Dynamic Linking vs. Static Linking • DLL & shared object

  6. Overview of running a program step by step

  7. Logical vs. Physical Address Space • Address Space : Set of addresses that a process can reference • Logical address – generated by the CPU; also referred to as virtual address.( VA ) • Physical address – address seen by the memory unit. ( PA ) • Logical and physical addresses 는 compile time과 load time에는 구분되지 않는다. • logical (virtual) address 와 physical address는 execution time에 실제로 다른 의미를 가진다.

  8. CPU absolute addr.logical addr.virtual addr. MMU translate physical addr. Memory-Management Unit (MMU) • Hardware device that maps virtual to physical address. • MMU scheme에서는, memory로 전송되기 전에 모든 user program의 주소가 변환과정을 거치게 된다. • User program은 실제 메모리의 주소를 절대 알지 못하며, 스스로 독립적인 공간을 가지게 된다. Memory

  9. MMU • Table between VA to PA • 테이블은 memory에 존재 • Table을 look up 하는데 걸리는 overhead가 큼 ( table에서 엔트리를 찾아오는 과정, 찾은 내용을 가지고 접근하는 과정 ) • CPU의 특별한 register를 이용하여 table에 접근 • TLB 이용 • VA-PA table의 엔트리를 cache • CPU가 가지는 VA를 메모리 접근 없이 PA로 바꿀 수 있음 • Memory의 두 번 접근을 없앰으로써 성능 향상

  10. Paging • Logical address는 물리 메모리 상에서 연속적일 필요가 없다. • 물리 메모리를 일정한 크기의 블록으로 쪼개고 이를 frame이라고 부른다. • Logical Address를 일정한 크기의 블록으로 쪼개고 이를 page라고 부른다. • Free frame들에 관한 정보를 유지한다. • 요구된 메모리가 n frame 크기이면, N개의 free frame을 찾고 loading한다. • page table을 두어 logical address와 physical address의 변환을 한다. • Internal fragmentation이 발생한다.

  11. Paging Example

  12. Free frame list/page table을 관리해야한다. Free Frames Before allocation After allocation

  13. 4byte for each page Logical : Physical e.g. 0:5 Page #0에 abcd 5번째 frame에 abcd가 있음 Paging Example

  14. Paging 페이징 주소 변환 과정

  15. page number page offset p d m-n n Address Translation Scheme • Address generated by CPU is divided into: • Page number(p)– page table의 인덱스로 사용되며, 해당 엔트리에는 page frame의 base address가 들어있다. • Page offset(d)–해당 frame의 offset값이 들어있다. The size of logical address space : 2m A page size : 2n

  16. 2 v 3 v 4 i 7 i page table Paging - Protection • Memory protection implemented by associating protection bit with each frame. • Valid-invalid bit attached to each entry in the page table: frame number valid-invalid bit

  17. Paging – Multilevel Paging • Modern Computer systems support a very large logical address space.  Multilevel Paging

  18. Inverted Page Table

  19. Swapping • 물리 메모리 공간의 제한으로 인해, sleep 상태이거나 wait 상태인 process들을 secondary storage로 옮기고, 여유가 생겼을 때 다시 메모리로 올리는 과정 • Backing store • Swap out/swap in

  20. Schematic overview of Swapping

  21. OS OS OS OS process 5 process 5 process 5 process 5 process 9 process 9 process 8 process 10 process 2 process 2 process 2 process 2 Contiguous Memory Allocation • Two partition of memory segment • OS 상주 영역 (kernel area) • low memory with interrupt vector • User process 영역 (high memory) • Dynamically allocated • Free hole • Allocated partition

  22. Dynamic storage allocation problem • How to satisfy a request of size n from a list of free holes. • First-fit: 집어넣을 수 있는 가장 처음 나오는 hole을 찾는다. • Best-fit: 집어넣을 수는 있지만 가장 작은 hole을 찾는다. 크기로 정렬이 되어있지 않다면, 전체 free hole을 전부 검색해야 함. 작은 크기의 hole을 생성한다. • Worst-fit: 가장 큰 hole을 찾는다. 전체 free hole을 전부 검색해야 함. 큰 크기의 hole을 만든다.

  23. Fragmentation • External fragmentation –하나의 free hole에 요구된 메모리가 연속적으로 할당될 수 없는 상태 • (전체 메모리의 freehole의 크기의 합은 요구된 크기보다 작지만 할당할 수 없음) • Internal fragmentation –요구된 메모리가 할당됨으로써 너무 작아 사용될 수 없는 free hole이 생기는 상태 • Reduce external fragmentation by compaction • Free memory들을 하나의 큰 메모리 공간으로 합침 • Compaction 은 dynamic relocation을 이용하며 수행 시간에 이루어 져야만 가능하다.

  24. Segmentation • Memory-management scheme that supports user view of memory. • A program is a collection of segments.A segment is a logical unit. • Partition과 Paging의 중간 • Memory를 Segment 단위로 나눔 • Program을 Segment 단위로 통째로 올림

More Related