기본 콘텐츠로 건너뛰기

1월, 2015의 게시물 표시

Context Switching

Motivation  When changed from state to another state or interrupted, operating system(OS) must maintain current context for OS to fulfill the consistency. In particular, we have to save hardware context which involve in CPU registers and I/O registers. Intuition - All of the change of context is made of occurring Interrupt. Moreover, Context Switching is a kind of Interrupt Service Routine. Whenever Interrupt occurs, we have to save all of the registers known as a state vector which involve a program counter, stack pointer and so on, to PCB of the current process. - There is a context switch function in kernel memory, that can allocate CPU resource. - In Linux system, context switch function is known as schedule function and When calling system call such as read, wait, exit it invokes schedule function. Review - Interrupt occurs in anytime, even if system is in the smallest process step such as ADD instruction. Because after finishing every instruction, in hardware mechanism, system ch