Skip to content

Commit

Permalink
Merge pull request #27 from Seogeurim/OperatingSystem/study
Browse files Browse the repository at this point in the history
[OperatingSystem] ์Šคํ„ฐ๋”” ์งˆ๋ฌธ์ •๋ฆฌ
  • Loading branch information
Seogeurim authored Mar 22, 2021
2 parents 92a1c14 + c305919 commit 79b5ea7
Showing 1 changed file with 155 additions and 2 deletions.
157 changes: 155 additions & 2 deletions contents/operating-system/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Operating System (์šด์˜์ฒด์ œ)

> ์ž‘์„ฑ์ž : [๊ถŒํ˜์ง„](https://github.com/KimKwon), [์ด์„ธ๋ช…](https://github.com/3people), [์žฅ์ฃผ์„ญ](https://github.com/wntjq68)
> ์ž‘์„ฑ์ž : [๊ถŒํ˜์ง„](https://github.com/KimKwon), [์œค๊ฐ€์˜](https://github.com/yoongoing), [์ด์„ธ๋ช…](https://github.com/3people), [์žฅ์ฃผ์„ญ](https://github.com/wntjq68)
<details>
<summary>Table of Contents</summary>
Expand Down Expand Up @@ -232,4 +232,157 @@ Example
## ์งˆ์˜์‘๋‹ต
> ์•„์ง ์—†์Šต๋‹ˆ๋‹ค.
<details>
<summary>ํ”„๋กœ๊ทธ๋žจ๊ณผ ํ”„๋กœ์„ธ์Šค์˜ ์ฐจ์ด์— ๋Œ€ํ•˜์—ฌ ์„ค๋ช…ํ•ด๋ณด์„ธ์š”.</summary>
<p>
**ํ”„๋กœ๊ทธ๋žจ**: ์ž‘์—…์„ ์œ„ํ•ด ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” ํŒŒ์ผ์˜ ๋‹จ์œ„๋ฅผ ์˜๋ฏธํ•จ.
**ํ”„๋กœ์„ธ์Šค**: ๋ฉ”๋ชจ๋ฆฌ์— ์ ์žฌ๋˜์–ด ```CPU```๋ฅผ ํ• ๋‹น๋ฐ›์•„ ์‹คํ–‰์ค‘์ธ ํ”„๋กœ๊ทธ๋žจ์„ ํ”„๋กœ์„ธ์Šค๋ผ ์ผ์ปฌ์Œ.
</p>
</details>
<details>
<summary>ํ”„๋กœ๊ทธ๋žจ์ด ์‹คํ–‰์ค‘์ด๋ผ๋Š”๊ฒŒ ์–ด๋–ค ์ƒํƒœ๋ฅผ ๋งํ•˜๋‚˜์š”?</summary>
<p>
`๋ฉ”๋ชจ๋ฆฌ์— ์ ์žฌ๋˜์–ด CPU๋ฅผ ํ• ๋‹น`๋ฐ›์•„ ์‹คํ–‰ ์ค‘์ธ ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰ ์ค‘์ธ ํ”„๋กœ๊ทธ๋žจ ์ด๋ผ๊ณ ํ•จ.
</p>
</details>
<details>
<summary>ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋„์ค‘์— ์ค‘์ง€๋˜๋Š” ๊ฒฝ์šฐ, ๊ทธ ์›์ธ๊ณผ ๋‹ค์‹œ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์€ ๋ฌด์—‡์ผ๊นŒ์š”?</summary>
<p>
`์ธํ„ฐ๋ŸฝํŠธ` ํ˜น์€ `์‹œ์Šคํ…œ ์ฝœ` ๋“ฑ์— ์˜ํ•ด ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ค‘์ง€๋  ์ˆ˜ ์žˆ๋‹ค.
PCB ์•ˆ์— ํ•ด๋‹น ํ”„๋กœ์„ธ์Šค์˜ ์ •๋ณด(ํ”„๋กœ๊ทธ๋žจ์นด์šดํ„ฐ์™€ ๊ฐ™์€ ์‹คํ–‰ ์ •๋ณด ๋“ฑ)๊ฐ€ ์ €์žฅ๋˜์–ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ถ”ํ›„์— ์‹คํ–‰ ๊ฐ€๋Šฅํ•œ ์ƒํƒœ๊ฐ€ ๋˜๋ฉด PCB๋ฅผ ํ†ตํ•ด ๋‹ค์‹œ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค.
</p>
</details>
<details>
<summary>ํ”„๋กœ์„ธ์Šค์— ํž™ ๋˜๋Š” ์Šคํƒ์˜์—ญ์ด ์žˆ๋Š”๋ฐ, ์ด์ค‘์—์„œ ํž™ ๋˜๋Š” ์Šคํƒ์˜์—ญ์—๋Š” ์–ด๋–ค ์ •๋ณด๊ฐ€ ์žˆ๋‚˜์š”?</summary>
<p>
**ํž™ ์˜์—ญ**: ๋™์  ํ• ๋‹น๋˜๋Š” ๋ชจ๋“  ์š”์†Œ๋“ค
**์Šคํƒ ์˜์—ญ**: ๋งค๊ฐœ๋ณ€์ˆ˜, ๋กœ์ปฌ๋ณ€์ˆ˜, ๋ณต๊ท€์ฃผ์†Œ
</p>
</details>
<details>
<summary>์Šค๋ ˆ๋“œ์™€ ๋ฉ€ํ‹ฐ ์Šค๋ ˆ๋“œ์˜ ์ฐจ์ด์— ๋Œ€ํ•˜์—ฌ ์„ค๋ช…ํ•˜๊ณ , ๋ฉ€ํ‹ฐ ์Šค๋ ˆ๋“œ์˜ ์žฅ๋‹จ์ ์„ ์„ค๋ช…ํ•ด๋ณด์„ธ์š”.</summary>
<p>
**์Šค๋ ˆ๋“œ**๋Š” ํ• ๋‹น๋ฐ›์€ ์ž์›์„ ์ด์šฉํ•œ ํ”„๋กœ์„ธ์Šค์˜ ์‹คํ–‰ ํ๋ฆ„์˜ ๋‹จ์œ„์ด๋‹ค.
`๋ฉ€ํ‹ฐ ์Šค๋ ˆ๋“œ`๋Š” ํ•œ ํ”„๋กœ์„ธ์Šค ๋‚ด์—์„œ ์ด๋Ÿฌํ•œ ์Šค๋ ˆ๋“œ๊ฐ€ ์—ฌ๋Ÿฌ๊ฐœ ๋™์ž‘ํ•˜๋Š” ๋ฐฉ์‹์„ ์˜๋ฏธํ•œ๋‹ค.
์Šค๋ ˆ๋“œ๋Š” ํ”„๋กœ์„ธ์Šค ๋‚ด์—์„œ ์Šคํƒ์„ ์ œ์™ธํ•œ ์˜์—ญ์„ ๊ฐ™์€ ํ”„๋กœ์„ธ์Šค ๋‚ด์˜ ์Šค๋ ˆ๋“œ๋“ค๊ณผ ๊ณต์œ ํ•œ๋‹ค.
์ฆ‰ ์ž์›์„ ๊ณต์œ ํ•œ๋‹ค๋Š” ๊ฒƒ์ธ๋ฐ, ์ด๋Š” ์Šค๋ ˆ๋“œ๊ฐ„ `์ž์› ๋™๊ธฐํ™” ๊ด€๋ จ ๋ฌธ์ œ`๋ฅผ ์œ ๋ฐœํ•œ๋‹ค.
๋˜ํ•œ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ข…๋ฃŒ๋˜๋ฉด ๋‚ด๋ถ€ ์Šค๋ ˆ๋“œ๋“ค ์—ญ์‹œ ๋ชจ๋‘ ์ข…๋ฃŒ๋˜๋ฏ€๋กœ ํ•œ ์Šค๋ ˆ๋“œ๊ฐ€ ํ”„๋กœ์„ธ์Šค๋ฅผ ์˜๋„์น˜์•Š๊ฒŒ ์ข…๋ฃŒํ–ˆ์„ ๊ฒฝ์šฐ ๋‚˜๋จธ์ง€ ์Šค๋ ˆ๋“œ๋“ค๋„ ๋ชจ๋‘ ์ข…๋ฃŒ ๋  ์ˆ˜ ์žˆ๋‹ค๋Š” ๋‹จ์ ์ด ์žˆ๋‹ค.
๋ฐ˜๋ฉด ํ”„๋กœ์„ธ์Šค๋ฅผ ์—ฌ๋Ÿฌ๊ฐœ ๋‘๋Š” ๋ฐฉ์‹์— ๋น„ํ•ด ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ๋ฐฉ์‹์€` ์ปจํ…์ŠคํŠธ ์Šค์œ„์นญ ๋น„์šฉ์ด ์ ๊ฒŒ ๋“ค๋ฉฐ ์‘๋‹ต์‹œ๊ฐ„ ์—ญ์‹œ ๋น ๋ฅด๋‹ค`๋Š” ์žฅ์ ์ด ์žˆ๋‹ค.
</p>
</details>
<details>
<summary>๋ฉ€ํ‹ฐ ์Šค๋ ˆ๋“œ์™€ ๋ฉ€ํ‹ฐ ํ”„๋กœ์„ธ์Šค์˜ ์ฐจ์ด๋ฅผ ๋งํ•ด์ฃผ์„ธ์š”.</summary>
<p>
**๋ฉ€ํ‹ฐ ์Šค๋ ˆ๋“œ** : ์ ์€ ๋ฉ”๋ชจ๋ฆฌ ๊ณต๊ฐ„ ์ฐจ์ง€, context switch ๋น ๋ฆ„. ํ•˜์ง€๋งŒ, ๋™๊ธฐํ™” ๋ฌธ์ œ๊ฐ€ ์žˆ๊ณ  ํ•˜๋‚˜์˜ ์Šค๋ ˆ๋“œ๊ฐ€ ์ข…๋ฃŒ๋˜๋ฉด ์ „์ฒด ์Šค๋ ˆ๋“œ๊ฐ€ ์ข…๋ฃŒ๋  ์ˆ˜ ์žˆ์Œ.
**๋ฉ€ํ‹ฐ ํ”„๋กœ์„ธ์Šค** : ํ•˜๋‚˜์˜ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ฃฝ๋”๋ผ๋„ ๋‹ค๋ฅธ ํ”„๋กœ์„ธ์Šค์—๋Š” ์˜ํ–ฅ์„ ๋ผ์น˜์ง€ ์•Š์Œ. ํ•˜์ง€๋งŒ, ๋งŽ์€ ๋ฉ”๋ชจ๋ฆฌ ๊ณต๊ฐ„์„ ์ฐจ์ง€ํ•˜๊ณ  CPU์‹œ๊ฐ„์„ ๋งŽ์ด ์ฐจ์ง€ํ•จ.
</p>
</details>
<details>
<summary>์Šคํƒ์„ ์Šค๋ ˆ๋“œ๋งˆ๋‹ค ๋…๋ฆฝ์ ์œผ๋กœ ํ• ๋‹นํ•˜๋Š” ์ด์œ ๊ฐ€ ๋ฌด์—‡์ธ๊ฐ€์š”?</summary>
<p>
๊ฐ ์Šค๋ ˆ๋“œ๊ฐ€ ๋…๋ฆฝ์ ์ธ ์‹คํ–‰ ํ๋ฆ„ ๋‹จ์œ„๋ฅผ ๊ฐ€์ง„๋‹ค๋Š” ๊ฒƒ์—์„œ ์œ ์ถ”ํ•  ์ˆ˜ ์žˆ๋‹ค.
์Šค๋ ˆ๋“œ๊ฐ€ ๋…๋ฆฝ์ ์ธ ์‹คํ–‰ ํ๋ฆ„์„ ๊ฐ–๊ธฐ์œ„ํ•ด์„œ๋Š” `๋…๋ฆฝ์ ์ธ ํ•จ์ˆ˜ํ˜ธ์ถœ์ด ๋ณด์žฅ`๋˜์–ด์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.
</p>
</details>
<details>
<summary>Context Switching์— ๋Œ€ํ•˜์—ฌ ์„ค๋ช…ํ•ด๋ณด์„ธ์š”.</summary>
<p>
์œ„์—์„œ ๋งํ–ˆ๋“ฏ์ด ํ”„๋กœ์„ธ์Šค๋Š” CPU๋ฅผ ํ• ๋‹น๋ฐ›์€ ์ƒํƒœ์˜ ํ”„๋กœ๊ทธ๋žจ์ด๋‹ค.
ํ˜„์žฌ CPU๋ฅผ ํ• ๋‹น๋ฐ›์•„ ์‹คํ–‰์ค‘์ธ ํ”„๋กœ์„ธ์Šค A์™€ ๋Œ€๊ธฐ์ค‘์ธ ํ”„๋กœ์„ธ์Šค B๊ฐ€ ์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ–ˆ์„ ๋•Œ,
A ํ”„๋กœ์„ธ์Šค์—์„œ B ํ”„๋กœ์„ธ์Šค๋กœ CPU ์‚ฌ์šฉ/์ œ์–ด๊ถŒ์ด ์ด์ „๋˜๋Š” ๊ฒƒ์„ `Context Switching` ์ด๋ผ๊ณ ํ•œ๋‹ค.
</p>
</details>
<details>
<summary>์Šค์ผ€์ฅด๋ง์ด ์™œ ํ•„์š”ํ•œ๊ฐ€์š”?</summary>
<p>
ํ•œ์ •์ ์ธ ๋ฉ”๋ชจ๋ฆฌ(์ž์›)๋ฅผ ํšจ์œจ์ ์œผ๋กœ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด, ๊ณต์ •์„ฑ์„ ์ฃผ๊ธฐ ์œ„ํ•ด ํ•„์š”ํ•˜๋‹ค.
</p>
</details>
<details>
<summary>์Šค์ผ€์ค„๋Ÿฌ์™€ CPU ์Šค์ผ€์ค„๋Ÿฌ์˜ ์ฐจ์ด์— ๋Œ€ํ•˜์—ฌ ์„ค๋ช…ํ•ด๋ณด์„ธ์š”.</summary>
<p>
์Šค์ผ€์ค„๋Ÿฌ(=Job Scehduler, ์žฅ๊ธฐ ์Šค์ผ€์ค„๋Ÿฌ)๋Š” ๋””์Šคํฌ์™€ ๋ฉ”๋ชจ๋ฆฌ ๊ฐ„ ์Šค์ผ€์ค„๋ง์„ ๋‹ด๋‹นํ•œ๋‹ค.
CPU ์Šค์ผ€์ฅด๋Ÿฌ(= ๋‹จ๊ธฐ ์Šค์ผ€์ค„๋Ÿฌ)๋Š” ๋ฉ”๋ชจ๋ฆฌ์™€ CPU ๊ฐ„ ์Šค์ผ€์ค„๋ง์„ ๋‹ด๋‹นํ•œ๋‹ค.
</p>
</details>
<details>
<summary>์ค‘๊ธฐ ์Šค์ผ€์ฅด๋Ÿฌ์—์„œ suspended ์ƒํƒœ์™€ blocked ์ƒํƒœ์˜ ๋‹ค๋ฅธ์ ์€ ๋ฌด์—‡์ธ๊ฐ€์š”?</summary>
<p>
blocked ์ƒํƒœ๋Š” ๋‹ค๋ฅธ I/O ์ž‘์—…์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์ƒํƒœ์ด๊ธฐ ๋•Œ๋ฌธ์— ์Šค์Šค๋กœ ready queue๋กœ ๋Œ์•„๊ฐˆ์ˆ˜ ์žˆ์ง€๋งŒ, suspended๋Š” ์™ธ๋ถ€์ ์ธ ์ด์œ ๋กœ ์œ ์˜ˆ๋๊ธฐ ๋•Œ๋ฌธ์— ์Šค์Šค๋กœ ๋Œ์•„๊ฐˆ ์ˆ˜ ์—†๋‹ค.
</p>
</details>
<details>
<summary>FCFS ์Šค์ผ€์ค„๋ง์„ ๊ฐœ์„ ํ•œ ์Šค์ผ€์ค„๋ง ๋ฐฉ์‹์— ๋Œ€ํ•˜์—ฌ ์„ค๋ช…ํ•ด๋ณด์„ธ์š”.</summary>
<p>
FCFS๋Š” ๋จผ์ € ๋„์ฐฉํ•œ ํ”„๋กœ์„ธ์Šค์—๊ฒŒ CPU๋ฅผ ํ• ๋‹นํ•˜๋Š” ๊ธฐ๋ฒ•์ด๋‹ค.
ํ•˜์ง€๋งŒ ๋จผ์ € ๋„์ฐฉํ•œ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์‹คํ–‰ ์‹œ๊ฐ„์ด ๊ธด ๊ฒฝ์šฐ ๋‚˜์ค‘์— ๋„์ฐฉํ•œ ํ”„๋กœ์„ธ์Šค๋“ค์˜ ๋Œ€๊ธฐ ์‹œ๊ฐ„์ด ๊ธธ์–ด์ง€๋Š” ```Convoy Effect``` ๋ผ๋Š” ๋ฌธ์ œ์ ์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค.
์ด๋ฅผ ๊ฐœ์„ ํ•œ `SJF(Shortest Job First)` ๊ธฐ๋ฒ•์ด ์žˆ๋‹ค.
SJF๋Š” ์งง์€ ์‹คํ–‰์‹œ๊ฐ„์„ ๊ฐ–๋Š” ํ”„๋กœ์„ธ์Šค์—๊ฒŒ CPU๋ฅผ ๋จผ์ € ํ• ๋‹นํ•˜๋Š” ๊ธฐ๋ฒ•์ด๋‹ค.
Convoy Effect๋Š” ํ•ด๊ฒฐํ•˜์˜€์ง€๋งŒ, ์‹คํ–‰์‹œ๊ฐ„์ด ๊ธด ํ”„๋กœ์„ธ์Šค๋Š” ๊ณ„์† CPU๋ฅผ ํ• ๋‹น๋ฐ›์ง€ ๋ชปํ•˜๋Š” `Starvation ํ˜„์ƒ`์ด ์ผ์–ด๋‚  ์ˆ˜ ์žˆ๋‹ค.
</p>
</details>
<details>
<summary>Round Robin ์Šค์ผ€์ค„๋ง ๋ฐฉ์‹์—์„œ time quantum ์„ค์ •์— ๋”ฐ๋ฅธ ๊ฒฐ๊ณผ๋ฅผ ์„ค๋ช…ํ•ด๋ณด์„ธ์š”.</summary>
<p>
RR ๊ธฐ๋ฒ•์—์„œ
- ํƒ€์ž„ํ€€ํ…€์ด ๊ธด ๊ฒฝ์šฐ: ํƒ€์ž„ํ€€ํ…€์ด ํ”„๋กœ์„ธ์Šค์˜ ์‹คํ–‰์‹œ๊ฐ„๊ณผ ๋น„์Šทํ•ด์ง„๋‹ค๋ฉด FCFS๋ž‘ ๋‹ค๋ฅผ ๋ฐ” ์—†์–ด์ง„๋‹ค.
- ํƒ€์ž„ํ€€ํ…€์ด ์งง์€ ๊ฒฝ์šฐ: ํƒ€์ž„ํ€€ํ…€์ด ์งง์•„ Context Switching์ด ์ž์ฃผ ์ผ์–ด๋‚˜๊ฒŒ ๋˜์–ด ์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค.
</p>
</details>
<details>
<summary>์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ ์–ด๋–ค๊ฑด๊ฐ€์š”?</summary>
<p>
ํ”„๋กœ๊ทธ๋žจ์˜ ์‹คํ–‰ ํ๋ฆ„ ๋„์ค‘์— ๋™๋–จ์–ด์ง„ ์œ„์น˜์˜ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰์‹œ์ผœ์•ผ ํ•  ๋•Œ, ์ถ”๊ฐ€์ ์œผ๋กœ ์‹œ๊ฐ„, ๋ฉ”๋ชจ๋ฆฌ, ์ž์›์ด ์‚ฌ์šฉ๋˜๋Š” ํ˜„์ƒ์„ ์˜ค๋ฒ„ํ—ค๋“œ๋ผ ํ•œ๋‹ค.
</p>
</details>

0 comments on commit 79b5ea7

Please sign in to comment.