Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 9. 가상 메모리 (Virtual Memory)

Similar presentations


Presentation on theme: "Chapter 9. 가상 메모리 (Virtual Memory)"— Presentation transcript:

1 Chapter 9. 가상 메모리 (Virtual Memory)
Questions of the day (교재 연습문제 9.2) 요구 페이징(demand paging)을 지원하기 위해 필요한 하드웨어가 아닌 것은? Page Table(+ protection bit + valid-invalid bit) TLB(Translation Look-aside Buffer) Address Generation H/W(logical & physical address registers) Segment Table (교재 연습문제 9.4) 어떤 컴퓨터는 사용자에게 232 바이트 크기의 가상 메모리 공간을 제공해 준다. 컴퓨터는 218 바이트 크기의 실제 메모리 공간을 가진다. 가상 메모리는 페이징(paging)에 의해 구현되고, 페이지 크기는 4,096 바이트이다. 사용자 프로세스는 가상 주소 ( )16을 생성한다. 이 가상 주소 (p, d)의 페이지 번호 (page number) p와 변위 (offset) d의 10진수 값은? 무엇? ( )2 만일 해당 페이지의 프레임 번호가 ‘1’ (또는 ‘2’)이었다면 물리 주소 (physical address)의 2진수 값은? 무엇? ( )2 운영체제

2 2012 운영체제 기말시험에 대하여 시험시간 A반: 2012년 6월 20일(수) 12:30~14:00 (12:00~12:30 보강) B반: 2012년 6월 20일(수) 18:00~19:30 (17:00~18:00 보강) 시험범위 5장, 6장, 8장, 9장  교재 시험 범위를 몇 번 이상 읽어야 할까요? Questions of the day 참고 Exam Samples 참고 No exam note 장소 당일 공지 운영체제

3 8장 & 9장 짱 중요 내용 8장 9장 페이징 (paging) 세그먼테이션 (segmentation)
페이지화된 세그먼테이션 (segmentation with paging) 9장 요구 페이징 (demand paging) 페이지 교체(page replacement) 알고리즘 FIFO algorithm Optimal algorithm LRU algorithm 프레임 할당(frame allocation) 알고리즘 스래슁(Thrashing) 운영체제

4 10장, 11장, 12장 중요 내용 10장 파일 시스템 인터페이스(File-System Interface)
10.3 디렉토리 구조(Directory Structure) 11장 파일 시스템 구현(File-System Implementation) 11.4 할당 방법(Allocation Method) 12장 대용량 저장 장치 구조(mass-Storage Structure) 12.4 디스크 스케줄링(Disk Scheduling) 운영체제

5 Metric prefix http://en.wikipedia.org/wiki/Metric_prefix
kilo = 210 = 1,024 mega = 220 = 1,048,567 giga = 230 = 1,073,741,824 tera = 240 = 1,099,511,627,776 peta = 250 = 1,125,899,906,842,624 exa = 260 = 1,152,921,504,606,846,976 zeta yotta mili = m = = 0.001 micro = μ = = nano = n = = pico = p = = femto atto zepto yocto 160 = 1 161 = 24 = 16 162 = 28 = 256 163 = 212 = 4096 164 = 216 = 65546 운영체제

6 배경(Background) 지금까지(~8장)는 한 프로세스 전부가 메모리에 적재되어야 실행
가상 기억 장치 : 프로세스가 전부 메모리에 없어도 실행 프로그램의 일부만 메모리에 적재하여 실행하는 장점 1) 프로그램 크기가 실제 메모리 크기에 제한 받지 않음 2) 멀티 프로그래밍 정도를 높여 CPU 이용율, 처리율 높임 3) swap I/O 양이 적어 각 프로그램이 빠르게 실행됨 Virtual Memory 작은 physical memory로 매우 큰 가상 기억 장치(user logical memory) 제공 user logical memory ≠ physical memory overlay를 사라지게 함 주로 요구 페이징(demand paging)으로 구현됨(OS/2 : demand segmentation) 그림 9.1 참조 운영체제

7 물리 메모리보다 큰 가상 메모리

8 가상 주소 공간 (Virtual-address Space)

9 가상 메모리를 사용할 때의 공유 라이브러리 (Shared Library Using Virtual Memory)

10 요구 페이징(Demand Paging) swapping을 하는 paging system과 유사
lazy swapper처럼 동작하는 pager 꼭 필요한 page만 메모리로 가져오는 pager (cf.) swapper : 전체 프로세스에 대해 동작 page가 memory에 : valid/invalid bit로 valid 표시 disk에 : valid/invalid bit로 invalid 표시 memory에 없는 page 참조 → page fault trap to OS(그림 9.6 참조) 순수 요구 페이징(pure demand paging) 아무 page도 메모리에 가져오지 않은 채 실행 H/W 지원 ① page table : valid/invalid bit 포함 ② secondary memory : swap space 또는 backing store S/W 지원 명령어 인출(fetch)시 페이지 부재 발생하면 그 명령어 다시 인출하여 재시작 3-주소 명령어: 명령어 ADD 인출, A 인출, B 인출, A와 B를 더함, 합을 C에 저장 한 명령어가 여러 기억장소를 변경시킬 때 페이지 부재 발생하면 재시작 어려움 (예) IBM 360/370 MVC(move characters), PDP11의 MOV (R2)+, -(R3) 적절한 S/W 적 지원 필요, undo 등 운영체제

11 페이지 부재 발생 예 destination source 1 2(fault) 3-주소 명령
명령(ADD)을 인출(fetch)해서 해독한다 A를 인출 B를 인출 A와 B를 더한다 합을 C에 저장한다 IBM 360/370 MVC 미리 블록의 양끝 조사하여 페이지 확보 1 2(fault) source destination ADD A B C A MOV (R2)+, -(R3) 명령 재시작 시 R2, R3 값은? Register에 R2, R3 값 저장 B C 운영체제

12 유효-무효 비트 (Valid-Invalid Bit)
각 페이지 테이블 항목에 유효-무효 비트(valid–invalid bit) 연결 (1  in-memory, 0  not-in-memory) 모든 항목의 유효-무효 비트를 0으로 초기화 페이지 테이블의 한 순간의 예 주소 변환할 때, 페이지 테이블 항목의 유효-무효 비트가 0이면  페이지 부재 트랩(page fault trap) 발생 1 Frame # valid-invalid bit page table 운영체제

13 일부 페이지가 주 메모리에 없을 때의 페이지 테이블

14 페이지 부재를 처리하는 과정

15 페이지 부재 처리 과정 운영체제

16 요구 페이징의 성능(Performance of Demand Paging)
유효 접근 시간 = (1-p) x ma(memory access time) + p x page fault time 페이지 부재 서비스 시간 1. 페이지 부재 인터럽트 처리 : 1~100s 2. 페이지 안으로 읽어 들임 : 24ms (디스크 동작) 3. 프로세스 재시작 : 1~100s 디스크 동작 회전지연 시간(latency time) : 8ms - sector에 탐구 시간(seek time) : 15ms - track에 전송 시간(transfer time) : 1ms (EID type: Max. External Transfer Rate=100Mbytes/sec, Spindle Speed=7200rpm) 기억장치 접근 시간이 100ns 일 때의 유효 접근 시간 = (1-p) x (100ns) + p x (25 milliseconds) = (1-p) x p x 25,000,000 = ,999,900 x p 10% 이내로 느려지게 하려면 110 > ,000,000 x p 10 > 25,000,000 x p p < = 1/2,500,000 보다 적게 해야 함 swap space I/O는 file system I/O 보다 빠름(큰 block들의 contiguous I/O 이므로) from the swap space (처음 시작할 때 swap space로 file copy) from the file system : BSD Unix ① swap-in only(not modified case, 예 binary files) ② swap-out in swap space 운영체제

17 쓰기 시 복사 (Copy-on-Write)
요구 페이징 가상 메모리 기법으로 프로세스 생성 쓰기 시 복사(Copy-on-Write; COW) 메모리 사상 파일(Memory-Mapped Files) 프로세스를 생성할 때 부모 페이지를 복사하고 바로 exec()로 부모 페이지를 쓸모 없게 만드는 대신 처음에는 부모 프로세스와 자식 프로세스가 메모리의 같은 페이지(쓰기 시 복사 페이지)를 공유하게 함  둘 중 한 프로세스가 공유중인 페이지를 수정하면, 그 때 그 페이지의 복사본 생성 쓰기 시 복사(COW)는 수정된 페이지만 복사하여 프로세스 생성이 효율적 제로(0)로 채워진 빈 페이지(free page) 집합(pool)에서 페이지 복사본을 위한 새 페이지 할당 (cf.) Solaris vfork() (virtual memory fork) 부모 프로세스 잠시 중단(suspend), 자식 프로세스가 부모의 주소공간 사용 자식 프로세스 만들자 마자 exec() 호출하는 경우를 위한 것  페이지 복사 전혀 없음 쓰기 시 복사(COW) 없음 자식이 페이지를 수정하면 부모에게 그대로 보여지므로 수정하지 않도록 주의 운영체제

18 Before Process 1 Modifies Page C
운영체제

19 After Process 1 Modifies Page C
process1이 페이지 C를 수정한 경우 운영체제

20 페이지 교체(Page Replacement)
over-allocation 일 때(page fault가 일어났고 free-frame 이 없을 때, 그림 9.5) 가능한 조치 1. 그 프로세스 종료 2. 한 프로세스를 swap out : multiprogramming의 정도를 낮춤 3. 페이지 교체(page replacement) : 그림 9.10 희생될 frame은 swap space로 보내고 그 자리에 page fault 였던 page를 가져옴 2 page transfers(one out & one in) page-fault service time이 2배 modify(dirty) bit으로 보완 요구 페이징 구현 위해 필요한 알고리즘들 페이지 대치 알고리즘 : 어떤 frame을 대치(희생자는)? 프레임 할당 알고리즘 : 각 프로세스에 몇 개의 frame할당? 운영체제

21 페이지 교체의 필요성 i 3 v i 6 v 운영체제

22 페이지 교체 (Page Replacement)

23 페이지 교체 알고리즘 (Page-Replacement Algorithms)
페이지 부재율(page-fault rate)이 가장 낮도록 참조열(reference string)로 알고리즘 평가  주소/페이지 size#  random number로 특정 프로세스 추적 참조열 예 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5. 일반적 : 한 프로세스에 할당된 frame 수가 많아지면 page-fault 수는 적어짐 그림 9.11 참조 운영체제

24 페이지 교체 알고리즘 (Page-Replacement Algorithms)
선입 선출(FIFO) 알고리즘 가장 오래된 페이지 대치 FIFO queue사용 구현은 쉬우나 성능이 좋지 않음(교재 예제 15회) Belady의 변이(Belady’s anomaly) 있음 할당된 frame수 증가해도 page-fault수가 증가하는 현상 : 그림 9.13 참조 운영체제

25 FIFO 페이지 교체 (FIFO Page Replacement)

26 First-In-First-Out (FIFO) Algorithm
Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 3 frames (3 pages can be in memory at a time per process) 4 frames FIFO Replacement – Belady’s Anomaly more frames  less page faults 1 1 4 5 2 2 1 3 9 page faults 3 3 2 4 1 1 5 4 2 2 1 5 10 page faults 3 3 2 4 4 3 운영체제

27 FIFO Illustrating Belady’s Anomaly

28 페이지 교체 알고리즘(Page-Replacement Algorithms)
최적(Optimal Algorithm) 알고리즘 가장 오랫동안 사용되지 않을 페이지 대치 Belady의 변이 없음 최소의 page-fault rate(교제 예제 9회) 실제 구현은 어렵지만 (미래 지식필요 : looking forward) 성능이 좋음(9회) 운영체제

29 Optimal Page Replacement

30 최적 알고리즘 (Optimal Algorithm)
Replace page that will not be used for longest period of time. 4 frames example 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 How do you know this? Used for measuring how well your algorithm performs. 1 4 2 6 page faults 3 4 5 운영체제

31 페이지 교체 알고리즘(Page-Replacement Algorithms)
최근 최소 사용(LRU; Least Recently Used) 알고리즘 replace the page that has not been used for the longest period of time OPT에의 접근(최근의 과거를 미래에서의 근사치로 이용) looking backward OPT 성능이 좋아 자주 이용됨(교재 예제 page-fault rate 12회) Linux가 사용 구현을 위해 H/W지원 반드시 필요 1) 계수기 논리 클록 또는 계수기 이용 page table에 추가한 time-of-use field 값이 최소인 것을 대치 2) 스택 페이지 번호들의 스택 유지(doubly linked list로) : 그림 9.16 top : 최근 사용된 page bottom : LRU page Belady의 변이 없음 stack algorithm : memory에는 n 개의 최근 사용된 페이지 운영체제

32 LRU Page Replacement

33 Least Recently Used (LRU) Algorithm
Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 Counter implementation Every page entry has a counter; every time page is referenced through this entry, copy the clock into the counter. When a page needs to be changed, look at the counters to determine which are to change. 1 5 2 8 page faults 3 5 4 4 3 운영체제

34 스택을 이용한 LRU 구현 운영체제

35 페이지 교체 알고리즘 (Page-Replacement Algorithms)
LRU 근접( LRU Approximation) 알고리즘 ① 참조 비트 추가(Additional-reference-Bits) 알고리즘: 8-bit shift registers 이용하여 참조되면 최상위 비트에 세트하고 매 타이머 인터럽트 마다 한 비트씩 shift-right t0: p0과 p2 참조 p0의 참조비트 p1의 참조비트 p2의 참조비트 t1: p1과 p2 참조 p0의 참조비트 p1의 참조비트 p2의 참조비트 ② 2차 기회(Second Chance) 알고리즘 : p319 Fig 참조 프레임에 들어 있는 페이지들을 원형큐로 유지하면서 참조 비트가 0인 페이지를 탐색하되 참조 비트 값이 1인 페이지들은 0으로 바꾸면서 2차 기회 부여 ③ 개선된 2차 기회(Enhanced Second-chance) 알고리즘 (0,0) 사용되지도 변경되지도 않은 경우 (0,1) 사용되지는 않았지만 변경된 경우 (변경된 후 2차 기회를 받은 경우) (1,0) 사용되었으나 변경되는 않은 경우 (1,1) 사용되고 변경된 경우 운영체제

36 이차 기회(클록) 페이지 교체 알고리즘 Second-Chance(clock) Page-Replacement Algorithm

37 페이지 교체 알고리즘 (Page-Replacement Algorithms)
계수(Counting) 알고리즘 LFU(Least Frequently Used) 알고리즘 계수 값이 최소인 페이지 교체 MFU(Most Frequently Used) 알고리즘 계수 값이 최대인 페이지 교체 페이지 버퍼링(Page Buffering) 알고리즘 희생될 프레임을 디스크에 기록하기 전에 새 페이지 읽고 희생될 프레임은 빈 프레임의 pool에 더함 확장 변경된 페이지들의 리스트 유지 modify bit set 된 페이지는 idle time에 디스크에 기록하고 modify bit reset pool 내용 기억하고 있다가 (VAX/VMS) 찾는 페이지가 pool에 있으면 바로 이용 없으면 빈 프레임에 읽어 들임 운영체제

38 프레임의 할당(Allocation of Frames)
single-user : free-frame이 없으면 페이지 대치 : 간단 (multi-user) multiprogramming : 여러 프로세스가 메모리에 1. 최소 프레임수 (Minimum Number of Frames) 할당된 프레임 수가 감소하면 page-fault율이 증가 instruction-set 구조 직접 1 주소 형식 : 명령내용, 주소의 내용 : 2 frames 간접 1 주소 형식 : 명령, 주소의 내용이 가르키는 곳의 내용 : 3 frames 2. 할당 알고리즘(Allocation Algorithms) 균일할당(equal allocation) : m/n (m : 프레임 수, n : 프로세스 수) 비례할당(proportional allocation) ① 크기에 비례 최소 프레임수 < ai = Si/S * m (Si : 프로세스 크기, S =  Si),  ai < m ② 우선순위에 비례 ③ 크기 + 우선순위에 비례 3. 전역 대 지역 할당(Global Versus Local Allocation) 페이지 대치 될 때 전역대치(global replacement) : 대치할 Frame을 전체에서 선택 (예) 자신과 우선순위 더 낮은 process의 것 중에서 선택: 프레임 개수 가변 지역대치(local replacement) : 대치할 frame을 자신의 것 중에서 선택 (예) 덜 사용되는 페이지 선택 : 프레임 개수 고정 운영체제

39 Fixed Allocation Equal allocation – For example, if there are 100 frames and 5 processes, give each process 20 frames. Proportional allocation – Allocate according to the size of process

40 스래슁(Thrashing) 전역 대치의 결과로 중간 단계 CPU 스케줄링(swap-in/swap-out) 도입
우선순위가 낮은 process에 할당된 프레임수가 최소프레임 수보다 적어 지면 그 프로세스 수행을 중지 시키고 swap-out, 나중에 swap-in 활동하는 page 개수 만큼 충분한 프레임이 없으면 자주 page fault가 일어남 방금 대치된 page가 page fault 스레슁 : high paging activity paging만 해 : paging 시간 > 실행 시간 운영체제

41 스래슁(Thrashing) 스레슁의 원인 전역 대치(global replacement) : 다른 프로세스의 page를 대치
paging device 대기, ready queue 비게 됨  CPU 이용률 저하  멀티프로그래밍 정도 높임 … 악순환 … paging activity만 하고 있음(paging device의 큐가 길어 유효접근 시간이 길어짐) 지역 대치(local replacement) : 그 프로세스의 page를 대치 제한적 thrashing 효과 : 그 process만 thrashing 원인 : 활동적인 page들을 모두 수용할 수 없을 때 현재 locality 크기 보다 적은 수의 frame이 할당되었을 때 한 프로세스는 locality 사이를 이동하면서 수행됨 locality : 동시에 활동하는 페이지들의 집합 (예) Subroutine 운영체제

42 메모리 참조 패턴의 지역성 (Locality In A Memory-Reference Pattern)

43 스래슁(Thrashing) 작업 집합 모델(Working-set Model) △ : working-set window
최근의 △ 회 페이지 참조 working-set : △ 페이지 참조인 페이지들의 집합 p353 그림 참조 -> prepaging에 좋음 D =  WSSi (Working-Set Size i) D > m(총 사용가능 frame 수)이면 thrashing 예방 : 멀티프로그래밍의 정도를 낮춤 근접 working-set 구현 : 고정간격 timer interrupt 와 reference bit로 (예) 5,000번 마다 인터럽트, reference-bit 메모리로 복사하고 clear, △가 10,000인 경우, 메모리의 2개 reference-bit와 현재 reference-bit 조사하여 1인 비트 있으면 working set에 포함 페이지 부재 빈도 (Page-Fault Frequency) 페이지 부재율 > 상한  frame할당 페이지 부재율 < 하한  frame제거 직접적인 thrashing 방지법 운영체제

44 작업 집합 모델 (Working-set model)

45 페이지 부재 빈도 (Page-Fault Frequency Scheme)
운영체제

46 작업 집합과 페이지 부재율 (Working Sets and Page Fault Rates)

47 메모리 사상 파일 (Memory-Mapped Files)
메모리 사상 파일(memory-mapped file) I/O는 하나의 디스크 블록을 하나의 메모리 페이지로 사상(mapping)할 수 있게 하여 파일 I/O를 메모리 접근 루틴처럼 처리 처음 접근은 일반적인 요구 페이징(demand paging)에 따라 페이지 부재 발생 파일 내용 중 페이지 크기(a page-sized portion of the file) 만큼의 해당 부분이 파일시스템으로부터 물리 페이지(a physical page) 로 읽혀 들어옴 이후의 읽기/쓰기는 다른 메모리 접근과 마찬가지로 취급 read() write() 시스템 호출을 사용하는 대신 메모리를 이용하여 파일 I/O를 수행함으로써 파일 접근을 단순화 다수 프로세스들이 동일한 파일 사상하여 공유할 수 있게 함 운영체제

48 메모리 사상 파일 (Memory Mapped Files)

49 Windows에서의 메모리 사상 공유 메모리 (Memory-Mapped Shared Memory in Windows

50 (실습) Win32 API에서 공유 메모리 Win32 API를 이용해 공유 메모리에 자료를 기록하는 생산자
솔루션 클릭  속성  공용 속성  시작 프로젝트  여러 개의 시작 프로젝트  producer & consumer 프로젝트 작업  디버깅하지 않고 시작 설정 운영체제

51 producer.c /* producer.c */ #include <windows.h> #include <stdio.h> int main(int argc, char *argv[]) { HANDLE hFile, hMapFile; LPVOID mapAddress; // first create/open the file hFile = CreateFile("temp.txt", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { fprintf(stderr,"Could not open file temp.txt (%d).\n",GetLastError()); return -1; } // now obtain a mapping for it hMapFile = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, 1024,TEXT("SharedObject")); if (hMapFile == NULL) { fprintf(stderr,"Could not create mapping (%d).\n", GetLastError()); // now establish a mapped viewing of the file mapAddress = MapViewOfFile(hMapFile,FILE_MAP_ALL_ACCESS,0,0,0); if(mapAddress == NULL) { printf("Could not map view of file (%d).\n", GetLastError()); // write to shared memory sprintf((char *)mapAddress,"%s","Shared memory message"); //sprintf((char *)mapAddress,"%s","hello"); while (1); // remove the file mapping UnmapViewOfFile(mapAddress); // close all handles CloseHandle(hMapFile); CloseHandle(hFile); /* consumer.c */ #include <stdio.h> #include <windows.h> int main(int argc, char *argv[]) { HANDLE hMapFile; LPVOID lpMapAddress; hMapFile = OpenFileMapping(FILE_MAP_ALL_ACCESS, // read/write permission FALSE, // Do not inherit the name TEXT("SharedObject")); // of the mapping object. if (hMapFile == NULL) { printf("Could not open file mapping object (%d).\n", GetLastError()); return -1; } lpMapAddress = MapViewOfFile(hMapFile, // handle to mapping object FILE_MAP_ALL_ACCESS, // read/write permission 0, // max. object size 0, // size of hFile 0); // map entire file if (lpMapAddress == NULL) printf("Could not map view of file (%d).\n", GetLastError()); printf("%s\n",lpMapAddress); UnmapViewOfFile(lpMapAddress); CloseHandle(hMapFile); 운영체제

52 커널 메모리의 할당 (Allocating Kernel Memory)
Treated differently from user memory Often allocated from a free-memory pool Kernel requests memory for structures of varying sizes Some kernel memory needs to be contiguous

53 Memory allocated using power-of-2 allocator
버디 시스템 (Buddy System) Allocates memory from fixed-size segment consisting of physically-contiguous pages Memory allocated using power-of-2 allocator Satisfies requests in units sized as power of 2 Request rounded up to next highest power of 2 When smaller allocation needed than is available, current chunk split into two buddies of next-lower power of 2 Continue until appropriate sized chunk available

54 버디 시스템 할당 (Buddy System Allocator)

55 슬랩 할당 (Slab Allocation)
Alternate strategy Slab is one or more physically contiguous pages Cache consists of one or more slabs Single cache for each unique kernel data structure Each cache filled with objects – instantiations of the data structure When cache created, filled with objects marked as free When structures stored, objects marked as used If slab is full of used objects, next object allocated from empty slab If no empty slabs, new slab allocated Benefits include no fragmentation, fast memory request satisfaction

56 슬랩 할당 (Slab Allocation)

57 기타 고려 사항(Other Considerations)
프리페이징(Prepaging) 페이지 크기(Page Size) 역 페이지 테이블(Inverted Page Table) 프로그램 구조(Program Structure) Array A[1024, 1024] of integer Each row is stored in one page (C programming language case) One frame Program 1 for j := 1 to 1024 do for i := 1 to 1024 do A[i,j] := 0; 1024 x 1024 page faults Program 2 for i := 1 to 1024 do for j := 1 to 1024 do A[i,j] := 0; 1024 page faults 운영체제

58 기타 고려 사항(Other Considerations)
입출력 상호 잠금(Input/Output Interlock) 실시간 처리(Real-Time Processing) 가상 기억 장치 : 페이지 부재 처리로 예기치 않은 긴 지연 시간 초래할 수 있음 실시간 시스템은 가상 기억 장치를 사용 않음 Solaris 2 : time-sharing과 real-time 모두 지원 위해 ① 어떤 페이지가 중요한지 시스템에 힌트를 줌 ② 특권 사용자가 페이지를 메모리에 잠글 수 있게 함 운영체제

59 입출력 프레임이 메모리 내에 존재해야 하는 이유 (Reason Why Frames Used For I/O Must Be In Memory)

60 가상기억장치 실례 Windows NT 요구페이징(demand paging)과 클러스터링(clustering)
Faulting page 근처의 여러 페이지들을 메모리로 가져옴 각 프로세스마다 Working-set minimum과 maximum(메모리 여유 있을 때) 배정 Free page frames list 유지 Working-set maximum에서 page fault: local, FIFO 페이지 대치 Free memory가 한계값 이하가 되면 automatic working-set trimming: working-set minimum이상의 페이지들 제거 Solaris 2 Page fault 일어나면 free pages의 list에서 페이지 할당 2 파라미터 minfree와 lotsfree 유지 1초에 4번 free memory 조사하여 minfree 상태가 되면 프로세스는 pageout 시작 -> lotsfree 될 때까지 계속 Pageout = Two-handed-clock algorithm second-chance algorithm과 유사: 처음에 reference bit 0으로 설정, 다음번 조사 때 계속 0인 페이지 대치 lotsfree 상태까지 pageout을 할 수 없으면 swapping 시작 운영체제

61 Windows XP Uses demand paging with clustering. Clustering brings in pages surrounding the faulting page Processes are assigned working set minimum and working set maximum Working set minimum is the minimum number of pages the process is guaranteed to have in memory A process may be assigned as many pages up to its working set maximum When the amount of free memory in the system falls below a threshold, automatic working set trimming is performed to restore the amount of free memory Working set trimming removes pages from processes that have pages in excess of their working set minimum

62 Solaris Maintains a list of free pages to assign faulting processes
Lotsfree – threshold parameter (amount of free memory) to begin paging Desfree – threshold parameter to increasing paging Minfree – threshold parameter to being swapping Paging is performed by pageout process Pageout scans pages using modified clock algorithm Scanrate is the rate at which pages are scanned. This ranges from slowscan to fastscan Pageout is called more frequently depending upon the amount of free memory available

63 Solaris 페이지 스캐너 (Solaris Page Scanner)

64 그리이스 문자 (Greek Alphabet)
운영체제

65 무엇이 성공인가 자주 그리고 많이 웃는 것 현명한 이에게 존경을 받고 아이들에게서 사랑을 받는 것 정직한 비평가의 찬사를 듣고
친구의 배반을 참아 내는 것 아름다움을 식별할 줄 알며 다른 사람에게서 최선의 것을 발견하는 것 건강한 아이를 낳든 한 뙈기의 정원을 가꾸든 사회 환경을 개선하든 자기가 태어나기 전보다 세상을 조금이라도 살기 좋은 곳으로 만들어 놓고 떠나는 것 자신이 한때 이곳에 살았음으로 해서 단 한 사람의 인생이라도 행복해지는 것 이것이 진정한 성공이다. 랄프 왈도 에머슨 운영체제

66 Hard 한 걸 Hard 하게 하면 Hard해 진다.
수고하셨습니다! Hard 한 걸 Hard 하게 하면 Hard해 진다. Hard 한 것은 아름답다. 운영체제

67 강의평가 2.69 문항번호 구분명 질문문안 아주 그렇다 보통이다 아니다 전혀 1 수업목표 강의목표가 합리적으로 설정되었다. 2
수업내용 강의계획서에 따라 체계적으로 강의가 진행되었다. 3 교수자특성 강의준비가 충실하였으며 성의 있게 강의를 진행하였다. 4 강의전달 강의내용 설명이 대체로 명료하였다. 5 수업운영 교수는 학생들의 수업참여를 유도하였다. 6 수업방법/ 실기특성 강의방법과 자료가 적절히 활용되었다. 7 과제 및 시험 시험 과제와 시험문제가 강의내용에 부합하였다. 8 수업관리 강의시간이 대체로 잘 지켜졌다. 12 9 학습자의 수업성과 이 강의를 통해 해당 분야의 지식과 학습의욕이 생겼다. 10 전체적 평가 전체적으로 이 강의가 만족스러웠다. 2.69 운영체제


Download ppt "Chapter 9. 가상 메모리 (Virtual Memory)"

Similar presentations


Ads by Google