A key point towards understanding how operating systems work is to - TopicsExpress



          

A key point towards understanding how operating systems work is to understand what the CPU does when an interrupt occurs. The hardware of the CPU does the exact same thing for each interrupt, which is what allows operating systems to take control away from the current running user process. The switching of running processes to execute code from the OS kernel is called a context switch. CPUs rely on the data contained in a couple registers to correctly handle interrupts. One register holds a pointer to the process control block of the current running process. This register is set each time a process is loaded into memory. The other register holds a pointer to a table containing pointers to the instructions in the OS kernel for interrupt handlers and system calls. The value in this register and contents of the table are set when the operating system is initialized at boot time. The CPU performs the following actions in response to an interrupt: Using the pointer to the current process control block, the state and all register values for the process are saved for use when the process is later restarted. The CPU mode bit is switched to supervisory mode. Using the pointer to the interrupt handler table and the interrupt vector, the location of the kernel code to execute is determined. The interrupt vector is the IRQ for hardware interrupts (read from an interrupt controller register) and an argument to the interrupt assembly language instruction for software interrupts. Processing is switched to the appropriate portion of the kernel.
Posted on: Sat, 26 Oct 2013 17:55:02 +0000

Trending Topics



Recently Viewed Topics




© 2015