CPU/OS is processing process p1, in process p1 there is an instruction
'read opd.txt file'. then CPU/OS gives this request to Device controller
(disk controller) then disk controller is reading the data from disk
mean while CPU should not Idle, CPU context switching to process p2
and process p1 is preempted .
1.CPU gives the request to Disk controller
2. Disk controller reads the data from disk to buffer, once reading is finished CPU raises an interrupt to OS/CPU , at that time may be P2 my running. CPU is executing the 5 instruction of the P2.
3.CPU send an IACK(Interrupt Acknowledge) to the Disk contoller. CPU will wait until completion of executing the 5 instruction of the P2. During this time no IACK should send to disk controller.
4.After receiving IACK, Device Controller sends an Interrupt Vector(set of bytes used an index for an ISR) to OS.
Every OS main the Vector Table , Vector table has Index and ISR in each row.
|-------------------------------------------|
| Index | ISR |
|------------------------------------------ |
| 222 | PrinterISR |
| 232 | DiskISR |
| 342 | Netw.orkISR |
-------------------------------------------
Above one is basic view of vector Table.
ISR: Interrupt service routine is Pointer to sub routine or functions. OS is bunch of C code partially assembly language(10%).OS code is million of lines.In this millions lines handling 'Disk Activity' is a small portion, so ISR points the specific code block/function/lines for executing those lines.
5. CPU before executing the ISR for disk controller (Ex: DiskISR), CPU do two things
i. Saves the next instruction (Instruction 6) of the P2 in STACK or saves the next PC (program counter)
in stack. Here saves only address of instruction 6 only because PC contain address of next instruction.
ii.Disable the Interrupts from same disk controller
6.Executes the Disk ISR means takes the data from Disk controller buffer and place that in Physical
memory.
Note: ISR not allowed recursion
1.CPU gives the request to Disk controller
2. Disk controller reads the data from disk to buffer, once reading is finished CPU raises an interrupt to OS/CPU , at that time may be P2 my running. CPU is executing the 5 instruction of the P2.
3.CPU send an IACK(Interrupt Acknowledge) to the Disk contoller. CPU will wait until completion of executing the 5 instruction of the P2. During this time no IACK should send to disk controller.
4.After receiving IACK, Device Controller sends an Interrupt Vector(set of bytes used an index for an ISR) to OS.
Every OS main the Vector Table , Vector table has Index and ISR in each row.
|-------------------------------------------|
| Index | ISR |
|------------------------------------------ |
| 222 | PrinterISR |
| 232 | DiskISR |
| 342 | Netw.orkISR |
-------------------------------------------
Above one is basic view of vector Table.
ISR: Interrupt service routine is Pointer to sub routine or functions. OS is bunch of C code partially assembly language(10%).OS code is million of lines.In this millions lines handling 'Disk Activity' is a small portion, so ISR points the specific code block/function/lines for executing those lines.
5. CPU before executing the ISR for disk controller (Ex: DiskISR), CPU do two things
i. Saves the next instruction (Instruction 6) of the P2 in STACK or saves the next PC (program counter)
in stack. Here saves only address of instruction 6 only because PC contain address of next instruction.
ii.Disable the Interrupts from same disk controller
6.Executes the Disk ISR means takes the data from Disk controller buffer and place that in Physical
memory.
Note: ISR not allowed recursion
No comments:
Post a Comment