CS401 ASSIGNMENT NO 3 IDEA SOLUTION FALL 2010

CS401 IDEA SOL BY SOME ONEInterrupts are asynchronous and unpredictable. Asynchronous means that the interrupts occur, independent of the working of the processor, i.e. independent of the instruction currently executing. Synchronous events are those that occur side by side with another activity. Interrupts must be asynchronous as they are generated by the external world which is unaware of the happenings inside the processor.True interrupts that occur in real time are asynchronous with the execution. Also it is unpredictable at which time an interrupt will come. The two concepts of being unpredictable and asynchronous are overlapping .Unpredictable means the time at which an interrupt will come cannot be predicted, while asynchronous means that the interrupt has nothing to do with the currently executing instruction and the current state of the processor. Hardware interrupts are the real interrupts generated by the external world as discussed above. Software interrupts on the contrary are not generated from outside the processor. They just providean extended far call mechanism. Far call allows us to jump anywhere in the whole megabyte of memory. To return from the target we place both the segment and offset on the stack. Software interrupts show a similar behavior. Hardware interrupts , the third category that we will refer to simply as interrupts, are program control interruption based on an external hardware event (external to the CPU). These interrupts generally have nothing at all to do with the instructions currently executing; instead, some event, such as pressing a key on the keyboard or a time out on a timer chip, informs the CPU that a device needs some attention. The CPU interrupts the currently executing program, services the device, and then returns control back to the program. hardware interrupts are generally asynchronous , meaning they can occur at any time and rarely do they occur at the same spot in a program. An interrupt is an asynchronous procedure call the CPU generates in response to an external hardware signal. However there is a single pin outside the processor called the INT pin that is used by external hardware to generate interrupts. There are many external devices that need the processor’s attention like the keyboard, hard disk, floppy disk, sound card. All of them need real time interrupts at some point in their operation. when the printer is busy printing we cannot send it more data. As soon as it gets free from the previous job it interrupts the processor to inform that it is free now. There are many other examples where the processor needs to be informed of an external event. If the processor actively monitors all devices instead of being automatically interrupted then it there won’t be any time to do meaningful work.

Question#2Read the following lines of code. It will read the mask register from port 0×21 and thenset the 2nd bit in the register. As soon as it is written back to port 0×21; Keyboard will bedisabled that is connected to IRQ1.in al, 0×21 ; read interrupt mask registeror al, 2 ; set bit for IRQ1out 0×21, al ; write back mask registerTake out line 2 i.e.or al, 2modify it to solve the following parts1. set bit to disable IRQ7Sol:or al, 1282. set bit to disable IRQ0Sol:or al, 13. set bit to disable IRQ5Sol:or al, 324. enable IRQ1, IRQ2, IRQ7 and disable the rest.Sol:and al, 0 // first enable all to get desired resultor al, 121 // disable IRQ0, IRQ3, IRQ4, IRQ5, IRQ65. enable all IRQsSol:and al, 0