1
$\begingroup$

I'm doing C programming stuff, and I'd like to know little bit about memory management - My problem is that I'm not understanding where the computer (or the OS or the programs) stores the information related to allocated space and how the unallocated space information is processed and how it is reported as a runtime error.

I did many searches but didn't find any information about this stuff yet. Can anyone try to explain, or recommend any book or online course?

$\endgroup$
  • 2
    $\begingroup$ That sounds like a fairly broad topic. Have you read any introductory computer architecture textbooks? Have you read about virtual memory (in operating system textbooks, for instance)? $\endgroup$ – D.W. Apr 21 '17 at 17:41
3
$\begingroup$

Each page of RAM is typically a 4k block, with a set of privileges on it such as read, write, or execute. Broadly speaking, the memory manager for the operating system will allocate a bunch of pages for OS related storage, and when a program launches, it will allocate initial RAM, and as more items are allocated, the program will ask the operating system for more RAM.

From the program's point of view, the RAM is all contiguous. However, under the hood, the operating system is mapping the various blocks of system RAM, and each program's RAM.

Physically, the RAM is broken up into blocks, which are essentially unorganized, but the operating system itself has a table mapping what block belongs to each program.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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