• edited by
34,872 views
75 75 votes
A computer system implements a $40\;\text{-bit}$ virtual address, page size of $8\;\text{kilobytes}$, and a $128\text{-entry}$ translation look-aside buffer $\text{(TLB)}$ organized into $32$ sets each having $4$ ways. Assume that the $\text{TLB}$ tag does not store any process id. The minimum length of the $\text{TLB}$ tag in bits is ______.

9 Answers

Best answer
108 108 votes

Ans $40 - (5+13) = 22$ bits

$\text{TLB}$ maps a virtual address to the physical address of the page. (The lower bits of page address (page offset bits) are not used in $\text{TLB}$ as they are the same for virtual as well as physical addresses). Here, for $8\;\textsf{KB}$ page size we require $13$ page offset bits.

In $\text{TLB}$ we have $32$ sets and so virtual address space is divided into $32$ using $5$ set bits. (Associativity doesn't affect the set bits as they just adds extra slots in each set).

So, $\text{number of tag bits} = 40 - 5 - 13 = 22$

Following diagram shows how $\text{TLB}$ and Cache works:

• edited by
23 23 votes

Here is another way to look at it.

The lower bits of page address (page offset bits) are not used in TLB as they are the same for virtual as well as physical addresses.

remaining bits = 40-13=27

So total entries in a page table (let there be one in place of a TLB) = 2^27

So now, we want to map this Page Table to a TLB with 128 entries by the use of a 4-way set-associative mapping.

For mapping purpose,take the Page Table as main memory and TLB as cache memory and the size of a block as x.

So total number of bits for main memory are 27+x.

Now mapping MM 4-way set associatively to CM gives (tag-set-word) as (22-5-x).

So the number of tag bits are 22

8 8 votes
Total virtual address size = 40

Since there are 32 sets, set offset = 5

Since page size is 8kilobytes, word offset = 13

Minimum tag size = 40 - 5- 13 = 22
3 3 votes

Just think in terms of set-associative cache mapping used in cache organization.

Number of pages = (Total Virtual address space) / (Page size)

                                =(2^40) / (2^13) = (2)^27

No. of bits required to uniquely identify a page is 27

Assume page as a block for simplicity 

Like in the cache we take each main memory block and map it to a block in the cache

Number of blocks = 2^27,  Number of bits to uniquely identify a block =27

So here we are using 4 way set associative mapping and the total number of sets = 32

Number of bits required to uniquely identify a set =5 

So number of tag bits = 27-5 = 22 bits 

Here logic is the same just assume page bits as block bits and subtract set bits from them we can get tag bits.

The answer is 27-5 = 22 tag bits

Answer:
Position:
Show:

Related questions

103 103 votes
8 answers 8 answers
32.9k
32.9k views
go_editor asked Feb 13, 2015
32,903 views
A computer system implements $8\;\text{kilobyte}$ pages and a $32\text{-bit}$ physical address space. Each page table entry contains a valid bit, a dirty bit, three permi...
44 44 votes
5 answers 5 answers
12.5k
12.5k views
go_editor asked Feb 12, 2015
12,464 views
Consider $6$ memory partitions of sizes $200$ $\text{KB}$, $400$ $\text{KB}$, $600$ $\text{KB}$, $500$ $\text{KB}$, $300$ $\text{KB}$ and $250$ $\text{KB}$, where $\text{...
79 79 votes
13 answers 13 answers
55.7k
55.7k views
go_editor asked Feb 12, 2015
55,733 views
A system has $6$ identical resources and $N$ processes competing for them. Each process can request at most $2$ resources. Which one of the following values of $N$ could ...
53 53 votes
4 answers 4 answers
18.1k
18.1k views
go_editor asked Feb 12, 2015
18,145 views
Consider the C program below#include <stdio.h int *A, stkTop; int stkFunc (int opcode, int val) { static int size=0, stkTop=0; switch (opcode) { case -1: size = val; brea...