The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+16 votes
2.2k views

A certain computer system has the segmented paging architecture for virtual memory. The memory is byte addressable. Both virtual and physical address spaces contain $2^{16}$ bytes each. The virtual address space is divided into 8 non-overlapping equal size segments. The memory management unit (MMU) has a hardware segment table, each entry of which contains the physical address of the page table for the segment. Page tables are stored in the main memory and consists of 2 byte page table entries.

  1. What is the minimum page size in bytes so that the page table for a segment requires at most one page to store it? Assume that the page size can only be a power of 2.

  2. Now suppose that the pages size is 512 bytes. It is proposed to provide a TLB (Transaction look-aside buffer) for speeding up address translation. The proposed TLB will be capable of storing page table entries for 16 recently referenced virtual pages, in a fast cache that will use the direct mapping scheme. What is the number of tag bits that will need to be associated with each cache entry?

  3. Assume that each page table entry contains (besides other information) 1 valid bit, 3 bits for page protection and 1 dirty bit. How many bits are available in page table entry for storing the aging information for the page? Assume that the page size is 512 bytes.

 

asked in Operating System by Veteran (69k points) | 2.2k views

for part B:

TLB stores page table entries, it is given that page table entry size = 2B = 16 bits
#Pages = $\frac{2^{13}}{2^9} = 2^4$ so, 4 bits represents page number.
also, the virtual page address it contain will also have 9 bits to represent Page offset.

Rest we are left with tag bits, which are = 16 - 9 - 4 = 3 bits

1 Answer

+19 votes
Best answer
A)

$\text{Size of each segment} = \frac{2^{16}}{8}=2^{13}$

Let the size of page be $2^k$ bytes

We need a page table entry for each page. For a segment of size $2^{13}$, number of pages required will be

$2^{13-k}$ and so we need $2^{13-k}$ page table entries. Now, the size of these many entries must be less than or equal to the page size, for the page table of a segment to be requiring at most one page. So,

$2^{13-k} \times 2 = 2^k$ (As a page table entry size is 2 bytes)

$k=7$ bits

So, $\text{ page size } = 2^7 =  128$ bytes

B)

The TLB is placed after the segment table.

Each segment will have $\frac{2^{13}}{2^9}=2^4$ page table entries

So all page table entries of a segment will reside in the cache and segment number will differentiate between page table entry of each segment in the TLB cache.

$\text{Total segments}= 8 $

Therefore $3$ bits of tag is required

C)

$\text{Number of Pages for a segment} =\frac{2^{16}}{2^9} =2^7$

$\text{Bits needed for page frame identification} = 7 \text{ bits} \\ +1 \text{ valid bit} \\ +3\text{ page protection bits} \\ +1 \text{ dirty bit} \\= 12 \text{ bits needed for a page table entry}$

$\text{Size of each page table entry} = 2$ bytes $=16$ bits

$\text{Number of bits left for aging} = 16-12 = 4$ bits
answered by Loyal (3.9k points)
edited by
@Arjun SIr please check
@csegate2 then number of tag bits will be 4.
A TLB can have all the pages of a single segment or,many pages of difft segment?

Plz reply Sir
@arjun sir in the answer given is not conforming to the question, there are 8 segments, so no of pte bits will be  = log(2^13/2^9) + 5 = 9 bits?????? each segment has a seperate page table and each page table entry in that page table  requires 9 bits. why is he considering the entire segment as 1,there are 8 segments....
@resilient a, b, c are 3 separate questions. Which part are you referring to?
sir i am tlking about c, its given 8 segments so 2^16/8, each segment 2^13 B segmet size  i presume? and only after getting the segments i can page them to a page table i presume? so 2^13/2^9  ..so 4 bits for the entries plus the extra 5 bits, so total 9 bits.
In the question it is mentioned that VM is partitioned to 8 non overlapping segments. But what about physical memory? If that is also partitioned then what you telling is correct. But such a partition is never common nor mentioned in question. So as common in most system we must assume that each segment can address any part of physical memory.
sir in part a and part b we are assuming segment size as 2^ 13 but here 2^16, then in part a and part b also can we say each segment can address any part of physical memory? i am  a bit confused here sir.

What does a page table do?

It provides a mapping from "virtual address" to "physical address".

In parts a and b, we are interested in the number of entries in page table/TLB which should be there for every possible page (virtual). And we are given in the question that the virtual address space is divided into 8 non-overlapping segments and hence we didivded by 8.

In 3rd part, we are finding the no. of bits in each page table entry and this is based on the physical address space. We are not dividing by 8 because we are not told that physical address space is divided into 8.

Thank you sir for clearing this concept,now every thing is falling into place,crystal clear.

For part B, can I that the 16 bits in VAS would be divided as 

Tag Cache Block Block Offset
3 4 ( as there will be 16 entries) 9

And for part A, it will be as

Segment No Segment Offset Page Offset
3 6 7

Please suggest whether my understanding is correct?

^ yes u r right.

But I think there is a problem with part c because  @danish has taken 7 bits for page identification but there no such field in page table entry but this field is present in TLB.

PTE= Bits Required for storing the  frame no to which particular page of the particular segment corresponding to this Page table is mapped + bits required for aging +1 valid bit+3 page protection bits+1 dirty bit==16 bit                                                                      

No of frames in physical memory=216 / 29 = 27

So 7 bits are required to specify Frame no

PTE=7(for frame no)+1 valid bit+3 page protection bits+1 dirty bit+Bits for Aging=16 bits                                       7+1+3+1+Bits for aging=16           , So Bits for Aging=16-12=4 bits            

 

At last, someone has written things correctly.

Thankx @akb1115 for 

No of frames in physical memory=216 / 29 = 27

So 7 bits are required to specify Frame no

In Selected answer  

 

Number of Pages for a segment=$2^{16}/2^{9}=2^{7}$

This line is written is wrong and also misleading, as no. of pages for segment would be $2^{13}/2^{9}=2^{4}$ 

Every segment will have sperate Page Table in Main Memory but a page table entry contains Frame Number, not a Page number, No. of pages will decide "How many entries will be present the Page table which will be 24".  

And Each entry in the table will contain a Frame Number i.e 7 bit and other stuff.



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

33,687 questions
40,230 answers
114,268 comments
38,793 users