Context Switching
Context Switching이란?
- 현재 수행중인 Process의 Context state를 저장하고 다음 수행 될 Process의 Context state를 불러오는 작업Context Saving
- Context Swithcing이 일어날 경우 현재 Process의 Context를 저장하는 작업Context 종류 및 Saving유무
(Context별 설명은 http://winwoo.tistory.com/16 'Program State' 참고)
- Memory Context : 필요한 Data만 Saving
- CPU Register Context : 반드시 모든 Data Saving
-> saving 장소 : 일반적으로 한단계 아래의 저장장치로 데이터를
대피시키기 때문에 CPU Register는 Main Memory로 대피
- Kernel Context : Saving 필요 없음Interrupt Service Routine이 발생 했을 때
( Context Switching 발생 -> HW가 실행)
다음과 같은 순서로 Stack에 저장
1. Interrupt가 발생하기 전 PSW 저장
2. Interrupt가 끝나고 돌아올 주소 저장
- 돌아올 주소는 HW가 PC(Program Count)에서 가져옴
초기 Process 생성 시 Stack 초기화
- Context Switching Mechanism이 동작하기 위해선 한번이라도 Context Switching이 일어나야 된다. 하지만 Process가 처음 생성될 경우 임의의 Stack을 만들어 준다.
'프로그래밍 > 운영체제' 카테고리의 다른 글
MultiThreading (0) | 2016.10.13 |
---|---|
Context Switching(2) (0) | 2016.10.11 |
Process Scheduling (0) | 2016.10.09 |
Process Concept (0) | 2016.10.09 |
Computer Hardware (0) | 2016.10.05 |