[์šด์˜์ฒด์ œ] CPU Interrupt

2023. 3. 25. 15:52ใ†ComputerScience/OperatingSystem

 

 

 

Interrupt handler

- ์ธํ„ฐ๋ŸฝํŠธ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” func

- ISR (interrupt service routine)

- ์ธํ„ฐ๋ŸฝํŠธ ๋ฐœ์ƒ! -> ์šด์˜์ฒด์ œ๊ฐ€ ์ˆ˜ํ–‰๋จ 

 

 

 

โญ๏ธ ์ธํ„ฐ๋ŸฝํŠธ์˜ 3๊ฐ€์ง€ ์ข…๋ฅ˜

1) Interrupt

- Hardware interrupt

- asynchronous - ๋น„๋™๊ธฐ๋กœ ์ฒ˜๋ฆฌ๋œ๋‹ค. 

- CPU๋Š” ์ด ์ž‘์—…(์ธํ„ฐ๋ŸฝํŠธ)๋ฅผ ๊ธฐ๋‹ค๋ฆฌ์ง€ ์•Š๋Š”๋‹ค -> ๋‹ค๋ฅธ ์ž‘์—… ์ˆ˜ํ–‰ -> ๋‹ค์‹œ ๋Œ์•„์˜ด == acync

- ex) ํ‚ค๋ณด๋“œ ์ธํ„ฐ๋ŸฝํŠธ, timer interrupt

 

 

2) Trap

- Software interrupt

- Application process

- Sync ๋™๊ธฐ์ ์œผ๋กœ ์ฒ˜๋ฆฌ๋œ๋‹ค.

- ex) System Call

-> App์ด ๋””์Šคํฌ์—์„œ ๋ฐ์ดํ„ฐ ์ฝ์–ด๋‹ฌ๋ผ๊ณ  OS์—๊ฒŒ ๋„์›€ ์š”์ฒญ (์บก์Šํ™”, ์ธํ„ฐํŽ˜์ด์Šค ์ธก๋ฉด)

-> OS๊ฐ€ ์˜ฌ ๋•Œ ๊นŒ์ง€ App์€ ๊ธฐ๋‹ค๋ ค์•ผ ํ•˜๋‹ˆ๊นŒ ๋™๊ธฐ

 

 

3) Fault (Exception)

- ๋น„์ •์ƒ์ ์ธ ์ƒํ™ฉ์—์„œ CPU๊ฐ€ ์ž๊ธฐ ์ž์‹ ์—๊ฒŒ ์ธํ„ฐ๋ŸฝํŠธ๋ฅผ ๊ฑด๋‹ค 

- CPU instructions -> interrupt handler (== OS)

- ex) 0์œผ๋กœ ๋‚˜๋ˆ„๊ธฐ, ์ฐธ์กฐํ•  ์ˆ˜ ์—†๋Š” ๋ฉ”๋ชจ๋ฆฌ ์ฐธ์กฐ ๋“ฑ CPU๊ฐ€ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์—†๋Š” ๋ช…๋ น์–ด

 

 

 

์ธํ„ฐ๋ŸฝํŠธ ํ•ธ๋“ค๋Ÿฌ ์‹œํ–‰ -> OS