How is RAM allocated?

This is a question about an informatics noob: how is a ram distributed?

For example, I use Windows. Can I find out which addresses are used by the program? How does Windows allocate memory? Adjacent or not touching? Is it the same on Linux?

And, can I access the entire bar using the program? (I do not believe it, but ...)

Do you know good lectures / documentation on this?

+4
source share
2 answers

First, when you think that you are allocating RAM, you really do not. This is confusing, I know, but it really is not difficult as soon as you understand how it works. Keep reading.

, "". 4kiB, ( , " " ( 1-4MiB) , , , Windows 4kiB 64kiB).
"", (4KiB).

, , , , , "", . ( ) , , . MMU.
, , , , (, - , , , ).

- . [ ] ( ) , ​​ . < > , "" , , ( ). , , - , ( !).

(, malloc), , ( , , , - , , ).
, . Linux sbrk mmap, Windows , , VirtualAlloc.

, 3 , , , , Linux Windows ( ), API , .

, , ( ).
, , . , ( RAM ), . , , , , . , , . , . , , . ( !), ( ), (, ). , , .

, . .

, , ( ) . , , , , . . Windows , , VMMap .

, , , , .
[] . , , , , 32 64 . , 32 , 64 . , , 32 , (, , ) .

+7

.

. , C ++, . , Java, .

, - . - , .. .

, , . , , . ++, ( ): int * i = new int;. , , std::cout << "int i is at " << i << "." << endl;.

, (, ), , Windows - contig, GNU/Linux - . Windows, , .

, ( ) . , , , , i ++; ( ).

, :

-2

Source: https://habr.com/ru/post/1527106/


All Articles