Part B

Cards (145)

  • Physical Memory (aka RAM) : hardware structure consisting of a linear sequence of words that hold a program during execution.
  • word is a fixed-size unit of data. Typical size is 1, 2, or 4 bytes.
  • physical address is an integer in the range [0 : n-1] that identifies a word in a physical memory of size n. The address comprises a fixed number of bits. A memory of size n requires an address size of k bits, where n = 2^k
  • logical address space is an abstraction of physical memory, consisting of a sequence of imaginary memory locations in a range [0 : m-1], where m is the size of the logical address space.
  • logical address is an integer in the range [0 : m-1] that identifies a word in a logical address space. Prior to execution, a logical address space is mapped to a portion of physical memory and the program is copied into the corresponding locations.
  • If the size of a logical address space is much larger than the average program size then a lot of space is wasted in physical memory. (T or F)
    F
  • If the size of a logical address space is much larger than the average program size then a lot of space is wasted on the disk. (T or F)
    F
  • With an address space of 1024 words, the address 6 will occupy 10 bits.
  • The word size of an address space depends on _.
    1. The # of bits in the address
    2. The # of words in the address space
    3. Neither the address or address space size Answer: 3
  • source module is a program or a program component written in a symbolic language, like C, or an assembly language, that must be translated by a compiler or assembler into executable machine code.
  • An object module is the machine-language output of a compiler or assembler generated from a source module. An object module may be self-contained and executable or multiple object modules may be linked together into a load module by a linker or linkage editor.
  • load module is a program or combination of programs in a form ready to be loaded into main memory and executed.
  • A source module is the input to the compiler .
  • An object module is the input to the linker .
  • A load module is the input to the loader .
  • System libraries may be added to a load module.
  • Program relocation is the act of moving a program component from one address space to another. This may be between two logical address spaces or from a logical address space to a physical address space.
  • Static relocation binds all logical addresses to physical addresses prior to execution.
  • Dynamic relocation postpones the binding of a logical address to a physical address until the addressed item is accessed during execution.
  • First fit always starts the search from the beginning of the list and allocates the first hole large enough to accommodate the request.
  • Next fit starts each search at the point of the last allocation.
  • Best fit searches the entire list and chooses the smallest hole large enough to accommodate the request.
  • Worst fit takes the opposite approach from best-fit by always choosing the largest available hole for any request.
  • First-fit will place a request for 10 bytes into hole B
  • Best-fit will place a request for 10 bytes into hole C
  • Worst-fit will place a request for 10 bytes into hole D
  • If the last request was placed into hole D then next-fit will place a subsequent request for 20 bytes into hole B
  • Which strategy tends to preserve large holes?
    Best fit
  • Which strategy always needs to search all holes?
    Best fit
  • External memory fragmentation is the loss of usable memory space due to holes between allocated blocks of variable sizes.
  • The 50% rule states that, if the probability of finding an exact match for a request approaches 0, one third of all memory partitions are holes and two thirds are occupied blocks. Formally, n = 0.5 m, where n is the number of holes and m is the number of occupied blocks.
    The 50% rule only refers to the number of holes but not the amount of space occupied by the holes. If the average hole size is equal to the average occupied block size then 1/3 of memory space is wasted. But a smaller average hole size implies better memory utilization since less memory is wasted on holes.
  • Swapping is the temporary removal of a module from memory. The module is saved on a disk and later moved back to memory. Dynamic relocation is necessary so that the module can be placed into a different location without modification.
  • List the order in which the modules are run (compiling to executing) :
    Source Module (Program)
    Object Module
    Load Module
  • EAX : general-purpose register
  • EBX : The register which holds the address to a value
  • Register access is done in one CPU clock cycle (or less)
  • Main memory can take many cycles, causing a stall
  • Cache sits between main memory and CPU registers
  • Memory Unit only sees a stream of :
    Addresses + Read Requests
    Addresses + Data and Write Requests
  • A pair of base and limit registers define the logical address space of a process.