๐ Major Study (Bachelor)/๐ง Operating System [OS / ์ด์์ฒด์ ] Monolithic Structure, Layered Approach, Microkernels, Modules, Android, Virtual Machine by UKHYUN22 2022. 3. 17. 728x90 kernel์ structure๋ฅผ ๊ตฌ์ฑํ๋ ๋ฐฉ๋ฒ์๋ ์ฌ๋ฌ๊ฐ์ง๊ฐ ์๋ค. Monolithic Structure ๋ชจ๋ ๊ธฐ๋ฅ์ด ํ๋์ ๋ฉ์ด๋ฆฌ์ ๋ค์ด๊ฐ์๋ ๊ตฌ์กฐ. ๊ต์ฅํ ์ค์ํ ์ฅ์ ์ ์๋์ด๋ค. ๋ชจ๋ธ๊ฐ์ Interface overhead๊ฐ ๊ฑฐ์ ์๋ค. 1973๋ Original UNIX๊ฐ ๋ํ์ ์ธ ์์ด๋ค. Linux๋ ๋ค์๊ณผ ๊ฐ์ ๋ฐฉ๋ฒ์ ์ ํํ๊ณ ์๋ค. Monolithic Structure ๋ ผ๋ฆฌ์ ์ผ๋ก ๊ตฌ์ญํ๊ฐ ๋์ด์์ง๋ง ํ ๋ชจ๋ ์์ ๋ค ๋ค์ด๊ฐ์๋ ๊ฒ์ ๋ณผ ์ ์๋ค, Layered Approach ๊ตฌ์กฐํ ์ํค๋ ๋ฐฉ๋ฒ ์ค ํ๋. Computer System์ ์ฌ๋ฌ ๊ฐ์ง ๊ณ์ธต์ผ๋ก ๊ตฌ์ฑํ๋ ๋ฐฉ์. ๊ฐ์ฅ ๊ฐ์ด๋ฐ์ Hardware๊ฐ ์๊ณ Layer1์๋ ๊ฐ์ฅ ๊ธฐ๋ณธ์ ์ธ ๊ธฐ๋ฅ๋ค์ด ๊ตฌํ๋์ด์๋ค. ๊ทธ๊ฒ๋ค์ ๋ฐํ์ผ๋ก layer2๋ฅผ ๊ตฌ์ฑํ๋ ๋ฐฉ์์ผ๋ก ๊ณ์ ์งํ์ด ๋๋ค. ๋ชจ๋ layer๋ ์๊ธฐ๋ณด๋ค ๋ฐ์ ์ชฝ Layer์ ๊ธฐ๋ฅ์ ์ฌ์ฉํ ์ ์์ง๋ง ๊ทธ ์ญ์ ์ฑ๋ฆฝํ์ง ์๋๋ค. Layered Approach ๋๋ฒ๊น ํ๋ ๋ฐ์ ๊ต์ฅํ ํธ๋ฆฌํ๋ค. N ๋ฒ์งธ Layer์ ์๋ฌ๊ฐ ๋ฐ์ํ๋ฉด ๊ทธ๊ณณ์๋ง ์ง์คํ๋ฉด ์ฐพ๊ธฐ ์ฌ์ธ ์ ์๋ค. ์์ ๋ณด๋ค Low level์ด๊ฑฐ๋ high level layer๋ฅผ ์ ๊ฒฝ ์ธ ํ์๊ฐ ์ ํ ์๋ค. Layered Approach ๋ ๊ฐ์ง์ ๋ชจ๋์ด ์์ ๋ ์ด๋ ๋ชจ๋์ ์๋์ ๋์ง ์์ ๋ ์ง๋ฅผ ๊ฒฐ์ ํด์ผ ํ๋ค. Backing Store์ ๊ธฐ๋ฅ์ Memory manager๊ฐ ์ฌ์ฉํ๊ฒ ๋๋ค. ๊ฒฝ์ฐ์ ๋ฐ๋ผ์ ๋ชจ๋ ๊ฐ์ ๊ณ์ธต ๊ตฌ์กฐ๋ฅผ ๊ฒฐ์ ํ๊ธฐ ํ๋ ๊ฒฝ์ฐ๊ฐ ์๋ค. ์๋ฅผ ๋ค์ด Backing Store driver์ CPU scheduler๊ฐ ์๋ค. Layered Approach ํจ์จ์ ์ด์ง ๋ชปํ๋ค๋ ๊ฒ. ์์์ ์ฌ์ฉ์๊ฐ ์ด์ฉ์ ํ๋ฉด call์ด ๊ณ์ ์ด๋ฃจ์ด์ง๋๋ฐ Performance์ ์์ค์ด ์ด๋ฃจ์ด์ง๋ค. Layer๋ฅผ ํผ์งํผ์ง ํ๊ฒ ์๋ผ์ ๋ฐ๋ณต๋๋ call์ ์ค์ด๋ฉด ์ข์ ๊ฒ์ด๋ผ๋ ์๊ฒฌ์ด ์๋ค. ํ์ง๋ง ์ด๋ฌ๋ฉด Layer์ ์ฅ์ ์ด ์์ด์ง ์ ์๋ค. Microkernels ์ด์ ์ฒด์ ์์ kernel์ ์ ๋ถ์ ๊ฐ์ ์ญํ ์ ํ๋๋ฐ, kernel์ ์์ ์๋ก ์ข๋ค๋ ๊ฒ์์ ์์ํ๋ค. kernel์ kernel mode์์ ๋์์ ํ๋๋ฐ ๋ฐ๋ผ์ kernel mode์ Bug์ธ ์ฝ๋๊ฐ ๋์๊ฐ๋ฉด System ์ ์ฒด๊ฐ ํผํด๋ฅผ ๋ฐ๊ฒ ๋๋ค. ์ ๋ง ํต์ฌ์ ์ด๊ณ Preveledge๊ฐ ํ์ํ ๊ธฐ๋ฅ์ด ์๋๋ฉฐ ๋ค user mode๋ก ๋ณด๋ด์๋ ๊ฒ์ด๋ค. ๋๋ถ๋ถ์ ๊ธฐ๋ฅ์ User mode์ ์์นํด๋๊ฒ ๋ง๋ค์๋ค. Application์ด Request๋ฅผ ๋ณด๋ด๋ ๊ฒฝ์ฐ๋ฅผ ์ดํด๋ณด์. Message Passing Mechanism์ ํตํด์ kernel์ด Message๋ฅผ ๋ฐ์์ ์ฒ๋ฆฌ๋ฅผ ํ๊ณ ์๋ Applicationํํ ๋๋ ค๋ณด๋ด๋ ์ญํ ์ ํ๋ค. Server๋ ๋ฌผ๋ก ์๋น์ค๋ฅผ ์ ๊ณตํ์ง๋ง user mode์ด๊ณ kernel ์ ์ ๋ฌ์ ์ญํ ์ ํ๋ค. ์ฆ, Communication ์ด ์ค์ํ ์ญํ ์ ํ๋ค๋ ๊ฒ์ด๋ค. Interprocess Communication์ Kernel mode์์ ๋ค์ด์์ผ ํ๋ ํต์ฌ ๊ธฐ๋ฅ์ธ ๊ฒ์ด๋ค. Microkernels ํต์ฌ ๊ธฐ๋ฅ์ด๋ผ๊ณ ๋งํ ์ ์๋ ๊ฒ๋ค์ ๋ฌด์์ด ์๋๊ฐ. management์ communication ๊ธฐ๋ฅ์ด ํต์ฌ ๊ธฐ๋ฅ์ด ๋๋ค. System call์ด ๋ณดํต Message passing์ ์ํด์ ์ด๋ฃจ์ด์ง๋ค. Microkernel์ ๊ฐ์ฅ ํฐ ๋จ์ ์ผ๋ก Performance ์ ํ๋ฅผ ๋ฝ์ ์ ์๊ฒ ๋๋ค. MicroKernel ์์ ์๋ message passing์ ๋น ๋ฅธ ์๋๋ก ์ฒ๋ฆฌํ ์ ์๋๋ก ๊ตฌํ์ ํ๊ณ ์๋ ์ค์ด๋ค. Microkernel Portingํ๊ธฐ ์ข๊ณ , ํ์ฅํ๊ธฐ ํธํ๋ค๋ ๊ฒ์ด๋ค. usermode ์ Process๋ฅผ ์ถ๊ฐํ๋ฉด ๋๋ค๋ ๊ฒ์ด๋ค. Kernel์ ๊ณ ์น์ง ์์๋ ๊ธฐ๋ฅ์ ์ถ๊ฐํ ์ ์๋ค๋ ๊ฒ์ด๋ค. System์์ System์ผ๋ก ์ด๋ํ ๋ Porting์ด ํธํด์ง๋ค. ์ฌ๋ฌ๊ฐ์ง ์๋น์ค๋ฅผ User level์์ ์คํํ๊ธฐ ๋๋ฌธ์ ์์คํ ์ ์ฒด์ ์ํฅ์ ์ ๊ฒ ๋ฐ์ ์์ ํ๋ค๋ ์ ์ด ์๋ค. ๋จ์ ์ผ๋ก๋ Performance decrease ๊ฐ ๋๋ค๋ ์ ์ด๋ค. Modules LKM, Monolity kernel์ ์ ์ฐ์ฑ์ ๊ฐํํ๊ธฐ ์ํด ๋ง๋ค์ด์ก๋ค. Monolity kernel์ ๋จ์ ์ค ํ๋๊ฐ ํ์ฅ์ฑ์ด๋ค. ํ์ฅ์ฑ์ ์ํด ๋ง๋ค์ด์ง ๊ตฌ์กฐ๊ฐ Loadable kernel module ์ธ ๊ฒ์ด๋ค. Microkernel๊ณผ ๋น์ทํ์ง๋ง Loadable kernel ๋ชจ๋๋ ๋ชจ๋๋ค kernel mode์์ ๋์๊ฐ๋ค๋ ์ฐจ์ด์ ์ด ์๋ค. ์ง์ Preveledge Instruction์ ์ด์ฉํด์ ๊ตฌํ์ ํ ์ ์๋ค. ๋ํ ํจ์ฌ ๋ ๋น ๋ฅด๊ณ ์ฌ์ด Interface๋ฅผ ์ฌ์ฉํ ์ ์๋ค๋ ๊ฒ์ด๋ค. ๋น ๋ฅธ ์๋๋ฅผ ์ ์งํ๋ฉด์ ์ ์ฐ์ฑ์ ๋ณด๊ฐํ ์ ์๋ค๋ ์ ์ด ์๋ค. OS๊ฐ Bootingํ๊ณ ์๋ ๋์์๋ ์ค์น๋๊ฑฐ๋ ์ ๊ฑฐ๋ ์ ์๋ค, ์ด๋ฐ kernel์ ์ด์ฉํ๋ ๊ณณ์ Device Driver ๋ถ๋ถ์ด๋ค. LKM์ผ๋ก ์ ๊ณตํ๋ฏ๋ก ์จ ํ์ฌ ์๋ Device์ Driver๋ฅผ ์ค์นํ ์ ์๋๋ก ํ๋ ๊ฒ์ด๋ค. Shutdown ํ์ง ์๊ณ ๋ ์ค์น๋ฅผ ํ ์ ์๊ณ ๋์๊ฐ๋ kernel ์์ Dynamic ํ๊ฒ ๋ถ์ ์ ๋ ์๋ค. Modules core ์๋น์ค๋ฅผ ๋ค ๊ฐ์ง๊ณ ์์ผ๋ฉด์ dynamicํ๊ฒ ์ถ๊ฐํ๊ฑฐ๋ ์ ๊ฑฐํ ์ ์๋ค. Layered Structure์๋ ๋ฌ๋ฆฌ ์กฐ๊ธ ๋ Flexibleํ๋ค๋ ๊ฒ์ด๋ค. Micro Kernel์ user level์์ ๋์๊ฐ์ง๋ง UKL์ ๊ฒฝ์ฐ kernel mode์์ ๋์๊ฐ๋ค. Hybrid System ์ฌ๋ฌ๊ฐ์ง Structure์ ์ฅ์ ์ ๋ชจ์์ ์ฌ์ฉํ๊ณ ์๋ ๊ฒ์ด ์๋ค. ์๋ฅผ ๋ค์ด Linux์ Solaris๋ Mono์ ๋น ๋ฅธ ๊ฒ์ ์ฅ์ ์ ํ์ฉํ๊ณ Modular๋ฅผ ํตํด ํ์ฅ์ฑ์ ์ทจํ๊ณ ์๋ค. ์ด๋ฐ ๋ณตํฉ์ ์ธ ๋ชจ๋์ด ๋ฑ์ฅํ๊ณ ์๋ค, MacOS, iOS MacOS๋ ๋ฐ๋ฅ์ OS๊ฐ ๋ค์ด๊ฐ ์๋ค. Darwin์ด๋ผ๋ kernel ํ๊ฒฝ์ด ์๋ค. ๊ทธ ์์ core framework๋ Quicktime ๋์์ ํ๋ ์ด์ด๋ OpenGL Graphics Library๊ฐ ์ถ๊ฐ๋์ด์๋ค. application์ ๊ฒฝ์ฐ Swift ํ๋ก๊ทธ๋๋ฐ ์ธ์ด์ Cocoa, Cocoa Touch๋ฅผ ํ๋ ์ ์ํฌ๋ฅผ ์ฌ์ฉํ๊ณ ์๋ค,. macOS, iOS kenel์ ๋ฐ๋ฅ์๋ Mach Kernel์ด ์๊ณ ๊ทธ ์์ BSD Unix์ ๊ธฐ๋ฅ์ ์ฌ์ฉํ๊ณ ์๋ค. Android ๊ฐ์ฅ ์๋ Hardware๊ฐ ์๊ณ , Linux ์ kernel๋ฅผ ๋ณํํด์ ์ฌ์ฉํ๊ณ ์๋ค. ๊ทธ ์์ Bionic layer๊ฐ ์๋ค. ์ด๋ unix์ glibc๋ฅผ ์ ์ฅํ๊ณ ์ ๊ณตํ๋ Library์ ๋ชจ๋ฐ์ผ ๋ฒ์ ์ด๋ผ๊ณ ํ ์ ์๋ค. ๊ธฐ๋ณธ์ ์ธ C์ function์ ์ ๊ณตํ๋ layer๊ฐ Bionic layer์ด๋ค. HAL, HardWare Abstraction Layer Device๋ง๋ค ๊ฐ์ง๊ณ ์๋ Hardware๊ฐ ๋ค๋ฅด๊ธฐ ๋๋ฌธ์ ์ฌ๋ฌ๊ฐ์ง์ Hardware๋ฅผ Abstraction์ ํตํด์ ํ๋์ ํต์ผ๋ Interface๋ฅผ ์ ๊ณตํ๊ณ ์๋ค. Virtual Machine ํ์ฌ host ์์ ๊ฐ์์ ์ปดํจํฐ๋ฅผ ๋ง๋ค์ด์ ์ธ๋ถ์ ๋ถ๋ฆฌ๋ ๊ฐ์ ํ๊ฒฝ์ ๋ง๋ค์ด์ฃผ๋ ๊ฒ์ ์๋ฏธํ๋ค. Virtual Machines ์ผ๋ฐ์ ์ธ OS๋ ์ผ์ชฝ๊ณผ ๊ฐ๋ค. Hardware๊ณผ kernel ๊ทธ ์์ Process(user mode)๊ฐ ์กด์ฌํ๋ค. Virtual์ ๊ฒฝ์ฐ ์ค๋ฅธ์ชฝ ์ฌ์ง์ฒ๋ผ VM์ด ๋ค์ด๊ฐ๊ฒ ๋๋ค. VM์ด ๊ฐ๊ฐ์ Virtual์ ๋ง๋ค์ด๋ด๊ฒ ๋๋ค. ๊ฐ๊ฐ Hardware ์ kernel์ด ๋์๊ฐ๋ค. Virtual Machine ๊ฐ Machine ๋ณ๋ก CPU์ ๋ฉ๋ชจ๋ฆฌ๊ฐ ์๋ค๊ณ ์ฐฉ๊ฐํ๊ณ ๋์๊ฐ๊ฒ ๋๋ค. HOST CPU๊ฐ ํ๋์ virtual์ ๊ฐ์ง๊ณ ์๋ค๊ณ ํด๋ณด์. scheduling์ time machine์ ์ํด์ ๋์์ ์ฌ์ฉํ๊ณ ์๋ ๋ฏํ ์ฐฉ๊ฐ์ ์ค ์ ์๋ค. VM์ ๋ฉ๋ชจ๋ฆฌ๋ Host์ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ด์ฆ์ ์ํฅ์ ์ ๋ฐ์ง ์๋๋ค. ํ์ง๋ง Disk์ ๊ฒฝ์ฐ ์ ํ์ ๋ฐ๋๋ค. Virtual Machine์ Host๋ณด๋ค ๋์คํฌ๊ฐ ์์ ์ ๋ฐ์ ์๋ค. Virtual Disk๋ Host์์ ํ์ผ ํ๋์ ํด๋นํ๊ฒ ๋๋ค. ๋ง์ ๊ฒฝ์ฐ Virtual Disk๋ ์ฌ์ด์ฆ๋ฅผ ์ ์ธํ๊ณ ๋ค๋ฅธ ๊ฒ๋ค์ Host์ ๋์ผํ ์ฑ๋ฅ์ ์ ๊ณตํ๋ค. Virtual Machine Host HardWare์ ๋๊ฐ์ ๊ฐ์ํ๊ฒฝ์ ์ ๊ณตํ ์ ์๋ค. Dual Mode operation์ ๊ฒฝ์ฐ ๋ฌธ์ ๊ฐ ์๊ธด๋ค. kernel์์๋ง preveledge๋ฅผ ์คํ์ํฌ ์ ๋ฐ์ ์๋ค. ์ด์ ๊ฐ์ด Virtual๋ user์ kernel mode ๋ ๋ค ์กด์ฌํด์ผ ํ๋ค ํ์ง๋ง Virtual์ด user mode ์์ ์กด์ฌํ๋ค๋ ๋ฌธ์ ๊ฐ ์๋ค. Virtual์ kernel์ด user mode์ ์๋ค๋ ๊ฒ์ด๋ค. Virtual Machine ์ฅ์ , ์ธ๋ถ์ ์ฐจ๋จ๋ ํ๊ฒฝ์ด๊ธฐ ๋๋ฌธ์ ์์ ํ ํ๊ฒฝ์ด๋ผ๋ ๊ฒ์ด๋ค. OS๋ฅผ ๊ฐ๋ฐํ๊ธฐ์ ๊ต์ฅํ ์ข์ Tool์ด๋ค. Virtual Machine Disk์ ํฌ๊ธฐ๊ฐ ์์ ์ ๋ฐ์ ์๋ค๋ ๊ฒ์ด๊ณ ์๋๊ฐ ๋๋ฆฌ๋ค๋ ๊ฒ. Storage Management OS๊ฐ ์ผ์ข ์ Abstract๋ฅผ ์ ๊ณตํ๋๋ฐ ํ๋์ ๋์คํฌ ๊ตฌ์กฐ๋ฅผ ํฌ์ฅํด์ file Interface๋ฅผ ์ ๊ณตํด์ฃผ๋ ๊ฒ์ด OS์ด๋ค, File์ ์ฐ๋ฆฌ๊ฐ ์ ์ฅํ๋ค๋ฉด ์ค์ ๋ก Physicalํ Disk์ ์ ์ฅํด์ฃผ๋ ๊ฒ์ด OS์ ์ญํ ์ด๋ค Device Driver ์ด๋ค Device๋ฅผ ์ฌ์ฉํ ๋ ๊ทธ Device์ Interface๋ฅผ ์ ์ํด์ฃผ๋ Software๊ฐ ์๋๋ฐ ๊ทธ๊ฒ์ด Driver์ด๋ค. Device Controller์์ ๊ตฌ๋ถ์ ํ ํ์๊ฐ ์๋ค. Controller์ ๊ฒฝ์ฐ Hardware Component์ Bus์ ๊ด๊ณ์ด๊ณ Device Driver๋ Software์ ๊ด๊ณ์ ์๋ค. ๊ทธ๋ผ ์ด๋ค ์ญํ ์ ํ๋๊ฐ Device Driver๋ Software ์ ์ผ๋ก ํต์ผํด์ฃผ๋ ์ญํ ์ ํ๋ค. File access์ ๋์ผํ ์ญํ ์ ํ๋ค. Storage Management File System์ ์ด๋ป๊ฒ ์ฒ๋ฆฌํ๋ ์ง์ ๋ํ ์ ๋ณด๊ฐ ์ค์ํ๋ค. Cashing Cashing์ ์๋ ์ฐจ์ด๊ฐ ํฐ ๋ ๊ณต๊ฐ์ ์ฐ๊ฒฐํ ๋ ํ์ํ ๊ธฐ์ ์ด๋ค. Main Memory๋ฅผ ์ฝ์ด์ฌ ๋ cache์ ๋ณต์ฌ๋ณธ์ ์ ์ฅํด๋๊ณ ๋ฐ๋ณตํด์ ์ ๊ทผ์ ํ ๋ cache์ ์๋ ์ ๋ณด๋ง ๊ฐ์ง๊ณ ์ฌ์ฉ์ ํ ์ ์๋ค. ๊ณต์ ํ๊ธฐ ๊ฒ์๊ธ ๊ด๋ฆฌ HU's BloG ์ ์์ํ์ '๐ Major Study (Bachelor) > ๐ง Operating System' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ [OS / ์ด์ ์ฒด์ ] Scheduling Queue, PCB in Linux, Scheduling Queue, Queue Diagram, Context Switch, Process Creation, Process Creation in UNIX (0) 2022.03.24 [OS / ์ด์์ฒด์ ] Process State, Ready / Running State, Process Control Block, Process Scheduling (0) 2022.03.21 [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 / ์ด์์ฒด์ ] Interrupt-based IO, Main Memory, Storage Structure, Multi Processor System, Clustered System, Purpose of Clustered System (0) 2022.03.07 ๊ด๋ จ๊ธ [OS / ์ด์ ์ฒด์ ] Scheduling Queue, PCB in Linux, Scheduling Queue, Queue Diagram, Context Switch, Process Creation, Process Creation in UNIX [OS / ์ด์์ฒด์ ] Process State, Ready / Running State, Process Control Block, Process Scheduling [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 [OS / ์ด์์ฒด์ ] Timesharing, Virtual Memory, Dual Mode Operation, Thread, Memory Management