size for paging ..

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
asdfgh
Member
Member
Posts: 42
Joined: Fri Apr 18, 2008 9:14 pm

size for paging ..

Post by asdfgh »

should paging be implemented for 4gb...
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Post by bewing »

Every independent address space needs to have at least a few pages to itself. To separate code from data, and to allow the most convenient form of shared memory/memory based-IPC.

With that much RAM, you should expect to see very little swapping. Which means that all the currently running apps will be in memory. So, I'd say that 1024 total memory pages is too few to run a real OS on. 4096 total pages might barely be workable.

Most apps are small. That is, they use less than 100K of RAM. So pages that are signifcantly bigger than that will always be mostly empty -- and cannot be used by other apps.

So, for anything less than perhaps 16GB of actual RAM, I'd probably advise sticking to 4KB pages. Above that size, maybe consider the next size up.
Ready4Dis
Member
Member
Posts: 571
Joined: Sat Nov 18, 2006 9:11 am

Post by Ready4Dis »

Is that even a question? Have you read anything about paging? Please do some research, formulate a question, and then ask again. You can enable paging for 32-bit (4gb), 36-bit (64gb), or 64-bit (Not sure, i don't use it, i think it's actually 48-bit though, but it's a whole lot). You can imlpement one or all 3 of these depending on the support of the CPU (64-bit only available to 64-bit CPU's). Just because you enable 36-bit paging doesn't mean you have to map the entire 64-gb memory region, you can chose to only map 1mb if you want (obviously there isn't much of a point if that was the case, but you get my point hopefully).
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: size for paging ..

Post by Brendan »

Hi,
asdfgh wrote:should paging be implemented for 4gb...
Hmm...

Should paging be implemented for 4 GB linear address spaces? For a 32-bit OS you can't implement any other size linear address space (but some parts of each linear address space are typically marked as "not present").

Should paging be implemented with 4 GB of "user space"? IMHO definitely not - most processes don't need more than 2 GB, and when a process does need more than 2 GB it typically needs something larger than 4 GB (ie. a 64-bit CPU). It also adds a huge amount of overhead (trashing TLBs every time the kernel API is called or an IRQ occurs), so it's mostly not worth bothering with.

Should paging be implemented for 4 GB of physical address space only? If your OS is for old computers or embedded systems, then maybe. Otherwise no - it's relatively easy to support "plain paging" and PAE, and then use whatever the CPU supports.

Should paging be implemented for 4 GB of physical address space at all? Maybe. For example, if you don't support older computers then you could use PAE or PSE36 and wouldn't need to implement any "plain paging" code. However, if you're not interested in supporting older computers then you might want to use long mode instead.

I hope at least one of these answers is the answer you were looking for, but next time try to be a little more descriptive when asking questions... ;)


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply