Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
Add README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Codejune committed Nov 16, 2021
1 parent abf1d6f commit 8e5ddcc
Showing 1 changed file with 144 additions and 0 deletions.
144 changes: 144 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Virtual Memory Paging Simulator
가상메모리 관리 기법의 하나인 페이지 교체 기법 중 OPT, FIFO, LRU, Second-Chance
를 구현하고 동작 과정을 보여주는 시뮬레이터 구현하기

## 0. 빠른 시작
``` bash
$ git clone https://github.com/codejune/c-virtual-memory-simulator.git
$ cd c-virtual-memory-simulator

# 일괄 빌드
$ make

# 개별 빌드
$ make opt
$ ./opt
```

## 1. 환경
### a. SW
- Ubuntu 20.04.3 LTS (x86_64)
- Linux Kernel 5.11.22
### b. HW
- VM Instance
- 4 Core 8 Thread
- 8 GB RAM
- 60 GB Storage

## 2. 요구사항
### a. 페이징 기법 단축어
- OPT: opt
- FIFO: fifo
- LRU: lru
- Second-Chance: sc
### b. 제약 사항
- Page frame: min 1, max 4
- Page reference string: min 1, max 30
- Second-Chance 기법의 경우 참조 기록에 대한 주기적 Refresh는 없다고 가정
### c. 구현 사항
- 실행 초기화면에서 입력 데이터의 파일 이름을 입력 받음
- 입력 데이터에는 Page frame 수, Page reference string 값 포함
- 각 기법간 Paging 과정 및 page fault 발생 출력
### d. 예시
- 입력 데이터
``` bash
$ cat input.txt
3 # Page frame 수
2 3 2 1 5 2 4 5 3 2 5 2 # Page reference string
```
- 출력 결과 (OPT)
``` bash
$ ./opt
Input file path > input.txt
Used method : OPT
Page frames: 3
Page reference string: 2 3 2 1 5 2 4 5 3 2 5 2
frame 1 2 3 page fault
time
1 2 F
2 2 3 F
3 2 3
4 2 3 1 F
5 2 3 5 F
6 2 3 5
7 4 3 5 F
8 4 3 5
9 4 3 5
10 2 3 5 F
11 2 3 5
12 2 3 5
Number of page faults: 6 times
```
- 출력 결과 (FIFO)
``` bash
$ ./fifo
Input file path > input.txt
Used method : FIFO
Page frames: 3
Page reference string: 2 3 2 1 5 2 4 5 3 2 5 2
frame 1 2 3 page fault
time
1 2 F
2 2 3 F
3 2 3
4 2 3 1 F
5 5 3 1 F
6 5 2 1 F
7 5 2 4 F
8 5 2 4
9 3 2 4 F
10 3 2 4
11 3 5 4 F
12 3 5 2 F
Number of page faults: 9 times
```
- 출력 결과 (LRU)
``` bash
$ ./lru
Input file path > input.txt
Used method : LRU
Page frames: 3
Page reference string: 2 3 2 1 5 2 4 5 3 2 5 2
frame 1 2 3 page fault
time
1 2 F
2 2 3 F
3 2 3
4 2 3 1 F
5 2 5 1 F
6 2 5 1
7 2 5 4 F
8 2 5 4
9 3 5 4 F
10 3 5 2 F
11 3 5 2
12 3 5 2
Number of page faults: 7 times
```
- 출력 결과 (Second-Chance)
``` bash
$ ./sc
Input file path > input.txt
Used method : SC
Page frames: 3
Page reference string: 2 3 2 1 5 2 4 5 3 2 5 2
frame 1 2 3 page fault
time
1 2 F
2 2 3 F
3 2 3
4 2 3 1 F
5 2 5 1 F
6 2 5 1
7 2 5 4 F
8 2 5 4
9 2 5 3 F
10 2 5 3
11 2 5 3
12 2 5 3
Number of page faults: 6 times
```

0 comments on commit 8e5ddcc

Please sign in to comment.