Showing posts with label Operating System. Show all posts
Showing posts with label Operating System. Show all posts
Monday, April 2, 2012
Sunday, April 1, 2012
What is Interrupt cycle?
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
Saturday, March 31, 2012
What is buffer and why buffers required?
CPU is processing process p1, in process p1 there is an instruction
'read opd.txt file'. then CPU gives this request to Device controller
(disk controller) then disk controller is reading the data from disk
and read data should placed in local 'Buffer' of the disk controller.
If some thing need to write then Data should be available in 'buffer' of the disk controller from that disk is reading. because CPU writes the data in massive rate but disk is very slow , so it is not possible to write the data in to disk due the speed. So CPU place the data into disk local buffers from that disk is reading.
If some thing need to write then Data should be available in 'buffer' of the disk controller from that disk is reading. because CPU writes the data in massive rate but disk is very slow , so it is not possible to write the data in to disk due the speed. So CPU place the data into disk local buffers from that disk is reading.
What is an IO?
IO is Input (reading data) or Output (writing data).
IO always between Disk and Disk controller. But not memory and Disk.
CPU is processing process p1, in process p1 there is an instruction 'read opd.txt file'. then CPU gives this request to Device controller (disk controller) then disk controller is reading the data from disk and read data should placed in local 'Buffer' of the disk controller.
If some thing need to write then Data should be available in 'buffer' of the disk controller from that disk is reading. because CPU writes the data in massive rate but disk is very slow , so it is not possible to write the data in to disk due the speed. So CPU place the data into disk local buffers from that disk is reading.
IO always between Disk and Disk controller. But not memory and Disk.
CPU is processing process p1, in process p1 there is an instruction 'read opd.txt file'. then CPU gives this request to Device controller (disk controller) then disk controller is reading the data from disk and read data should placed in local 'Buffer' of the disk controller.
If some thing need to write then Data should be available in 'buffer' of the disk controller from that disk is reading. because CPU writes the data in massive rate but disk is very slow , so it is not possible to write the data in to disk due the speed. So CPU place the data into disk local buffers from that disk is reading.
What is an interrupt
IO is always between device and device controller. CPU reads/write the data in Giga Hedge speed but disk are very slow , due to this disk looses some data during reading the data from CPU. So Disk controller has local buffers for solving this issue. First CPU place the data in to Disk buffers from that Disk reads. same thing for write also.
CPU is processing process p1, in process p1 there is an instruction 'read opd.txt file'. then CPU gives this request to Device controller (disk controller) then disk controller is reading the data from disk mean wile CPU should not Idle, CPU context switching to process p2 and process p1 is preempted . Once disk is finished reading the data from disk (and placed this data into disk controller), disk controller raises an interrupt to CPU "saying that ready is finished" at time P2 or P3 or P4 may running in CPU, then ISR executes and data is read from disk controller to memory.
This is called Hardware interrupt.
What is preemption or context switching
Device controller and CPU can work concurrently. All Devices like Hard disk, magnetic disks, Printers, Memory are dumb, means they won't work with out device controller.
If i want to read some file from Disk , Disk controller reads the data from disk to Disk controller buffer then it transfer to main memory. Then user is able to read the file.
CPU is processing process p1, in process p1 there is an instruction 'read opd.txt file'. then CPU gives this request to Device controller (disk controller) then disk controller is reading the data from disk mean wile CPU should not Idle and CPU context switching to process p2 and process p1 is preempted . This is Called Context switching.
If i want to read some file from Disk , Disk controller reads the data from disk to Disk controller buffer then it transfer to main memory. Then user is able to read the file.
CPU is processing process p1, in process p1 there is an instruction 'read opd.txt file'. then CPU gives this request to Device controller (disk controller) then disk controller is reading the data from disk mean wile CPU should not Idle and CPU context switching to process p2 and process p1 is preempted . This is Called Context switching.
Subscribe to:
Posts (Atom)