Exam h21 Flashcards
The whole thang, not just multiple choice
Which one of the following is correct?
(a) Program counter contains the instruction the processor is currently executing
(b) Program counter contains the address of the instruction the processor is currently executing
(c) Program counter is a register
(d) All of the above
(e) None of the above
(c) Program counter is a register
Which one of the following is incorrect about pipelining?
(a) Pipelining allows executing multiple instructions at the same time on one core
(b) The stages of an instruction cycle in the pipeline require different processing times
(c) Sometimes the prefetched instruction is not the instruction that is executed next
(d) All of the above
(e) None of the above
(a) Pipelining allows executing multiple instructions at the same time on one core
A page fault occurs when . . .
(a) A requested page is in the backing store
(b) A requested page number is found in translation look-aside buffer (TLB)
(c) A requested page is in memory
(d) All of the above
(e) None of the above
(e) None of the above
Consider a processor that needs 5 ns to access the cache memory and 200 ns to access the main
memory. Assume the cache hit ratio is 95%, what is the average memory access time of the
processor?
(a) 5 ns
(b) 10 ns
(c) 15 ns
(d) 20 ns
(e) 100 ns
(f) None of the above
Solution: 0.95 × 5 + 0.05 × (5 + 200) = 15 ns
Consider the instruction mov edx [hello]. How many operands does this instruction have?
(a) 3
(b) 2
(c) 1
(d) 0
(e) None of the above
Solution: (b) 2.
The first is the destination and the second sepcifies the source.
Consider an instruction with two operands O1, O2. If O1 uses PC-relative addressing mode, O2 uses
indirect addressing mode. How many memory accesses are required in total to fetch O1 and O2?
(a) 4
(b) 3
(c) 2
(d) 1
(e) 0
(f) None of the above
Solution: 1+2=3
PC-Relative Addressing
Typically, PC-relative addressing involves fetching the operand from a memory location whose address is calculated as the sum of the Program Counter (PC) and an offset.
One memory access is required to fetch.
Indirect Addressing
Indirect addressing involves using the contents of a memory location as an address to fetch the actual operand.
Two memory accesses are required for indirect addressing: one to fetch the address from the specified memory location, and another to fetch the actual operand using the obtained address.
(e) None of the above
Which one of the following is a function of a dispatcher?
(a) To context-switch between processes
(b) To give control of the CPU to the process selected by the short-term scheduler
(c) To jump to the proper location in the user program to restart that program
(d) All of the above
(e) None of the above
(d) All of the above
Which one of the following is incorrect?
(a) Paging allows memory allocated to a process to be noncontiguous
(b) Paging solves the problem of internal fragmentation
(c) Paging solves the problem of external fragmentation
(d) Paging avoids the problem of thrashing
(e) All of the above
(f) None of the above
(b) Paging solves the problem of internal fragmentation
Which one of the following scheduling algorithms has starvation problem?
(a) Shortest job first
(b) Multilevel Queue Scheduling
(c) Shortest-remaining-time-first
(d) All of the above
(e) None of the above
(d) All of the above
Which one of the following is correct?
(a) PCBs are not actually needed by the operating system, but is only maintained in order to
provide the user about statistics for the processes
(b) PCBs are the data structure needed for the operating system to implement multi-programming, context shift, and even process forks
(c) A PCB does not contain a program counter
(d) A PCB contains the computer’s host name
(e) All of the above
(f) None of the above
(b) PCBs are the data structure needed for the operating system to implement multi-programming, context shift, and even process forks
Which one of the following is incorrect?
(a) The fork() system call is used to create a new process on a UNIX computer
(b) A new child process created using the fork() system call is initially identical to the parent
process
(c) A process can use the return value from the fork() system call to decide if it is the parent or
child process
(d) The exec() system call can be used to replace the program content of a child process
(e) All of the above
(f) None of the above
(f) None of the above
Which one of the following is correct?
(a) Creating a new process hardly requires any resources at all, thus there is no need to limit the
usage of this
(b) A process and a thread are just different names for exactly the same thing
(c) A thread is also called a light process
(d) It is only possible to create threads on a multi-CPU/core system
(e) All of the above
(f) None of the above
(c) A thread is also called a light process