
| ์ปดํ์ผ๋ฌ | Source Code -> Object ํ์ผ |
| ๋ง์ปค | ์ฌ๋ฌ Object ํ์ผ๋ค๊ณผ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฐ๊ฒฐํ์ฌ, ๋ฉ๋ชจ๋ฆฌ๋ก ๋ก๋ ๋ ์์๋ ํ๋์ Executable๋ก ๋ณํ. |
| ๋ก๋ | Executable์ ์ค์ ๋ฉ๋ชจ๋ฆฌ์ ์ฌ๋ ค์ฃผ๋ ์ญํ ์ ๋ด๋นํ๋ ์ด์ ์ฒด์ ์ ์ผ๋ถ. |
Object ํ์ผ
ํ๋ก์ธ์ค๋ก ๋ณํ๋๊ธฐ ์ํ ์ ๋ณด๊ฐ ์ฝ์ ๋์ด ์์.
Relocatable Address๋ก ํํ๋จ.
Executable
ํน์ ํ ํ๊ฒฝ (OS)์์ ์ํ๋ ์ ์๋ ํ์ผ.
ํ๋ก์ธ์ค๋ก์ ๋ณํ์ ์ํ header, ์์ ๋ด์ฉ์ธ text, ํ์ํ ๋ฐ์ดํฐ์ธ Data๋ฅผ ํฌํจ.
Absolute Address๋ก ํํ๋จ.
=> ๊ฒฐ๊ณผ๋ฌผ์ด ์ํ๋ OS์ CPU์ ๋ฐ๋ผ ๋ค๋ฅธ ํํ์ ํ์ผ์ ๋ง๋ฆ.
๋ฉ๋ชจ๋ฆฌ์ ์ฌ๋ฆฌ๋ ๊ณผ์

Runtime System
ํ๋ก๊ทธ๋จ๊ณผ ์ฐ๊ฒฐํ์ฌ ์ํธ์์ฉํจ.
ex) Cํ์ผ ์ปดํ์ผ ๋ฐ ์คํ๊ณผ์
ํ๋ก์ธ์ค๋ฅผ ์ด๋ ํ ๊ธฐ์ค์ผ๋ก ์ค๊ณํด์ผ ํ๋ฉฐ, ์ด๋ค ๊ฒ์ด ํ์ํ๊ฐ?!
Abstraction for
Execution Unit (์ค์ผ์ค๋ง์ ๋จ์)
Protection Domain (์๋ก ์นจ๋ฒํ์ง ๋ชปํจ)
Implemented with
Program Counter
Stack
Data Section
(๋์คํฌ์ ์ ์ฅ๋ ํ๋ก๊ทธ๋จ์ผ๋ก๋ถํฐ ๋ณํ๋์ด ๋ฉ๋ชจ๋ฆฌ๋ก ๋ก๋ฉ๋ ๊ฒ - ํ๋ก์ธ์ค)
New : The process is being created
Running: Instructions are being executed
Waiting: The process is waiting for some event to occur (an I/O completion or reception of a signal)
Ready: The process is waiting to be assigned to a processor.
Terminated: The process has finished execution.
์ปค๋ ๋ด์ ready queue, waiting queue, running queue๋ฅผ ๋๊ณ ํ๋ก์ธ์ค๋ค์ ์ํ์ ๋ฐ๋ผ ๊ด๋ฆฌํ๋ค.


cpu slices ๋ฐฉ์์ผ๋ก ์ธํด ๋ํ๋๋ ํ์
CPU switches to a new process, Kernel must save the state of the old process and load the saved states for the new process.
Context switching time is overhead. CPU time slices๋ฅผ ํ ๋นํ ์ ์์.
Context switching time์ ๊ฒฝ์ฐ,
process management์ scheduling ๋ฐฉ์์ ๋ฐ๋ผ,
hardware๊ฐ ์ง์ํ๋ ๊ธฐ๋ฅ, ๋ฐฉ์์ ๋ฐ๋ผ ์ฐจ์ด๊ฐ ์์ ์ ์์.
ํ๋ก์ธ์ ๊ตฌ์กฐ์ ๋ฐ๋ผ ๋ค๋ฅด๋ค.
Process Creation
The processes in the system can execute concurrently, and they must be created and terminated dynamically.
// ์ด์์ฒด์ ๋ง๋ค ๋ค๋ฆ.
- parent process vs. child process
: resource sharing ๋ฐฉ์๊ณผ execution ๋ฐฉ์์ด ์ด์์ฒด์ ๋ง๋ค ๋ค๋ฅด๋ค.
์๋ฅผ ๋ค์ด, Parent๊ฐ Child๋ฅผ ์ ๊ธฐ๋ค๋ฆฌ๊ณ ๋ ๋ฆฝ์ ์ผ๋ก ์ํ๋ ์ ์๋ ๊ฒฝ์ฐ, ์์์ ๊ณต์ ํ์ง ์๋ ๊ฒ ์ข๋ค.
Parent์ ์ข ์์ ์ผ๋ก child๊ฐ ์์ฑ๋๋ ๊ฒฝ์ฐ๋ ๋๋๋ก parent์ ์์์ ๊ณต์ ํ ํ์๊ฐ ์๋ค.
Process Termination
# ์ ์์ ์ผ๋ก ๋๋๋ ๊ฒฝ์ฐ, OS๋ exit system call์ ํตํด ํ๋ก๊ทธ๋จ์ ๋ฉ๋ชจ๋ฆฌ๋ก๋ถํฐ ์ญ์
A process terminates when it finishes executing its final statement and asks the Operating System to delete it by using exit system call.
# return์ ํตํด ๋์จ output data๊ฐ wait์ ํตํด parent๋ก ์ ๋ฌ๋จ.
# ์ ๋ง error์ ์ํด abnormalํ๊ฒ ํ๋ก์ธ์ค๊ฐ ์ข ๋ฃ๋๋ ๊ฒฝ์ฐ.
The abort function causes abnormal process termination to occur.
Independent process cannot affect or be affected by the execution of another process.
์๋๋ ๋ค๋ฅธ process์ ์ํด ๊ด์ฌ๋๋ฉด ์๋์์ง๋ง, ์๋ก ๋ค๋ฅธ ํ๋ก์ธ์ค๋ค์ด ํ๋ ฅํด์ผํ๋ ๊ฒฝ์ฐ
interprocess communication์ ํตํด ์์ ํ๊ฒ ๊ณต์ ๋ ๊ฒ์ ์ ๊ทผํ ์ ์๋๋ก ํ๋ค.
| ๋ฉํฐ์ค๋ ๋ฉ vs ๋น๋๊ธฐ (0) | 2024.12.26 |
|---|---|
| [์ด์์ฒด์ ] ํ๋ก์ธ์ค ์์ฑ (0) | 2024.11.05 |
| [์ด์์ฒด์ ] Lock์ ์ด์ฉํ ๋์์ฑ ์ ์ด (0) | 2024.10.15 |
| [์ด์์ฒด์ ] 8. ์ค๋ ๋ (0) | 2021.03.23 |