Skip to main content

Quiz based on Digital Principles and Computer Organization

1) Base of hexadecimal number system? Answer : 16 2) Universal gate in digital logic? Answer : NAND 3) Memory type that is non-volatile? Answer : ROM 4) Basic building block of digital circuits? Answer : Gate 5) Device used for data storage in sequential circuits? Answer : Flip-flop 6) Architecture with shared memory for instructions and data? Answer : von Neumann 7) The smallest unit of data in computing? Answer : Bit 8) Unit that performs arithmetic operations in a CPU? Answer : ALU 9) Memory faster than main memory but smaller in size? Answer : Cache 10) System cycle that includes fetch, decode, and execute? Answer : Instruction 11) Type of circuit where output depends on present input only? Answer : Combinational 12) The binary equivalent of decimal 10? Answer : 1010 13) Memory used for high-speed temporary storage in a CPU? Answer : Register 14) Method of representing negative numbers in binary? Answer : Two's complement 15) Gate that inverts its input signal? Answer : NOT 16)

I/O polling, Interrupts

Polling
* One simple means of device handshaking includes polling:
1. The host continously checks the busy bit on the device until it becomes free.
2. The host writes a byte of data into the data-out register, and keps the write bit in 
the command register.
3. The host sets the command ready bit in the command register to inform the device of the pending command.
4. When the device controller sees the command-ready bit regulates , it first sets the busy bit.
5. Then the device controller peruse the command register, sees the write bit set, 
Peruse the byte of data from the data-out register, and outputs the byte of data.
6. The device controller then deletes the error bit in the status register, the command-ready bit, and atlast clears the busy bit, signaling the completion of the 
operation.
* Polling can be very fast and structured, if both the device and the controller are fast and if there is significant data to move. It becomes inefficient, however, if the host must delays a long time in the busy loop waiting for the device, or if frequent checks need to be made for data that is infrequently there.

Interrupts
* Interrupts permit devices to tell the CPU when they have data to move or when an operation is done, permitting the CPU to perform other duties when no I/O transfers need its immediate attention.
* The CPU has an interrupt-request line that is sensed after each command.
• A device's controller increase an interrupt by asserting a signal on the interrupt request line.
• The CPU then performs a state save, and moves control to the interrupt handler routine at a fixed address in memory.
• The interrupt handler defines the cause of the interrupt, performs the necessary processing, performs a state restore, and implements a return from interrupt instruction to return control to the CPU.
* Below Figure explains the interrupt-driven I/O procedure:
* The above description is adequate for simple interrupt-driven I/O, but there are three requires in modern computing which complicate the picture:
1. The need to delay interrupt handling during critical processing,
2. The need to determine which interrupt handler to call, without having to poll all devices to see which one needs attention, and
3. The need for multi-level interrupts, so the system can vary between high- and low-priority interrupts for proper response.
* These problems are handled in modern computer architectures with interrupt-controller hardware.
• Most CPUs now have two interrupt-request lines: One that is non-maskable for critical error states and one that is maskable, that the CPU can temporarily reject during critical processing.
• The interrupt method accepts an address, which is usually one of a small set of numbers for an offset into a table called the interrupt vector. This table holds the addresses of routines made to process specific interrupts.
• The number of possible interrupt handlers still surpass the range of defined interrupt numbers, so multiple handlers can be interrupt chained. Effectively the addresses kept in the interrupt vectors are the head pointers for linked-lists of interrupt handlers.
• Interrupts 0 to 31 are non-
maskable and preserved for serious hardware and other errors. Maskable interrupts, adding normal device I/O interrupts begin at interrupt 32.
• Modern interrupt hardware also helps interrupt priority levels, permitting systems to mask off only lower-priority interrupts while servicing a high-priority interrupt, or 
conversely to permits a high-priority signal to interrupt the processing of a low-priority 
one.
* At boot time the system defines which devices are present, and loads the suitable handler addresses into the interrupt table.
* During operation, devices signal errors or the finish of commands via interrupts.
* Exceptions, such as dividing by zero, invalid memory accesses, or attempts to retrieve kernel mode instructions can be signaled via interrupts.
* Time slicing and context switches can also be executed using the interrupt 
mechanism.
• The scheduler sets a hardware timer before changing control over to a user process.
• When the timer highs the interrupt request line, the CPU performs a state-save, and transfers control over to the proper interrupt handler, which in turn runs the scheduler.
• The scheduler does a state-retrieve of a different process before resetting the timer and issuing the return-from-interrupt instruction.
* A same example involves the paging system for virtual memory - A page fault 
causes an interrupt, which in turn issues an I/O request and a context switch as 
described above, moving the interrupted process into the wait queue and choosing a different process to run. When the I/O request has completed ( i.e. when the requested page has been loaded up into physical memory ), then the device interrupts, and the interrupt handler moves the process from the wait queue into the ready queue, ( or depending on scheduling algorithms and policies, may go ahead and context switch it back onto the CPU. )
* System calls are executed via software interrupts, a.k.a. traps. When a (library ) program requires work performed in kernel mode, it sets command information and possibly data addresses in certain registers, and then raises a software interrupt. The system does a state save and then calls on the proper interrupt handler to process the request in kernel mode. Software interrupts generally have low priority, as they are not as urgent as devices with limited buffering space.
* Interrupts are also used to manage kernel operations, and to schedule activities for optimal performance. For example, the completion of a disk read operation involves two interrupts:
• A high-priority interrupt acknowledges the device completion, and issues the 
next disk request so that the hardware does not sit idle.
• A lower-priority interrupt transfers the data from the kernel memory space to 
the user space, and then transfers the process from the waiting queue to the 
ready queue.
• The Solaris OS uses a multi-threaded kernel and priority threads to assign 
different threads to different interrupt handlers. This allows for the "simultaneous" handling of multiple interrupts, and the assurance that high-
priority interrupts will take precedence over low-priority ones and over user 
processes.


Popular posts from this blog

Introduction to C Programs

INTRODUCTION The programming language ‘C’ was developed by Dennis Ritchie in the early 1970s at Bell Laboratories. Although C was first developed for writing system software, today it has become such a famous language that a various of software programs are written using this language. The main advantage of using C for programming is that it can be easily used on different types of computers. Many other programming languages such as C++ and Java are also based on C which means that you will be able to learn them easily in the future. Today, C is mostly used with the UNIX operating system. Structure of a C program A C program contains one or more functions, where a function is defined as a group of statements that perform a well-defined task.The program defines the structure of a C program. The statements in a function are written in a logical series to perform a particular task. The most important function is the main() function and is a part of every C program. Rather, the execution o

Human Factors in Designing User-Centric Engineering Solutions

Human factors play a pivotal role in the design and development of user-centric engineering solutions. The integration of human-centered design principles ensures that technology not only meets functional requirements but also aligns seamlessly with users' needs, abilities, and preferences. This approach recognizes the diversity among users and aims to create products and systems that are intuitive, efficient, and enjoyable to use. In this exploration, we will delve into the key aspects of human factors in designing user-centric engineering solutions, examining the importance of user research, usability, accessibility, and the overall user experience. User Research: Unveiling User Needs and Behaviors At the core of human-centered design lies comprehensive user research. Understanding the target audience is fundamental to creating solutions that resonate with users. This involves studying user needs, behaviors, and preferences through various methodologies such as surveys, interview

Performance

Performance ( Optional ) * The I/O system is a main factor in overall system performance, and can place heavy loads on other main components of the system ( interrupt handling, process switching, bus contention, memory access and CPU load for device drivers just to name a few. ) * Interrupt handling can be relatively costly ( slow ), which causes programmed I/O to be faster than interrupt driven I/O when the time spent busy waiting is not excessive. * Network traffic can also loads a heavy load on the system. Consider for example the sequence of events that occur when a single character is typed in a telnet session, as shown in figure( And the fact that a similar group of events must happen in reverse to echo back the character that was typed. ) Sun uses in-kernel threads for the telnet daemon, improving the supportable number of simultaneous telnet sessions from the hundreds to the thousands.   fig: Intercomputer communications. * Rather systems use front-end processors to