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)...

DEMAND PAGING

Demand Paging
          The fundamental idea behind demand paging is that when a process is exchanged in, its pages are not exchanged in all at once. Probably they are exchanged in only when the process requires them (on demand) This is termed a lazy swapper, although a pager is a more exact term.
Basic Concepts
* The basic idea behind paging is that when a process is swapped in, the pager only enters into memory those pages that it expects the process to need (right away)
* Pages that are not entered into memory are decided as invalid in the page table, using the invalid bit. (The rest of the page table entry may neither be nothing or consists of information about where to find the swapped-out page on the hard drive)
* If the process only ever obtains pages that are entered in memory (memory resident pages), then the process runs exactly as if all the pages were loaded in to memory.
* On the other hand, if a page is needed that was not originally loaded up, then a page fault trap is created, which must be handled in a series of steps:
1. The memory address requested is first examined, to make sure it was a valid 
memory request.
2. If the recommondation was invalid, the process is finished. Otherwise, the page must be paged in.
3. A free frame is detected, possibly from a free-frame list.
4. A disk operation is scheduled to bring in the required page from disk. ( This will 
usually block the process on an I/O wait, permitting some other process to use the 
CPU in the meantime)
5. When the I/O operation is finished,the process's page table is updated with the 
new frame number, and the invalid bit is changed to specify that this is now a 
valid page reference.
6. The instruction that sourced the page condemn must now be resumed from the 
beginning, ( as soon as this process obtains another turn on the CPU. )
* In an uttermost case, NO pages are exchanged in for a process until they are requested by page condemns. This is called as pure demand paging.
* In theory each instruction could create multiple page faults. In practice this is very scarce, due to locality of reference.
* The hardware required to support virtual memory is the same as for paging and swapping: A page table and secondary memory. 
* A critical part of the process is that the specification must be resumed from scratch once the wanted page has been made available in memory. For most simple instructions this is not a major strain. However there are some architectures that permits a single instruction to alter a fairly long block of data, ( which may span a page boundary ), and if some of the data gets modified before the page condemn occurs, this could cause problems. One solution is to access both ends of the block before implementing the instruction, guaranteeing that the necessary pages get paged in before the instruction begins.

Performance of Demand Paging
* Obviously there is some slowdown and performance hit whenever a page condemns occurs and the system has to go get it from memory, but just how big a hit is it exactly?
* There are many steps that occur when checking a page fault ( see book for full details ), and some of the steps are optional or variable. But just for the sake of discussion, assume that a usual memory access requires 200 nanoseconds, and that servicing a page fault takes 8 milliseconds. ( 8,000,000 nanoseconds, or 40,000 times a normal memory access) With a page condemn rate of p, ( on a scale from 0 to 1 ), the effective access time is now:
( 1 - p ) * ( 200 ) + p * 8000000
= 200 + 7,999,800 * p
which clearly depends heavily on p! Even if only one access in 1000 causes a page condemn, the effective access time drops from 200 nanoseconds to 8.2 microseconds, a slowdown of a factor of 40 times. Orderly to keep the slowdown less than 10%, the page condemn rate must be less than 0.0000025, or one in 399,990 accesses.
* A delicacy is that swap space is faster to access than the regular file system, because it does not have to go through the whole directory structure. For this reason some systems will exchange an whole process from the file system to swap space before starting up the process, so that future paging all occurs from the (relatively) faster swap space.
* Some systems take demand paging directly from the file system for binary code (which never changes and hence does not have to be stored on a page operation), and to save the swap space for data segments that must be stored. This prespective is used by both Solaris and BSD Unix.

Copy-on-Write
* The idea beyond a copy-on-write fork is that the pages for a parent process do not have to be actually copied for the child until one or the other of the processes changes the page. They can be easily shared between the two processes in the meantime, with a bit set that the page needs to be copied if it ever gets written to. This is a reasonable approach, since 
the child process normally issues an exec( ) system call immediately after the fork.
* Clearly only pages that can be modified even need to be labeled as copy-on-write. Code segments can simply be shared.
* Pages used to convince copy-on-write duplications are typically allocated using zero-fill-on-demand, meaning that their previous contents are zeroed out before the copy proceeds.
* Various systems supply an substitute to the fork( ) system call called a virtual memory fork, vfork( ). In this case the parent is hanged, and the child uses the parent's memory pages. This is very fast for process creation, but requires that the child not modify any of the divided memory pages before performing the exec( ) system call. ( In essence this addresses the question of which process implements first after a call to fork, the 
parent or the child. With vfork, the parent is hanged, permitting the child to execute first until it calls exec( ), sharing pages with the parent in the meantime.m

Popular posts from this blog

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...

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...

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 processor...