← Back to Blog

[Operating System] Interrupt

computer-science > development

2026-04-102 min read

#development #programming #cs #OS #interrupt

본 자료는 인하대학교 정진만 교수님의 Operating System 강의 자료를 참고하여 제작되었습니다.

Processor Register

Instruction

< Instruction format >
+--------+----------+
| opcode | operands |
+--------+----------+
  1. PC는 다음 명령어 주소를 저장한다.
  2. IR에 적재한다.
  1. PC -> MAR
  2. MAR -> MBR
  3. MBR -> IR
  4. PC = PC + 1

OS Time Management

System Timer

Interrupt

그래서 Interrupt가 발생하면, Interrupt handler가 관리한다.

Interrupt Machanism

e.g.,

  1. Update the jiffies
  2. Update the wall time
  3. Update the process time
    3-1. Upgrade resouce usage
    3-2. Update time slice
  4. Run dynamic timers

Programmable Interrupt Controller (PIC)

CPU랑 I/O controller 사이에서 중간 관리자 역할을 수행한다.
장치로부터 #IRQ를 받아 interrupt를 마스킹한다.

Interrupt Processing

interrupt processing

<Hardware>

  1. Interrupt 발생
  2. 현 명령어 종료
  3. Interrupt 신호 인지
  4. Control Stack에 PSW와 PC를 push
  5. Interrupt에 맞는 PC를 load

<Software>

  1. 프로세스 상태 정보를 저장 (Save all)
  2. 프로세스 interrupt (Interrupt Service Routine(ISR))
  3. 프로세스 상태 복구
  4. PSW와 PC를 복구 (Restore all)

Interrupt and Exception

Interrupt는 hardware에서 발생하는 것이라 비동기 처리가 되고.
Exception은 divid by zero처럼 CPU에서 발생하는 것이라 동기 처리이다.