Docsity

Computer Architecture Final Exam Q&A: Memory Hierarchy and Virtual Memory, Exams of Advanced Education

Toggle sidebar
bg1
CDA - Final Exam
2 Kinds of Main Memory - correct answer random access memory (RAM) and read-
only-memory (ROM).
DRAM - correct answer Dynamic RAM is for main memory.
DRAM consists of capacitors that slowly leak their charge over time. Thus, they must
be refreshed every few milliseconds to prevent data loss.
Slow, cheap, and dense memory
One transistor + capacitor per bit
Bit is stored as a charge on capacitor
Must be re-written after being read
Must also be periodically refreshed: Reading each row and writing it back to restore
the charge
Typical choice for main memory
SRAM - correct answer Static RAM is for cache memory.
Fast but expensive RAM
Requires 6-8 transistors per bit
Provides fast access time
Typically used for cache memories
DRAM Refresh Cycle - correct answer Refresh cycle is about tens of milliseconds
Refreshing is done for the entire memory
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e

Partial preview of the text

Download Computer Architecture Final Exam Q&A: Memory Hierarchy and Virtual Memory and more Exams Advanced Education in PDF only on Docsity!

CDA - Final Exam

2 Kinds of Main Memory - correct answer random access memory (RAM) and read- only-memory (ROM). DRAM - correct answer Dynamic RAM is for main memory. DRAM consists of capacitors that slowly leak their charge over time. Thus, they must be refreshed every few milliseconds to prevent data loss. Slow, cheap, and dense memory One transistor + capacitor per bit Bit is stored as a charge on capacitor Must be re-written after being read Must also be periodically refreshed: Reading each row and writing it back to restore the charge Typical choice for main memory SRAM - correct answer Static RAM is for cache memory. Fast but expensive RAM Requires 6-8 transistors per bit Provides fast access time Typically used for cache memories DRAM Refresh Cycle - correct answer Refresh cycle is about tens of milliseconds Refreshing is done for the entire memory

Some of the memory bandwidth is lost to refresh cycles Memory Hierarchy Order - correct answer From Most Costly and Smallest to Least costly and largest System: Registers Level 1 Cache Level 2 Cache Main Memory Online (secondary): Solid State Disk Fixed Rigid Disk Tertiary: Optical Disk Magnetic Tapes Off-Line: USB Flash Drives Removeable Hard Drives Virtual Memory - correct answer Virtual memory is typically implemented using a hard drive; it extends the address space from RAM to the hard drive. Virtual memory provides more space: Cache memory provides speed. Accessing Memory through Memory Hierarchy - correct answer To access a particular piece of data, the CPU first sends a request to its nearest memory, usually cache.

Sequential execution of Instructions. Traversing arrays element by element Sequential locality: Instructions tend to be accessed sequentially. Memory Hierarchy Upper Levels - correct answer It is closer to the processor, smaller, and faster than lower level, since upper level uses more expensive technology. Cache Memory: Purpose and Access - correct answer The purpose of cache memory is to speed up accesses by storing recently used data closer to the CPU, instead of storing it in main memory. Although cache is much smaller than main memory, its access time is a fraction of that of main memory. Addressable Memory: Unlike main memory, which is accessed by address, cache is typically accessed by content A single large cache memory isn't always desirable—it takes longer to search. What is Cache? - correct answer Cache: represents the level of the memory hierarchy between the processor and main memory in the first commercial computer to have this extra level. The memories in the Data path are simply replaced by caches. Direct Mapped Cache - correct answer A cache structure in which each memory location is mapped to exactly one location in the cache. -Location is determined by address -Direct mapped: only one choice -(Block address) modulo (#Blocks in cache) -Blocks is a power of 2

Tags and Valid Bits - correct answer Valid Bit: A field in the tables of a memory hierarchy that indicates that the associated block in the hierarchy contains valid data. Tag: A field in a table used for a memory hierarchy that contains the address information required to identify whether the associated block in the hierarchy corresponds to a requested word. What if there is no data in a location? Valid bit: 1 = present, 0 = not present Initially 0 Associative Caches: Fully, Set, Direct - correct answer Fully Associative - A cache structure in which a block can be placed in any location in the cache. Set Associative - A cache that has a fixed number of locations (at least two) where each block can be placed. Direct Mapped - It is the simplest mapping of cache. There is a direct mapping from any block address in memory to a single location in the upper level of the hierarchy. Consists of N blocks of cache, block X of main memory maps to cache block Y = X mod N. Direct Mapping: Binary Address - correct answer To perform direct mapping, the binary main memory address is partitioned into the fields shown below. -The offset field uniquely identifies an address within a specific block. -The block field selects a unique block of cache. -The tag field is whatever is left over. The sizes of these fields are determined by characteristics of both memory and cache.

-Cache control bits: Valid and Modified bits are required -Modified cached data is written back to memory when replaced -Multiple writes to a cache block require only one write to memory -Uses less memory bandwidth than write-through and less power -However, more complex to implement than write through Virtual Addresses and 2 fields - correct answer the logical or program address that the process uses. CPU generates an address in terms of virtual address space. Two fields: A page field, and an offset field. Page field: determines the page location of the virtual address Offset field: indicates the location of the address within the page. Physical Address and 2 fields - correct answer the actual memory address of physical memory. Programs create virtual addresses that are mapped to physical addresses by the memory manager. Two fields: a page frame field, and an offset field. Page frame field: determines the page frame location in main memory Mapping - correct answer the mechanism by which virtual addresses are translated into physical ones. Page Frames - correct answer the equal-size chunks or blocks into which main memory (physical memory) is divided. Pages - correct answer the chunks or blocks into which virtual memory (the logical address space) is divided, each equal in size to a page frame. Virtual pages are stored on disk until needed.

Paging - correct answer the process of copying a virtual page from disk to a page frame in main memory. Memory Fragmentation - correct answer occurs when the paging process results in the creation of small, unusable clusters of memory addresses. Memory that becomes unusableterm- Page Faults - correct answer an event that occurs when a requested page is not in main memory and must be copied into memory from disk. After a page fault, the operating system searches for a location in memory large enough to hold the segment that is retrieved from disk. Page Table - correct answer Maintaining the Information concerning the location of each page, whether on disk or in memory. There is a page table for each active process. Virtual Address Translation - correct answer 1.Extract the page number from the virtual address. 2.Extract the offset from the virtual address 3.Translate the page number into a physical page frame number using the page table. -Look up the page number in the page table (using the virtual page number as an index) Check the valid bit for that page Valid Bit - correct answer Valid bit is 1: -Virtual page number is replaced by physical frame number.

Segmentation - virtual address space is divided into variable-length segments. A segment is located through its entry in a segment table, which contains the segment's memory location and a bounds limit that indicates its size. Both paging and segmentation can cause fragmentation. Internal and External Fragmentation - correct answer Paging is subject to internal fragmentation because a process may not need the entire range of addresses contained within the page. Thus, there may be many pages containing unused fragments of memory. Segmentation is subject to external fragmentation, which occurs when contiguous chunks of memory become broken up as segments are allocated and deallocated over time. Compaction - correct answer The process of allocated objects together and leaving empty space together. Primary Function of Computers - correct answer Data storage and retrieval is one of the primary functions of computer systems. Sluggish I/O - correct answer Sluggish I/O throughput can have a ripple effect, dragging down overall system performance. This is especially true when virtual memory is involved. Memory Mapped I/O Devices - correct answer In memory-mapped I/O, devices and main memory share the same address space. Each I/O device has its own reserved block of memory. Memory-mapped I/O therefore looks just like a memory access from the point of view of the CPU. The same instructions to move data to and from both I/O and memory, greatly simplifying system design.

In small systems the low-level details of the data transfers are offloaded to the I/O controllers built into the I/O devices. Input/Output - correct answer Input/Output is a subsystem of components that moves coded data between external devices and a host system. I/O Subsystems - correct answer I/O subsystems include: Blocks of main memory that are devoted to I/O functions. Buses that move data into and out of the system. Control modules in the host and in peripheral devices Interfaces to external components such as keyboards and disks. Cabling or communications links between the host system and its peripherals. Overall Performance - correct answer The overall performance of a system is a result of the interaction of all its components. System performance is the most effectively improved when the performance of the most heavily used components is improved. Amdahl's Law - correct answer Amdahl's Law gives us a handy way to estimate the performance improvement we can expect when we upgrade a system component. S = 1 / ((1-f) + f/k) S is the overall speedup; f is the fraction of work performed by a faster component;

Direct Memory Access (DMA) offloads I/O processing to a special-purpose chip that takes care of the details. Channel I/O uses dedicated I/O processors. Programmed I/O - correct answer Programmed I/O reserves a register for each I/O device. Each register is continually polled to detect data arrival. A control register is associated with each I/O port. When a byte arrives in the port, a bit in the control register is set. The CPU polls the port and notices the "data ready" control bit is set. The CPU resets the control, retrieve the byte, and process the data. When the processing is complete, the CPU resumes polling the control registers. Advantage: programming control over the behavior of each device. Disadvantage: Constant register polling keeps CPU busy Hard to determine the polling frequency. Interrupt Driven I/O - correct answer Interrupt-Driven I/O allows the CPU to do other things until I/O is requested. Each device connects its interrupt line to the interrupt controller. The controller signals the CPU when any of the interrupt lines are asserted. In a system that uses interrupts, the status of the interrupt signal is checked at the top of the fetch-decode-execute cycle. The particular code that is executed whenever an interrupt occurs is determined by a set of addresses called interrupt vectors that are stored in memory.

The system state is saved before the interrupt service routine is executed and is restored afterward. Memory Mapped I/O - correct answer I/O devices and main memory share the same address space. -Each I/O device has its own reserved block of memory. -Memory-mapped I/O looks just like a memory access from the point of view of the CPU. -The same instructions are used to move data to and from both I/O and memory, greatly simplifying system design. In small systems the low-level details of the data transfers are offloaded to the I/O controllers built into the I/O devices. I/O Direct Memory Access (DMA) - correct answer Direct Memory Access offloads I/O processing to a special-purpose chip (DMA controller) that takes care of the details. To start the transfer, the CPU provides the DMA controller with -The location of the bytes to be transferred. -The number of bytes to be transferred -The destination device or memory address. Once the proper values are placed in memory, the CPU signals the DMA subsystem and proceeds with its next task, while the DMA takes care of the details of the I/O. After the I/O is complete, the DMA system signals the CPU by sending it another interrupt. Channel I/O - correct answer Very large systems employ channel I/O. Channel I/O consists of one or more I/O processors (IOPs) that control various channel paths.

Tightly coupled multiprocessor systems share a common memory and the same set of I/O devices. Symmetric multiprocessor systems are tightly coupled and load balanced. Distributed Systems are loosely coupled multiprocessor systems have physically separate memory. Another type of distributed system is a networked system, which consists of a collection of interconnected, collaborating workstations. Real Time Operating Systems - correct answer Real-time operating systems control computers that respond to their environment. Hard real-time systems have tight timing constraints, soft real-time systems do not. BIOS Chip - correct answer The idea that revolutionized small computer operating systems was the BIOS (basic input-output operating system) chip that permitted a single operating system to function on different types of small systems. The BIOS takes care of the details involved in addressing divergent peripheral device designs and protocols. Kernel - correct answer As the core of the operating system, the kernel performs scheduling, synchronization, memory management, interrupt handling and it provides security and protection. Microkernel Systems - correct answer Microkernel systems provide minimal functionality, with most services carried out by external programs. Microkernel systems provide better security, easier maintenance, and portability at the expense of execution speed. Symmetric multiprocessor computers are ideal platforms for microkernel operating systems.

Monolithic Systems - correct answer Monolithic systems provide most of their services within a single operating system program. Monolithic systems give faster execution speed but are difficult to port from one architecture to another. Examples are Linux, MacOS, and DOS. Process Management - correct answer Process management lies at the heart of operating system services. The operating system creates processes, schedules their access to resources, deletes processes, and deallocates resources that were allocated during process execution. The operating system monitors the activities of each process to avoid synchronization problems that can occur when processes use shared resources. If processes need to communicate with one another, the operating system provides the services. Process Execution: long-term and short term scheduling and context switches - correct answer The operating system schedules process execution. First, the operating system determines which process shall be granted access to the CPU. This is long-term scheduling. After a number of processes have been admitted, the operating system determines which one will have access to the CPU at any particular moment. This is short-term scheduling. Context switches occur when a process is taken from the CPU and replaced by another process. Information relating to the state of the process is preserved during a context switch.

-The second pass completes the instructions by supplying values stored in the symbol table. Relocatable Code and Absolute Code - correct answer The output of most assemblers is a stream of relocatable binary code. In relocatable code, operand addresses are relative to where the operating system chooses to load the program. Absolute (nonrelocatable) code is most suitable for device and operating system control programming. I.e. programmer provides specific memory address instead of data storage of an indirect address that a programming language can use Binding - correct answer Binding is the process of assigning physical addresses to program variables. Binding can occur at compile time, load time, or run time. -Compile time binding gives us absolute code. -Load time binding assigns physical addresses as the program is loaded into memory. -With load time, binding the program cannot be moved! -Run time binding requires a base register to carry out the address mapping. Link Editors - correct answer On most systems, binary instructions must pass through a link editor (or linker) to create an executable module. Link editors incorporate various binary routines into a single executable file as called for by a program's external symbols. Dynamic Linking - correct answer Dynamic linking is when the link editing is delayed until load time or at run time.

Load time dynamic linking slows down program loading but calls to the DLLs are faster. Run time dynamic linking occurs when an external module is first called, causing slower execution time. Language Generations - correct answer Each language generation presents problem solving tools that are closer to how people think and farther away from how the machine implements the solution. 5th Gen: Natural Language 4th: SQL, LISP, etc. 3rd: High level language 2nd: Assembly Code 1st: Binary Machine Code Compilers - correct answer Compilers bridge the semantic gap between the higher- level language and the machine's binary instructions. 6 Phase Compiler Translation Process - correct answer Analysis Phase:

  1. Lexical analysis extracts tokens (e.g., reserved words and variables).
  2. Syntax analysis (parsing) checks statement construction.
  3. Semantic analysis checks data types and the validity of operators. synthesis phases:
  4. Intermediate code generation creates three address code to facilitate optimization and translation.
  5. Optimization creates assembly code while taking into account architectural features that can make the code efficient.
  6. Code generation creates binary code from the optimized assembly code. compilers can be written for various platforms by rewriting only the last two phases.