Materi kuliah sistem operasi untuk perguruan tinggi

6vgvv7vyh4 6 views 12 slides Aug 28, 2025
Slide 1
Slide 1 of 12
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12

About This Presentation

sistem operasi


Slide Content

Memory Management
(2)

VIRTUAL MEMORY
•Problem : programs were too big to fit in the available
memory
•Solution :
•1. overlay (split the program into pieces)
•Swapping overlay done by system, however splitting the program
has to done by the programmer
•2. Virtual memory
•Basic idea : programs may exceed the amount of physical
memory available for it
•Most virtual memory system use a technique called paging,

Paging
•Virtual addresses : program-generated
addresses, it form Virtual address space.
•Memory Management Unit (MMU) : maps
the virtual addresses onto the physical
memory addresses

Paging
•Virtual address space is divided up into units called pages
•The corresponding units in the physical memory are called
page frames
•Page fault / fault = happened if program tries to use an
unmapped page.
•The operating system picks a little-used page frame and
writes its contents back to the disk.
•It then fetches the page just referenced into the page frame
just freed, changes the map, and restarts the trapped
instruction.

MOV REG,0
0 (virtual address)
Page 0
Frame 2
Physical address is
8192
MOV REG,20500
20 bytes from the
start of virtual page 5
(virtual addresses
20480)
Frame 3
Physical address =
12288+20 = 12308
MOV REG, 33000 –
PAGE FAULT

Paging

Virtual address consist of 2 part :
page number p
offset page d
Page table = table for all processes in the memory

Virtual address 0
mapped to physical
address 20 ((5 x 4) + 0).
Virtual address 5
mapped to physical
address 25 ((6 x 4) +1).

Page Replacement Algorithm

When a page fault occurs, the operating
system has to choose a page to remove from
memory to make room for the page that has to
be brought in.

Objective : Minimum page fault

Page Replacement Algorithm
•Random
•FIFO (First In First Out)
•Optimal
•LRU (Least Recently Used)

FIFO (First In First Out)

Replace the oldest page

Number of faults : 15

Optimal

Replace the page that will not be used in the near future

Impossible to implement because the operating system
has no way of knowing when each of the pages will be
referenced next.

LRU (Least Recently Used)

Replace the page that is not recently used