Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

typedef struct {
    short data[4];
} MatrixElement;

void copy_matrix(MatrixElement m1[], MatrixElement m2[], int ROWS, int COLS) {
    int i, j, k;
    for (i = 0; i < ROWS; i++) {
        for (j = 0; j < COLS; j++) {
            for (k = 0; k < 4; k++) {
                m1[i*COLS+j].data[k] = m2[i*COLS+j].data[k];
            }
        }
    }
}

void copy_matrix_transpose(MatrixElement m1[], MatrixElement m2[], int ROWS, int COLS) {
    int i, j, k;
    for (i = 0; i < ROWS; i++) {
        for (j = 0; j < COLS; j++) {
            for (k = 0; k < 4; k++) {
                m1[i*COLS+j].data[k] = m2[j*ROWS+i].data[k];
            }
        }
    }
}

 

You can assume the following conditions:

  • The matrix m1 is allocated at memory address 0, and matrix m2 immediately follows it.
  • Indices i, j, and k are kept in registers.
  • ROWS and COLS are constants.
  • The cache is initially empty before the function call.
  • The cache is write-back (i.e., only writes back to memory when a line is evicted) and write-allocate (i.e., it always allocates a line for the write).
  • The cache uses a least-recently-used replacement policy.
  • sizeof(short) == 2.

Given a direct-mapped cache of size 128 bytes with a 16-byte block size, answer the following: A. What is the cache miss rate of copy_matrix if ROWS = 4 and COLS = 8? Miss rate = _____________ %

B. What is the cache miss rate of copy_matrix if ROWS = 3 and COLS = 8? Miss rate = _____________ %

Considering a 2-way set associated cache of the same size and block size, answer the following: C. What is the cache miss rate of copy_matrix if ROWS = 4 and COLS = 8? Miss rate = _____________ %

D. What is the cache miss rate of copy_matrix_transpose if ROWS = 8 and COLS = 8? Miss rate for accessing m1 = _____________ % Miss rate for accessing m2 = _____________ %

 
 
 
 
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education