I am confused about the memory

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
User avatar
packet50071
Member
Member
Posts: 43
Joined: Sat Dec 22, 2007 2:27 pm
Location: canada

I am confused about the memory

Post by packet50071 »

I am really confused about the 4GB deal that we can access in PM mode and also I have a few questions thats i am not no clear about

1. where will my kernel load ?
2. where will I load other programs ?
3. whats happen in the 4gb space ?

thx in advance for all your help ( i did a search and Google and a lot of reading but still not clear )
Last edited by packet50071 on Sat Feb 09, 2008 3:10 pm, edited 1 time in total.
Technology is here to make things easier not harder.
User avatar
jerryleecooper
Member
Member
Posts: 233
Joined: Mon Aug 06, 2007 6:32 pm
Location: Canada

Post by jerryleecooper »

memory is a linear space between 0x00000000 and the amount of ram you have in your computer. So you can put your kernel whereever you want to into this memory space. For example, if you have 128 mb of ram, you can put your kernel at, if it's not bigger than 512kb, at 0x8000000 - 512kb maximum, or 0x0000 minimum, but be careful with addresses lower than 1mb, because they are called lower memory, where the bios and text and vga memory are located.
My own kernel loads at 1mb, each programs loads after each other, like a stack, kernel + program + program.
Paging is what's takes some pages, chunks of 4kb aligned addresses, and assembles them to pretend they are bigger pieces of data. It's the inverse of a stack.
Paging is to RAM what disk fragmentation is to hard drives.
User avatar
packet50071
Member
Member
Posts: 43
Joined: Sat Dec 22, 2007 2:27 pm
Location: canada

Post by packet50071 »

thx for clearing that :)

Whats up with the 4gb thing?
Technology is here to make things easier not harder.
User avatar
mathematician
Member
Member
Posts: 437
Joined: Fri Dec 15, 2006 5:26 pm
Location: Church Stretton Uk

Post by mathematician »

You can load your kernel anywhere you link it to load, but generally speaking it can only load in one place because there is no way of relocating the memory references it contains.

Similarly, you can load applications anywhere you want, but once the OS is up and running you can relocate them by using paging - that is the hardware and OS between them conspire to fool the application into thinking that it is loaded at one address when it is in fact loaded at another, and perhaps not even in contiguous memory.

4Gb is simply the maximum amount of memory you can address with 32 bits.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

packet50071 wrote:Whats up with the 4gb thing?
Well, What's 2^32? ;)
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
packet50071
Member
Member
Posts: 43
Joined: Sat Dec 22, 2007 2:27 pm
Location: canada

Post by packet50071 »

true :oops:

thx
So how can i figure out where grub loaded my OS !
the variables that i declared in my kernel where will they be ?
Technology is here to make things easier not harder.
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Post by bewing »

In the message where grub loads your kernel, it says what the load address is. It's almost always at 1M (0x100000).
Post Reply