Page 1 of 1

size for paging ..

Posted: Thu Apr 24, 2008 2:03 pm
by asdfgh
should paging be implemented for 4gb...

Posted: Thu Apr 24, 2008 2:24 pm
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.

Posted: Thu Apr 24, 2008 2:26 pm
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).

Re: size for paging ..

Posted: Fri Apr 25, 2008 2:17 am
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