Skip to content

πŸ—“οΈ 컴퓨터 μ‹œμŠ€ν…œ 일반 탐ꡬ ν™œλ™ - ν”„λ‘œμ„ΈμŠ€ μŠ€μΌ€μ€„λŸ¬ μ•Œκ³ λ¦¬μ¦˜ κ΅¬ν˜„ν•˜κΈ°

License

Notifications You must be signed in to change notification settings

junhoyeo/computer-science-schedulers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Computer Science Process Schedulers

컴퓨터 μ‹œμŠ€ν…œ 일반 탐ꡬ ν™œλ™ - ν”„λ‘œμ„ΈμŠ€ μŠ€μΌ€μ€„λŸ¬ κ΅¬ν˜„ν•˜κΈ°

  1. λ³΄κ³ μ„œ
  2. μ‹€ν–‰ 및 κ²°κ³Ό
    1. FIFO μ•Œκ³ λ¦¬μ¦˜
    2. SJF μ•Œκ³ λ¦¬μ¦˜
    3. HRRN μ•Œκ³ λ¦¬μ¦˜

Abstract

 컴퓨터 일반 μˆ˜μ—… λ•Œ 배운 ν”„λ‘œμ„ΈμŠ€ μŠ€μΌ€μ€„λŸ¬λ₯Ό, μ œκ°€ ν‰μ†Œ ν™œλ°œν•˜κ²Œ 연ꡬ 및 ν”„λ‘œμ νŠΈλ₯Ό μ§„ν–‰ν•˜κ³  μžˆλŠ” 뢄야인 ν”„λ‘œκ·Έλž˜λ°μœΌλ‘œ λ§Œλ“€μ–΄ 보면 μ–΄λ–¨κΉŒ ν•˜μ—¬ Python으둜 κ΅¬ν˜„ν–ˆμŠ΅λ‹ˆλ‹€.

μ‹€μ œλ‘œ μ€€λΉ„ 큐, ν”„λ‘œμ„ΈμŠ€ 도착/μ’…λ£Œ/선정을 κ΅¬ν˜„ν–ˆκ³ , 파일 schedulers.pyμ—μ„œ λŒ€ν‘œμ μΈ μŠ€μΌ€μ€„λŸ¬ μ•Œκ³ λ¦¬μ¦˜μΈ FIFO(μ€€λΉ„ νμ—μ„œ λ“€μ–΄μ˜¨ μˆœμ„œλŒ€λ‘œ pop), SJF(μ€€λΉ„ 큐의 ν”„λ‘œμ„ΈμŠ€λ₯Ό μ‹€ν–‰ μ‹œκ°„ κΈ°μ€€μœΌλ‘œ μ •λ ¬ν•˜μ—¬ μ„ μ •), HRRN(μ€€λΉ„ 큐의 각 ν”„λ‘œμ„ΈμŠ€ μš°μ„ μˆœμœ„λ₯Ό κ³„μ‚°ν•˜μ—¬ μ„ μ •)을 κ΅¬ν˜„ν–ˆμŠ΅λ‹ˆλ‹€.

ν”„λ‘œκ·Έλž¨μ„ μ‹€ν–‰ν•˜λ©΄ μ‹œκ°„μ— 따라 각 ν”„λ‘œμ„ΈμŠ€μ˜ μ‹œμž‘(start)κ³Ό μ’…λ£Œ(termination)λ₯Ό 보여주며, λͺ¨λ“  ν”„λ‘œμ„ΈμŠ€κ°€ μ’…λ£Œλœ λ’€ 각 ν”„λ‘œμ„ΈμŠ€μ˜ λŒ€κΈ° μ‹œκ°„(wait time)κ³Ό λ°˜ν™˜ μ‹œκ°„(termination time)을 좜λ ₯ν•˜κ³  평균 λŒ€κΈ° μ‹œκ°„(AWT), 평균 λ°˜ν™˜ μ‹œκ°„(ATT)을 계산해 λ³΄μ—¬μ€λ‹ˆλ‹€.

ν”„λ‘œμ„ΈμŠ€ λͺ©λ‘μ€ 효율적인 개발과 μ‚¬μš©μ„ μœ„ν•΄μ„œ JSON 포맷으둜 νŒŒμΌμ— μ €μž₯된 것을 λ‘œλ”©ν•©λ‹ˆλ‹€. 각각의 ν”„λ‘œμ„ΈμŠ€ μ˜€λΈŒμ νŠΈλŠ” 컴퓨터 μ‹œμŠ€ν…œ 일반 μ‹œκ°„μ˜ μœ μΈλ¬Όμ—μ„œμ²˜λŸΌ, 각각의 ν”„λ‘œμ„ΈμŠ€ 번호(id), 도착 μ‹œκ°„(arrival), μ‹€ν–‰ μ‹œκ°„(execution)을 κ°€μ§‘λ‹ˆλ‹€.

μœ μΈλ¬Όμ—μ„œ μ œμ‹œλœ ν‘œμ˜ κ°’λŒ€λ‘œ ν”„λ‘œμ„ΈμŠ€ λͺ©λ‘μ„ λ§Œλ“€κ³  각 μ•Œκ³ λ¦¬μ¦˜μ„ μ‹€ν–‰ν–ˆμ„ λ•Œ, μˆ˜μ—… μ‹œκ°„μ— κ³„μ‚°ν–ˆλ˜ 결과와 λ™μΌν•œ 좜λ ₯이 λ‚˜μ™€μ„œ λΏŒλ“―ν–ˆμŠ΅λ‹ˆλ‹€. μ‹€μ œλ‘œ μŠ€μΌ€μ€„λŸ¬μ˜ λ™μž‘μ„ κ΅¬ν˜„ν•˜λ‹ˆ 각 μ•Œκ³ λ¦¬μ¦˜μ˜ 흐름에 λŒ€ν•΄μ„œ 더 μ‰½κ²Œ 이해할 수 μžˆμ—ˆμŠ΅λ‹ˆλ‹€. μ•žμœΌλ‘œ λΌμš΄λ“œ 둜빈과 같은 λ‹€λ₯Έ μ•Œκ³ λ¦¬μ¦˜κΉŒμ§€ μ§€μ›ν•˜λ„λ‘ λ§Œλ“€κ³ , vue.js λ“±μ˜ μžλ°”μŠ€ν¬λ¦½νŠΈ ν”„λ‘ νŠΈμ—”λ“œ ν”„λ ˆμž„μ›Œν¬λ₯Ό μ‚¬μš©ν•΄ 처리λ₯Ό μ‹œκ°ν™”ν•΄ λ‹€λ₯Έ ν•™μƒλ“€μ΄λ‚˜ (곧 생길) 후배듀이 ν”„λ‘œμ„ΈμŠ€ μŠ€μΌ€μ€„λŸ¬λ₯Ό 더 μ‰½κ²Œ 이해할 수 있게 ν•  κ²ƒμž…λ‹ˆλ‹€.Β 

Usage

./process.json에 μ•„λž˜μ™€ 같이 μ‹€ν–‰ν•  ν”„λ‘œμ„ΈμŠ€ λͺ©λ‘μ„ μ €μž₯ν•©λ‹ˆλ‹€.

[
  { "id": 0, "arrival": 0, "execution": 9 },
  { "id": 1, "arrival": 1, "execution": 6 },
  { "id": 2, "arrival": 2, "execution": 2 },
  { "id": 3, "arrival": 3, "execution": 4 }
]

μœ„μ—μ„œ 각각 idλŠ” ν”„λ‘œμ„ΈμŠ€ 번호, arrival은 도착 μ‹œκ°„, execution은 μ‹€ν–‰(처리) μ‹œκ°„μ„ λœ»ν•©λ‹ˆλ‹€.

μ˜ˆμ‹œ ν”„λ‘œμ„ΈμŠ€ 도착 μ‹œκ°„ μ‹€ν–‰ μ‹œκ°„
p0 0 9
p1 1 6
p2 2 2
p3 3 4

FIFO (First In First Out)

t=0
p0 started
t=1
t=2
t=3
t=4
t=5
t=6
t=7
t=8
t=9
p0 terminated
p1 started
t=10
t=11
t=12
t=13
t=14
t=15
p1 terminated
p2 started
t=16
t=17
p2 terminated
p3 started
t=18
t=19
t=20
t=21
p3 terminated

=== results ===
#p0, wait time: 0, termination time: 9
#p1, wait time: 8, termination time: 14
#p2, wait time: 13, termination time: 15
#p3, wait time: 14, termination time: 18

AWT: 8.75
ATT: 14.0
ν”„λ‘œμ„ΈμŠ€ λŒ€κΈ° μ‹œκ°„ λ°˜ν™˜ μ‹œκ°„
p0 0 9
p1 8 14
p2 13 15
p3 14 18
평균 λŒ€κΈ° μ‹œκ°„ 평균 λ°˜ν™˜ μ‹œκ°„
8.75 14.0

SJF (Shortest Job First)

t=0
p0 started
t=1
t=2
t=3
t=4
t=5
t=6
t=7
t=8
t=9
p0 terminated
p2 started
t=10
t=11
p2 terminated
p3 started
t=12
t=13
t=14
t=15
p3 terminated
p1 started
t=16
t=17
t=18
t=19
t=20
t=21
p1 terminated

=== results ===
#p0, wait time: 0, termination time: 9
#p1, wait time: 14, termination time: 20
#p2, wait time: 7, termination time: 9
#p3, wait time: 8, termination time: 12

AWT: 7.25
ATT: 12.5
ν”„λ‘œμ„ΈμŠ€ λŒ€κΈ° μ‹œκ°„ λ°˜ν™˜ μ‹œκ°„
p0 0 9
p1 14 20
p2 7 9
p3 8 12
평균 λŒ€κΈ° μ‹œκ°„ 평균 λ°˜ν™˜ μ‹œκ°„
7.25 12.5

HRRN (Highest Response Ratio Next)

t=0
p0 started
t=1
t=2
t=3
t=4
t=5
t=6
t=7
t=8
t=9
p0 terminated
p2 started
t=10
t=11
p2 terminated
p3 started
t=12
t=13
t=14
t=15
p3 terminated
p1 started
t=16
t=17
t=18
t=19
t=20
t=21
p1 terminated

=== results ===
#p0, wait time: 0, termination time: 9
#p1, wait time: 14, termination time: 20
#p2, wait time: 7, termination time: 9
#p3, wait time: 8, termination time: 12

AWT: 7.25
ATT: 12.5
ν”„λ‘œμ„ΈμŠ€ λŒ€κΈ° μ‹œκ°„ λ°˜ν™˜ μ‹œκ°„
p0 0 9
p1 14 20
p2 7 9
p3 8 12
평균 λŒ€κΈ° μ‹œκ°„ 평균 λ°˜ν™˜ μ‹œκ°„
7.25 12.5

About

πŸ—“οΈ 컴퓨터 μ‹œμŠ€ν…œ 일반 탐ꡬ ν™œλ™ - ν”„λ‘œμ„ΈμŠ€ μŠ€μΌ€μ€„λŸ¬ μ•Œκ³ λ¦¬μ¦˜ κ΅¬ν˜„ν•˜κΈ°

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages