allocated space

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
HardEnough

allocated space

Post by HardEnough »

hi guys
what do u think is the best memory space i should reserve for kernel code, data, stack ?
and for user process, how much mem space i should allocate for each process (code, data, stack) ?
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:allocated space

Post by Candy »

HardEnough wrote: hi guys
what do u think is the best memory space i should reserve for kernel code, data, stack ?
and for user process, how much mem space i should allocate for each process (code, data, stack) ?
kernel data/code/stack: what it needs (depending on its size). In address space, say, half?

User process: look at the file and make space for it.
AR

Re:allocated space

Post by AR »

In physical size of the kernel, as much as you need, in terms of the address space, the conventional size is 1GB of virtual addressing.

The conventional address space size for user apps is 2GB with 1GB reserved for loading libraries (aka DLLs). In terms of preallocation, you can allocate enough space for the whole binary straight up or you can use the typical 'faulting approach' (load nothing at all and just load the program in page by page as page faults occur)
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:allocated space

Post by Solar »

2 / 1 / 1 GB, as said above, is default for most desktop systems.

Servers (proxy caches, databases, that kind of stuff) frequently require much more user data to be kept than mere 2 GB; there are solutions that allow 3 GB and more to be allocated for application data, which is very welcome in such environments.

Games also tend into that direction. Consider "World of Warcraft" with a recommended physical memory of 1 GByte or more... won't be long before games, too, will consider 2 GB of allocateable RAM to be too small.
Every good solution is obvious once you've found it.
HardEnough

Re:allocated space

Post by HardEnough »

that's for the virtual mem. but what about the physical one ?
i won't start with paging and swapping, i will be using pure segmentation so i need to know the how much mem. i need for the kernel code, data, stack .
i know it depends on the kernel but i mean in general (the average).
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:allocated space

Post by Solar »

No idea. Depends on your kernel architecture (monolithic or microkernel?), scope of your OS (generic desktop, server, game engine, embedded, ...), and many other factors that are also bound to change over time.

As for "pure segmentation"... what's your compiler of choice? I'm asking because GCC does not support segmentation, but assumes a flat memory model...

Edit: I was a bit at a loss for words, but now I found the metaphor: Your question is like asking us, "how much money should I take with me for my holiday?", but not telling us where you're going, how long you stay, and what your acount balance is. And even then we couldn't really give good advice... ;)
Every good solution is obvious once you've found it.
HardEnough

Re:allocated space

Post by HardEnough »

how much money should I take with me for my holiday?
;D i'm going to hawaii
here is the problem, i will use grub to load the kernel at 100000h, then i will create gdt with Code segment, Data segment with base 0 and limit 4 GB to access the whole ram and Code,Data,Stack for the kernel which i don't know how to set their base or limit that's all.
all i know that the kernel is loaded at 100000h which means that the base of kernel code should be 100000h but what about the limit ?
and what about data where it starts and where it ends?
the stack can be any where but what about its size ?
Post Reply