ECS154A Homework #6

WRITTEN Assignment:

  1. List 2 advantages and 2 disadvantages of memory-mapped I/O (compared to I/O-mapped I/O).
  2. Memory mapped does not require special instructions to do I/O, but you no
    longer have the entire memory available for storing data.  Opposite in the case
    of I/O mapped.  Also, it is much easier to do accidental I/O in the memory
    mapped case.
    

     
  3. A computer consists of a CPU and an I/O device connected to main memory via a 1-word shared bus. The CPU can execute a maximum of 100,000 (10^5) instructions per second. An average instruction requires five machine cycles, three of which use the memory bus. A memory read or write operation uses 1 machine cycle. Suppose that the CPU is continuously executing "background" programs that require 95% of its instruction execution rate but do no I/O. Now the I/O device is to be used to transfer very large blocks of data to and from main memory.
  4. A virtual memory system has a page size of 1024 words, eight virtual pages, and four physical page frames. The page table is as follows:
    Virtual page Number	Page Frame Number
    
            0                        1
            1                        0
            2                        3
            3                        -
            4                        -
            5                        2
            6                        0
            7                        -
    

  5.  
  6. Give reasons why the page size in a virtual memory system should be neither too large or too small.
    As the page size grows, more and more bits are used in the offset field,
    meaning the size of a page table can shrink.  Also, there are cache size
    ramifications.  However, as the page size grows, there is more and more
    fragmentation (since there are going to be more and more pages brought in that
    are not fully utilized).  It also takes a longer amount of time to bring in a
    very large page, which can be bad if you are not using much data on that page.
    

  7.  
  8. Assume a task is divided into 4 equal-sized segments, and that the system builds an 8-entry page descriptor table for each segment. Thus, the system has a combination of segmentation and paging. Assume also that the page size is 2K bytes.

  9. Consider a paged logical address space (composed of 32 pages of 4K bytes each) mapped into a 1-MByte physical memory space.

  10.  
  11. The following tables contain information about a segmented, paged virtual memory system and certain select memory locations. Total physical memory size is 2K bytes. All numbers in this table are in Hex unless otherwise noted. The processor is byte-addressable, and uses little-endian storage.
  12. ------------------------------------------------------------------------------
                    Segment Table
    
    Entry Number    Presence bit    Page Table
         0                0             0
         1                1             1
    ------------------------------------------------------------------------------
    
                            Page Table 0
    
    Entry Number    Presence bit    Disk Address    Physical Page Number
         0                0          0x443BH096             0x0
         1                1          0x08D22108             0x3
         2                1          0xF0871A09             0x1
         3                0          0x7BA54C21             0x2
    
    ------------------------------------------------------------------------------
    
                            Page Table 1
    
    Entry Number    Presence bit    Disk Address    Physical Page Number
         0                1          0x88B04136             0x2
         1                0          0xEF444219             0x0
         2                1          0x00222957             0x3
         3                1          0x28756554             0x1
    
    ------------------------------------------------------------------------------
    
    Memory
    
    Address Contents
    0x02A4  0x7230
    0x03A4  0x86a9
    0x04A4  0x9723
    0x05A4  0x3423
    0x06A4  0x8876
    0x0FA4  0x2373
    0x11A4  0x1346
    0x17A4  0x6792
    0x1EA4  0x5292
    0x37A4  0x7974
    0x3BA4  0x3205
    0x67A4  0x6623