8k views

A CPU generates $32$-bit virtual addresses. The page size is $4$ KB. The processor has a translation look-aside buffer (TLB) which can hold a total of $128$ page table entries and is $4$-way set associative. The minimum size of the TLB tag is:

1. $\text{11 bits}$
2. $\text{13 bits}$
3. $\text{15 bits}$
4. $\text{20 bits}$

edited | 8k views
+1
I am having difficulty in solving virtual memory concepts involving the concept of associative caches. Can someone please provide a link where I can gain more knowledge about it .
+2
No of entries in TLB= 2^7 4-way set

so each set has 2^7/4= 2^5 sets

2^20 pages of process PTE mapped to 2^5 sets

so each set can accomodate 2^20/2^5= 2^15. so in each set to know which page among 2^15 page table entry preseent we need 15 bits.
0
Virtual memory means address of physical memory frame at which desired data is present and this address is stored in TLB for faster access .It can store upto 32 pages means 5 bit will be use to search in TLB and remaining(15bits) will be used as tag bits to check for other information like page is dirty or not, recently referred or not.
0
Doesn't virtual memory tell the size of the process ?
0

@nadeshseen Virtual memory is basically storing the code+data of a running program into main memory as well as in secondary memory(hard disk) instead of storing it fully into main memory(RAM). In this technique, the main memory remains empty so that it could be used to execute many programs simultaneously.

0

@Nitesh Singh 2 Sorry, I didn't ask the question properly. I know what VM is but in TLB each entry stores the number of bits required to address the physical memory(main memory). My question is, in the above problem instead of virtual addresses, shouldn't it be physical addresses?

Physical Address Space = Main memory Size

0

@nadeshseen First of all, It is not accurate to say TLB stores bits required to address main memory, it stores the page table of a process and relevant page table entry in page table says where the part of the process is stored in main memory. Now coming back to your query, since a process size or logical address space could be more than main memory size then some part of the process would be stored in secondary memory, now if we have to execute the part of the process which is not in main memory, then how would we do that?
If we call address in the form of physical address space to fulfil our need, we can never reach to the code which is in secondary memory but if we call it in the form of virtual memory(logical address space) then we can fetch that part of the process also and control unit of CPU replaces the required pages with earlier pages present in the main memory.

0

If some part of the process is not in main memory then page fault occurs. Now, you have to bring that part of the process in the main memory only then you can service it. You never store the logical address(/virtual address) in the page table, only the number of entries depends on the logical address space. Each entry tells where that frame is stored in the main memory and whether that frame is in the main memory or not using the dirty bit(/modified bit).

Page size of $4KB$. So, offset bits are $12$ bits.

So, remaining bits of virtual address $32 - 12 = 20$ bits will be used for indexing...

Number of sets = 128/4 = 32 (4-way set)  => 5 bits.

So, tag bits $= 20 - 5 = 15$ bits.

So, option (C).

by Active (5k points)
edited
0
Can you please tell why you simply subtracted 5 from 20? Is it because Indexing in set associative memory is done via Tag+Set bits?
0
"4-way set associative means number of lines is 4 in each set." So my question does in TLB each page table entry correspond to a line?
+2
yes block size in TLB just correspond to one entry, so 128 entries corresponds to 128 blocks and 32 sets.
0
Is the given data is sufficient to find the entry size of the TLB if yes? then how to find it? and is tag bits included in the entry size
+21

@rajat_mahajan this is the how the virtual address will be broken up into:

4KB page defines the offset = 12 bits
32 sets in the TLB defines the set = 5 bits
Remaining 32 - 17 = 15 bits will be used to define tag bits.

0
bro can you explain organization of TLB.
0
@shaik mastan @akash.dinkar2 @magma @srestha
can anyone explain how TLB is organized when it is used as Direct mapped and set-assosiative  ?
0

Dharmendra Lodhi

here people might not notice u, u can ask as a separate question...

0
Don't we need the physical address space to calculate the tlb tag ?

Virtual address space is the process size.

1
2