• Tidak ada hasil yang ditemukan

Memory Management in Virtual Memory 3 15 20 15 20 TLB

N/A
N/A
Protected

Academic year: 2025

Membagikan "Memory Management in Virtual Memory 3 15 20 15 20 TLB"

Copied!
1
0
0

Teks penuh

(1)

Memory Management in Virtual Memory

Paging

 แบ่งหน่วยความจ าหลัก (main memory) เป็นช่องเล็ก ๆ (blocks) ขนาดคงที่ เรียกช่องเหล่านี้ว่า pages

 ระบบปฏิบัติการ (Operating System: OS) แปลงค่าต าแหน่ง logical address ไปเป็น physical address โดยใช้ข้อมูลจากตาราง page table ซึ่งประกอบด้วย location ของแต่ละ page ส าหรับแต่ละ process

Address translation

เมื่อขนาด Page table ใหญ่มากขึ้น ท าให้เกิดปัญหา Page fault

 ใช้ cache พิเศษที่เรียกว่า TLB

(Translation Lookaside Buffer) ท าหน้าที่เก็บ Page table ที่ใช้งานล่าสุด (Last Recently Used)

 TLB เป็น cache ของ Page table และ run บน CPU แบบ Fully associative memory

3 15 20 15

20

1 2 3

Physical address Logical address

Page table

Process A

Main memory

Page1 A Page2

A Page3

A

Page number 17

18 19 20

Dynamic storage allocation

First-fit: Allocate the first hole that is big enough.

Best-Fit: Allocate the smallest hole that is big enough.

Worst-Fit: Allocate the largest hole.

Next-fit: Start to search from the last allocation made, choose the first hole that is big enough.

First-fit and best-fit better than worst-fit in term of storage utilization.

Internal fragmentation and external fragmentation problem

Translation Lookaside Buffer V. Virtual Page Physical Page

Virtual address

Page# offset

offset TAG Index

TLB

Page table

hit/miss

Cache hit/miss

Main memory

value

Real address

Referensi

Dokumen terkait