retagged by
270 views
0 votes
0 votes

Consider the following $\text{C}$ function executed in an $\text{OS}$ with paging where the page size is $4$ kilobytes. Further, assume that the system employs a $32-$ entry direct mapped $\text{TLB}$

int *alloc_and_init()

{
int counter, value = 0, size = 2048;
int *new_ptr = malloc(size * sizeof(int));
    /* Assume sizeof(int)  = 4 and new_pyr is 4KB aligned */
for(counter = 0; counter<size; new_ptr++, counter++)
        *new_ptr = value;
return new_ptr;
}

Assuming no page faults and no context switches during execution of the program, what is the number of $\text{TLB}$ misses during the execution of the for loop?

  1. $2048$
  2. $2$
  3. $0$
  4. $1$
retagged by

Please log in or register to answer this question.

Answer:

Related questions