Re: size of page table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi vamsi,

sorry I got confused with the 4kb page size, thinking small b is for bits 
(and i think it is) 4kb turns out to 1/2 kB (B for  bytes, b for bits). 
If it is 1/2 kB the the page index will be 9. another thing is I did'nt 
cared about width of page table entry.
your explanation is quite correct. that is when we use 
inverted page table, generally we do this to optimize the space. the 
answer which i have given below is just conceptual not related to any 
architectures that is with out caring for control bits.

the page table entry should be 2 bytes(approx). bcose no of physical page 
frames = physical memory/ page size = 64MB/4KB= 16 k, we need 14 bits to 
represent(distinguish)  each physical page frame.

If we use one level page table.
Assuming the page size is 4 kilo bytes.
as you said the page index need 12 bits, and the rest 20 of virtual 
address make the virtual page number.
 The no. of virtual pages will be (2 pow 20).
the page table need to accomdate (2 pow 20) entries

Ans: size of page table= (2 pow 20) * 14 bits

approx (2 pow 20) * 2 bytes = 2MB

I think this should be the answer. Basically the confusion is b/B bits or 
bytes. The question no way concerns with any arcitecture.

any comments will be appreciated.
sorry for creating this confusion.
with regards,
 kiran


On Tue, 7 Jan 2003, Vamsi Krishna wrote:

> 
> hi scgkiran,
>   we need a excatly 12 bits to access any offset with in the page how did 
> u get 9 bits.
> generally pagetable entry also contain some additional bits for the 
> control information ie(read-only page,read-write etc..),along with 
> VPFN(virtual page frame number) and PFN(physical frame number) ,The number 
> of PFN's depend on the ramsize.and the number of VPFN's depend on the 
> virtual address space.
> 
> now we have 2 options for the number of pagetable entries
> 
>  1.we can make the number of entries in the pagetable equal to PFN
> 	in this case the number of PFN's are (64MB/4kB =16KB).
> 	so the number of entries are 16KB. now let us consider the entry 
> 	size. the first 20 bits for every logical address correspond to 
> 	VPFN's and we need 14 bits(16kB) to uniquely identify a PFN for a 
> 	VPFN,So we have 20+14 = 34 bits lets assume there are 6 control 
> 	bits so every pagetable entry takes 5 bytes. and the number of 
> 	entries are equal to PFN's so the size is 5*2^14 bytes =80KB.
> 2.if the number of entries is equal to VPFN's the we have 5MB. (we have 
> 1MB of VPFN's ie 32GB/4KB.
> 
>  	
> if i'am  wrong any where  please correct me.
> 
> reguards
> vamsi krishna
> 
> On Mon, 6 Jan 2003, Chandra G K Babu S wrote:
> 
> > 
> > the answer is 8mb, may be that is a one level page table.
> > the page size is 4kb (=4k * 1/8 = 1/2kB)
> > 32 bits of virtual address divided as 23+9,
> >  first 23 bits give the page number,
> > the 9 bits give the index in a page. the page table have to
> >  accomdate (2 pow 23) entries so the page table size is 8 mb.
> > 
> > i think this question ha nothing to do with the linux.
> > any comments?
> > 
> > with regards,
> > kiran
> > On Mon, 6 Jan 2003, Rupa wrote:
> > 
> > > 
> > > Actually this was the question asked in some exam. I do no how to calculate
> > > size of page table. They had given 4 answers...
> > > i)16mb ii)8mb
> > > iii)2mb iv) 24mb
> > > 
> > > You have any idea?
> > > 
> > > Regards,
> > > Rupa
> > > ----- Original Message -----
> > > From: "Raghu R. Arur" <rra2002@cs.columbia.edu>
> > > To: "Rupa" <rupa.ramakrishna@ionidea.com>
> > > Sent: Monday, January 06, 2003 11:47 AM
> > > Subject: Re: size of page table
> > > 
> > > 
> > > >
> > > > Hi,
> > > >
> > > >  If you are talking about linux, the page table size is not related to the
> > > > memory size (RAM size). page table is for per process and in linux each
> > > > process will have 4GB of memory allocated. 3 GB for the user space and 1
> > > > GB for the kernel space.
> > > >
> > > >  HTH,
> > > > raghu
> > > >
> > > > On Mon, 6 Jan 2003, Rupa wrote:
> > > >
> > > > > Hello,
> > > > >     I have small doubt regarding the sizeof page table. Consider a
> > > machine with 64MB physical memory and a 32 bit virtual address space. If the
> > > page size is 4kb, what is the approximate size of page table.?
> > > > > Any help will be useful
> > > > >
> > > > > Rupa
> > > > >
> > > >
> > > 
> > > --
> > > Kernelnewbies: Help each other learn about the Linux kernel.
> > > Archive:       http://mail.nl.linux.org/kernelnewbies/
> > > FAQ:           http://kernelnewbies.org/faq/
> > > 
> > 
> > 
> 
> 

-- 
A 105, Hall-IV
IIT Kanpur,
Pin- 208016,
Phone # 
Dept.	(0512)	597653,
Hostel	(0512)	597114,
		597314




--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux