paging & segmentation

24
Paging & Segmentation 제 11 제 : Paging 제 Segmentation

Upload: rozene

Post on 06-Jan-2016

90 views

Category:

Documents


4 download

DESCRIPTION

제 11 강 : Paging 과 Segmentation. Paging & Segmentation. 프로그램이 크다면 ?. Swapping Overlay 비연속 할당기법. 운영체제. 프로그램 A. 프로그램 B. 프로그램 C. 빈 공간 List. MMU CPU 에서 Memory 로 가는 주소를 바꿔친다. memory. CPU 가 보낸 주소를 MMU 가 변환 (Memory Management Unit). Add 10, 20 10 : 100 20 : 330 Jump 30 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Paging  & Segmentation

Paging &

Segmentation

제 11 강 : Paging 과 Segmentation

Page 2: Paging  & Segmentation

프로그램이 크다면 ?

•Swapping•Overlay•비연속 할당기법

빈 공간 List

운영체제

프로그램 A

프로그램 B

프로그램 C

Page 3: Paging  & Segmentation

MMU

CPU 에서 Memory 로 가는 주소를 바꿔친다

Page 4: Paging  & Segmentation

Add A, B

A: 100

B: 330

Jump C

C: exit

Add 10, 20

10: 100

20: 330

Jump 30

30: exit

memory

Source Binary

CPU 가 보낸 주소를MMU 가 변환

(Memory Management Unit)

Mapping

10 500

논리적 주소

실제주소

Page 5: Paging  & Segmentation

Add A, B

A: 100

B: 330

Jump C

C: exit

Add 10, 20

10: 100

20: 330

Jump 30

30: exit

memory

Source Binary 프로그램 running 도중에 옮겨도 된다load 해도 된다

Any time Any place

CPU 가 보낸 주소를MMU 가 변환

(Memory Management Unit)

Mapping

10 500

만일 mapping table 이 있다면10 번지를 아무 곳으로나(anytime, anyplace)

논리적 주소

실제주소

Page 6: Paging  & Segmentation

Memory Management Unit

CPU 가 제시한 주소

logical

CPU

Memory500:10

10 maps to 500 실제 memory 내 주소physical

Page 7: Paging  & Segmentation

Paging – 동일한 크기

CPU 가 제시한 주소

logical

CPU

Memory500:10

10 maps to 500 실제 memory 내 주소physical

Page 8: Paging  & Segmentation

CPU 가 제시한 주소

logical

CPU

Memory500:10

10 maps to 500 실제 memory 내 주소physical

Segmentation – 모두 다른 크기

Page 9: Paging  & Segmentation

Logical vs. Physical Address Space

–Logical address•CPU( 프로세스 ) 가 제시한 주소• “virtual address”.

–Physical address •메모리에 실제로 전달되는 주소 .

Page 10: Paging  & Segmentation

Paging

Page 11: Paging  & Segmentation

Paging

• page• page frame• 전체 executable binary 은 disk 에• CPU 가 참조하는 page 만 메모리로

Memory Disk

pageframe page

Page 12: Paging  & Segmentation

CPU 가 제시한 주소

logical

CPU

Memory500:10

10 maps to 500 실제 memory 내 주소physical

Paging아무 page frame 에도 올라온다

Disk

page

MMU

10

500

Page 13: Paging  & Segmentation

p d

address from CPU

page numberdisplacement(offset)

10CPU 가 제시한 주소

logical

Page 14: Paging  & Segmentation

p d

address from CPU

page numberdisplacement(offset)

p’

p

10CPU 가 제시한 주소

logical

실제 메모리 주소physical

Page 15: Paging  & Segmentation

p d

address from CPU

page numberdisplacement(offset)

p’

p

+ p’ d

10

500

CPU 가 제시한 주소

logical

실제 메모리 주소physical

Page 16: Paging  & Segmentation

p d

address from CPU

page numberdisplacement(offset)

p’

p

+ p’ d

10

500

CPU 가 제시한 주소

logical

실제 메모리 주소physical

Page Table Base RegisterPage Table Limit Register

Page 17: Paging  & Segmentation

Page Table Entry

sector addrpage framerwxR

Resident bit

p d

page numberdisplacement(offset)

p’

p +

10

500

Page 18: Paging  & Segmentation

Paging 의 장단점

• 장점 – 외부 단편화 현상이 안 생긴다 .

• 단점 – 페이지 테이블 공간 (table fragmentation)– MMU 하드웨어가 필요– 할당된 마지막 페이지에서 내부단편화

Page 19: Paging  & Segmentation

Segmentation

Page 20: Paging  & Segmentation

main()

int A[ ][ ];

main(){ ----}

add(){ ----}

A[][]

add()

stack

data rw

code x

data rwa

code x

Page 21: Paging  & Segmentation

Segment

• 전체 executable binary 은 disk 에• cpu 가 참조하는 segment 만 메모리로

Memory Disk

page

Page 22: Paging  & Segmentation

CPU 가 제시한 주소

logical

CPU

Memory500:10

10 maps to 500 실제 memory 내 주소physical

아무 공간에도 올라온다 Placement – First-fit, Best-fit, Worst-fit

Disk

MMU

10

500

Holes

Page 23: Paging  & Segmentation

s d

address from CPU

segment numberdisplacement(offset)

s’

s

+ s’ d

10

500

CPU 가 제시한 주소

logical

실제 메모리 주소physical

Page 24: Paging  & Segmentation

Segment Table Entry

sector addrs’rwxalengthR

Resident bit