๐ Major Study (Bachelor)/๐ง Operating System [OS / ์ด์์ฒด์ ] Process State, Ready / Running State, Process Control Block, Process Scheduling by UKHYUN22 2022. 3. 21. 728x90 Interrupt Hanlder๋ฅผ ํธ์ถํ๋ ์๊ฐ kernel mode๋ก ์ ํ๋๋ ๊ฒ์ด๋ค. size์ ํ์ ์ long ์ผ๋ก ๋ฐ๊ฟ ๊ฒ Processses ์คํ ์ค์ธ ํ๋ก๊ทธ๋จ์ ๋งํ๋ค. ์คํ์ ํ์ํ ๋ชจ๋ ๋ฆฌ์์ค๋ ํฌํจ๋๋ค. ์ฝ๋๋ค์ Instruction๋ค์ Sequence๋ฅผ ์๋ฏธํ๋ค. ์ฝ๋๊ฐ ์คํ๋๋ฉด ์ค๊ฐ์ ํ์ํ ๋ฐ์ดํฐ๋ค์ด ์กด์ฌํ๋ ๋ฐ ๊ทธ๊ฒ๋ค๋ ํ๋ก์ธ์ค์ ํฌํจ๋๋ค. ํ๋ก๊ทธ๋จ์ ์คํํ๋ค๊ฐ CPU๋ฅผ ์ฌ์ฉํ๊ณ ๋ ๋์ง์คํฐ๋ฅผ ๊ณ์ํด์ ์ฌ์ฉํ๋ค. Instruction Resgister๋ก Instruction์ ๊ฐ์ ธ์ค๊ฒ ๋๋ค. ํ์ํ๋ฉด ๋ฉ๋ชจ๋ฆฌ์ ์๋ ๋ฐ์ดํฐ๋ฅผ ๋์ง์คํฐ๋ก ๊ฐ์ ธ์์ ์ฒ๋ฆฌ๋ฅผ ํ๊ฒ ๋๋ค. ํ๋์จ์ด์ ์ ์ฅ์์ ๋ณด๋ฉด ๋ฆฌ์์ค์ ํด๋นํ์ง๋ง ๋์ง์คํฐ์ ๊ฐ๋ค์ ํ๋ก์ธ์ค์ ํด๋นํ๋ค. Process State ์ฒ์ Process๊ฐ ๋ง๋ค์ด์ง๋ ์ํ๋ฅผ New State๋ผ๊ณ ๋ถ๋ฅธ๋ค. New๋ผ๋ ๊ฒ์ ํ์ฌ ๋ง๋ค์ด์ง๊ณ ๋ฏธ์์ฑ์ด ๋จ๊ณ๋ฅผ New State๋ผ๊ณ ํ๋ค. ์ผ๋จ ์์ฑ์ด ๋๋ฉด Ready Queue๋ก ์ด๋ํ๊ฒ ๋๋ค. Ready State์ Running state๊ฐ ์๋ค. Ready Queue ์ค ํ๋๋ฅผ ์ ํํ๋ ๊ฒ์ด Scheduler์ด๋ค. Running state์ ๊ฒฝ์ฐ Timer๋ผ๋ ๊ฒ์ด ์กด์ฌํ๋ค. ์ผ์ ํ ์๊ฐ์ด ์ง๋๊ฐ๋ฉด Interrupt๊ฐ ๋ฐ์ํ๋ค. ์ด ์ํฉ์์๋ Interrupt handler๊ฐ Scheduler๋ฅผ ์คํ์ํจ๋ค. running ์ํ์์ IO๋ฅผ ์ฌ์ฉํ๊ณ ์ถ์ ๊ฒฝ์ฐ ๋ฐ๋ก ์ฌ์ฉํ์ง ๋ชปํ๋ค. ๋๊ตฐ๊ฐ ์ฌ์ฉํ๊ณ ์์ ์ ์๋ค. IO๊ฐ ๋๋ ๋๊น์ง๋ ๊ธฐ๋ค๋ ค์ผ ํ๋ค. ๊ทธ ์ํ๋ฅผ waiting state๋ผ๊ณ ๋ถ๋ฅธ๋ค. wait System call์ด ๋ํ์ ์ธ ์์ด๋ค. waiting state๋ CPU๋ฅผ ์ฌ์ฉํ์ง ์๋๋ค. Ready state๋ ์คํํ ์ค๋น๊ฐ ๋ค ๋์ด์๋ ์ํ์ด๊ณ Waiting state๋ CPU Time์ด ์ฃผ์ด์ ธ๋ ์คํํ ์ ์๋ ๊ฒ์ด ์ฐจ์ด์ ์ด๋ค. exit์ ํ๋ฉด terminated๊ฐ ๋๋๋ฐ ์ terminated ์ํ๋ฅผ ๋ง๋๋ ๊ฒ์ผ๊น?? ์ด๋ ์์ ํ ๊ฒฐ๊ณผ๋ฌผ์ ํด๋นํ๋ ๊ฒ์ด๋ค. ์๊ธฐ ํ ์ผ์ ๋ํ ๊ฒฐ๊ณผ๋ฅผ ๋จํํ ์ฃผ์ง ์์ ์ํ์ด๋ค. CPU Time์ ๋ ์ด์ ํ ๋นํ์ง ์๋ ์ํ๋ฅผ ์๋ฏธํ๋ค. ์ฃฝ์์ง๋ง ์ ์ธ์ฅ์ด ์ ๋ฌ๋์ง ์์ ์ํ(๋น์ ) Ready / Running State running๋๋ ๊ฒ์ ์ง์ง CPU์์ ๋์๊ฐ๊ณ ์๋ค. ๊ทธ๋ผ ๋๋จธ์ง N-1๊ฐ์ ํ๋ก์ธ์ค๋ ๊ธฐ๋ค๋ฆฌ๊ณ ์๋ค. Ready Queue๋ผ๋ ๊ณณ์์ ๊ธฐ๋ค๋ฆฌ๊ณ ์๋ค. ๊ทธ๋ค์ Ready State๋ผ๊ณ ๋ถ๋ฅธ๋ค. Process Control Block PCB์๋ ํ๋ก์ธ์ค๋ฅผ ๊ด๋ฆฌํ๋ ๋ชจ๋ ์ ๋ณด๊ฐ ๋ค ์ ์ฅ๋๋ค. CPU Register์ ๊ฐ๋ค์ด (Value)๋ค์ด ์กด์ฌํ๋ค. Process Scheduling ์ด ๋ฆฌ์์ค๋ฅผ ํ๋ก์ธ์คํํ ๋ฐฐ์ ํด์ฃผ๋ ๊ฒ์ ๋งํ๋ค. Scheduling์ ๋ณธ์ง์ ์ ํํ๋ ์ญํ ์ด๋ค. ๋์์ด ๋๋ ์์์ด CPU์ผ ๋ Process Scheduling ์ด๋ผ๊ณ ๋ถ๋ฅธ๋ค. ์ด๊ฒ์ด ์ถ๊ตฌํ๋ ๋ฐ๋ ์ฒซ์งธ๋ก CPU๊ฐ ์ฌ์ง ์๊ณ ํจ์จ์ ์ต๋ํ ๋๋ฆฌ๋ ๊ฒ์ด๋ค. ๋ ๋ฒ์งธ๋ก ์ฌ์ฉ์๋ค์ด ๊ฐ์ ์๊ธฐ ํ๋ก๊ทธ๋จ๊ณผ Interact ํ๊ฒ ๋ง๋๋ ๊ฒ์ด๋ค. Time sharing, switching์ ๋น ๋ฅด๊ฒ ํ๋ ๊ฒ์ ์๋ฏธํ๋ค . ๊ณต์ ํ๊ธฐ ๊ฒ์๊ธ ๊ด๋ฆฌ HU's BloG ์ ์์ํ์ '๐ Major Study (Bachelor) > ๐ง Operating System' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ [OS / ์ด์ ์ฒด์ ] Process Termination, IPC, Shared Memory Segment, Producer Consumer Problem, Message Passing Systems, System 5 (0) 2022.03.28 [OS / ์ด์ ์ฒด์ ] Scheduling Queue, PCB in Linux, Scheduling Queue, Queue Diagram, Context Switch, Process Creation, Process Creation in UNIX (0) 2022.03.24 [OS / ์ด์์ฒด์ ] Monolithic Structure, Layered Approach, Microkernels, Modules, Android, Virtual Machine (0) 2022.03.17 [OS / ์ด์์ฒด์ ] Command Line Interpreter, Programming Interfaces, Dual Mode Operation, Dual Mode Operation, System call, Process Control: Load/Execution, FreeBSD Unix, MS-DOS, Device Management, System Programs (0) 2022.03.14 [OS / ์ด์์ฒด์ ] Timesharing, Virtual Memory, Dual Mode Operation, Thread, Memory Management (0) 2022.03.10 ๊ด๋ จ๊ธ [OS / ์ด์ ์ฒด์ ] Process Termination, IPC, Shared Memory Segment, Producer Consumer Problem, Message Passing Systems, System 5 [OS / ์ด์ ์ฒด์ ] Scheduling Queue, PCB in Linux, Scheduling Queue, Queue Diagram, Context Switch, Process Creation, Process Creation in UNIX [OS / ์ด์์ฒด์ ] Monolithic Structure, Layered Approach, Microkernels, Modules, Android, Virtual Machine [OS / ์ด์์ฒด์ ] Command Line Interpreter, Programming Interfaces, Dual Mode Operation, Dual Mode Operation, System call, Process Control: Load/Execution, FreeBSD Unix, MS-DOS, Device Management, System Programs