Page 57 - Computer_Science_F5
P. 57

Computer Science  (a) Main memory size (M): Total number of bytes in main memory.
            (b) Cache size (C): Total storage capacity of the cache.

            (c) Block size (B): Size of each data block the cache can hold.
            (d) Cache address (A): The address to locate within the cache.
          FOR ONLINE READING ONLY

             Task 1: calculate the tag, set, and block/line offset for each mapping scheme.
              Scenario                      M (Bytes    C (Bytes)   B (Bytes)  A(Bytes)
              Direct Mapped Cache           1024        128         16        232

              2-way Set Associative Cache   4096        256         32        768
              Fully Associative Cache       2048        512         64        1536

            Steps to Calculate:
            Step1:   Calculate direct mapped cache: Cache line number , Block/line offset,
                      and Tag.
            Step 2:   Calculate  k-way set  associative  cache:  Cache  set  number, Block/line
                      offset, and Tag.
            Step 3:   Calculate fully associative cache: Cache set number, Block/line offset,
                      and Tag

            Task 2: Explore the advantages and disadvantages of each scheme.
            Deliverables:
            (a)  Cache set number, Block/line offset and tag for each scheme
            (b)  Advantages and  and disadvantages of each scheme. Document your findings
                 in a potifolio.



                Exercise 1.10

             1.  Describe the LRU replacement algorithm
             2.  What would the k-way set associative mapping become, if k = 1?
             3.  How many sets does a fully set associative mapping have?


           Primary and secondary memory

           Primary memory, also known as main memory, includes RAM and cache memory,
           which provide fast and temporary storage directly accessible by the CPU for active
           processes and data. Secondary memory, such as hard drives and SSDs, offers larger,
           permanent storage for data and programs that are not in immediate use, with slower
           access speeds compared to primary memory.


                                                  48
                                                                for Advanced Secondary Schools



     Computer Science Form 5.indd   48                                                      23/07/2024   12:32
   52   53   54   55   56   57   58   59   60   61   62