Linux:Check Available Memory


in last post we saw how to ask for all physical memory

lets see Maximum memory can be allocated.

memory3.c

run the code above to see maximum memory your linux distribution can allocate on your machine.

if allocation fails that means memory is full

program gets terminated.

reason behind allocating more memory is swap space

linux implements a demand paged virtual system.

All memory seen by user is virtual .

that means ,it doesn’t actually exists at physical address the program uses.

linux divides all memory into pages, generally 4096 bytes per page.

when program tries to access memory virtual to physical memory translation is done and time taken depends on your hardware.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s