Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I mean that if its true always that first lower addresses are used and then increment the address to access higher address. Can it be in reverse order?

share|improve this question

You haven't specified an exact context. But this can be answered for most typical cases (as e.g. x86):

  • Some initial address space is reserved, to protect against memory access on NULL pointer dereferencing.
  • Then, memory is allocated according to process start specifics and can be intermixed between runtime loader, its data, the main binary, its data, etc. - all this is usually allocated with incrementing in VM page size steps.
  • Then, a large area is used to place dynamic libraries, page-based heap allocation, etc. - again, incremented for allocating. But, if the program is multithreaded, it will allocate thread stacks which are committed in reverse order (for most processors, including x86).
  • Then, a sbrk-based sequential allocation can be used for the heap.
  • Then, the main thread stack is placed. It allocations are likely committed in reverse order (see above).
  • Then, the kernel area is placed; the only thing an application shall know is that it shan't access this area without explicit permission.

So, you likely will see allocations in both directions in virtually every program.

This can differ on other architectures.

share|improve this answer
the context i was looking was in big endian and little endian . some says big endian mean storing the MSB first and in little endian means storing LSB first. If thats the case then does it matter that wherever they are stored is higher memory or lower memory(that means the only importance is given to which byte is stored first , unrelated to higher or lower memory) – mrigendra Apr 23 '14 at 7:07
@mrigendra: big endian or little endian is only relevant regarding the order of bytes. About the whole memory usage, big endian and little endian are the same (roughly from low to high). – Ouki Apr 23 '14 at 7:33
so focus should be on 'storage of bytes in which order' rather 'storage of bytes in which order + high memory or low memory'. – mrigendra Apr 23 '14 at 11:02
With last changes I don't see principal difference between BE and LE architectures. In both if you store 4 byte value at address N they will occupy bytes N...N+3. Yep, saving order differs, but none will save as N-3...N. Does it reply your question? – Netch Apr 23 '14 at 12:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.