Showing posts with label computer organization and architecture. Show all posts
Showing posts with label computer organization and architecture. Show all posts

Wednesday, July 10, 2013

What are the types of interrupt? Explain.



The types of interrupt are:
·         External Interrupt: External interrupts are caused by some sources like I/O devices, hardware circuits, timing devices and any other hardware component. When an I/O device request for a service it generate an external interrupt. It is caused by some external event. These external interrupts are asynchronous, i.e. the interrupt might not occur at the same time, whenever the program is re-run.
·         Internal Interrupts: Internal interrupts are caused by erroneous or illegal use of instruction. They are also called as TRAPS. When an instruction leads an operation to divide a number by 0, an internal interrupt of attempt to divide by zero is generated. It is also caused by stack overflow, register overflow, invalid operation code etc. These interrupts are caused by some internal invent and are synchronous. The internal interrupt occur at the same place whenever the program is re-run.
·         Software Interrupts: Software interrupt is initiated by executing an instruction. It is a special call instruction that behaves like an interrupt rather than a subroutine call. The most common use of software interrupt is associated with a supervisor (or kernel) call instruction. This instruction provides a medium for the user program to switch from user mode to kernel mode by generating a software interrupt. Whenever a software interrupt is generated it changes the mode of the program and the control cannot be transferred to the arbitrary address. Computers often generate the software interrupt to communicate with the disk controller to request data be read or write from or to disk.

Explain different types of I/O commands.



When the address of a particular I/O device is placed in the address lines, at the time the processor also provide a function code in the control lines, which is referred to as a I/O command. the different types of I/O commands are:
·         Control command: The name of the command itself suggest that it includes control bits. The control command specifies the control bit that controls the I/O device physically. It mentions how the work has to be carried out and under what circumstances.
·         Status command: This command is used to check several conditions in the I/O devices and the interface for the transfer of information. This command is very useful to check the errors, completion of transfer and interrupts.
·         Output command: The output command is responsible for transfer of data from the system to the output device. It causes the transfer of information to the interface registers and then under certain satisfactory condition the information is output via output devices.
·         Input command: The input command deals with the transfer of data from the interface registers to the system. The interface places the data on the data lines under suitable conditions and then it is accepted by the processor.

What is page fault?



The condition that arises whenever a process reference to a page that is not currently resided in the physical memory but is present in the auxiliary memory is called page fault. At the time page fault occur, the required page is fetched from the auxiliary memory and resided into an empty page frame (or block) but if there is no empty page frame then an appropriate page is selected to replace it with the referenced page using a page replacement algorithm.

Explain associative memory page table.



Generally, a system has larger address space than the memory space. For a system of 1024K address space and 32K memory space with 1K block size, we have 1024 pages and 32 blocks. With this at most 32 pages can be in the physical memory. That means, in every time only 32 locations of the page table is used and 992 locations are not used. This leads to the high wastage of memory as the page table occupies memory corresponding to 1024 slots. Also the performance of the system is reduced. So, the more effective and efficient solution would be to maintain the page table with number of entries equivalent to the number of blocks rather than number of pages. In this way the size of the table is reduced and each slot of the table is fully utilized. This is possible with the help of associative memory with each entry (or word) containing a page number together with its corresponding block number.
e.g. For a system of 8K address space and 4K memory space with 1K of block size we can have page table with only 4 entries if we use associative memory page table.

Explain address mapping using pages.



In virtual memory system the virtual address should be mapped into the physical address. For the ease of such mechanism the physical memory is divided into fixed size groups called blocks. The blocks can be also called as page frames. Similarly, the address space is also divided into groups whose size is equivalent to the size of blocks, known as pages. Whenever a program refers to a page stored in the auxiliary memory, it is loaded in one of the page-frame in the physical memory.
Let us consider address space of 8KB and memory space of 4KB. Then with 1KB block size the system has 8 pages and 4 blocks or page-frames. Possibly, there can be at most 4 pages resided in the physical memory at any instance, so the pages have to be moved back and forth from auxiliary memory whenever a program reference to a page not in the physical memory. Having such condition, address mapping is done such a way that the page is easily available to the program. Address space of 8KB leads to 13-bit virtual address and memory space of 4KB leads to 12 –bit physical address. So the 10 LSB bits are used as line number and 3 MSB bits of virtual address is used as page number. The page number behaves as a table index or table address in the page table and locates an entry in the page table. A presence bit is associated with each entry in the page table which indicates that the current page is in the physical memory or not. Each entry include 3-bit information, 2-bit is used to represent the block number in which the page is resided and 1-bit to indicate its presence. Hence, this 2-bit along with the 10-bit line number gives the 12-bit physical address of the particular block. In this way address mapping is done using pages.