Reading Tanenbaum had difficulty understanding memory organization in the OS. What model is used in modern OS? Segment, page, segment-page? In particular, the embarrassment of what was said about compilers led to the fact that for them the use of segment organization of memory is much more convenient, but the compiler is launched in the OS. This is confusing. As I understand how to work with memory is implemented in the OS, but can the program change this way?

  • in particular, osx (it has the linux kernel), gnu linux (and here the linux kernel), windows use a scheme with virtual memory and pages. - Naumov
  • @Naumov Isn’t virtual memory a “add-on” over these views? Is segmented generally absent in top OS? If so, where is it used in modern times? For some reason I came to the conclusion that segment-page is used. Apparently you need to re-read everything again, and more than once. - borat_brata
  • one
    Memory may look different for different parts. At the level of hardware / OS, the paged organization has been used for a long time, for example, the x86-64 architecture in long mode does not use segmentation at all. @Naumov OS X is a derivative (inspired) from BSD, not Linux. - jfs

1 answer 1

  • In modern OS, either a page or a segment-page memory organization is used. Segmental is not beneficial in terms of the rationality of the use of physical memory (fragmentation is possible).

For all the work on translating the logical address into a physical hardware (MMU), and for the formation of rules and tables according to which the translation will be made - OS.

  • That is, the compiler (and any other program) cannot switch to a different addressing mode.

From the point of view of an application program, it (the program) is located in a linear address space of about 2 GB in size (for 32-bit windows), since 2 GB of the virtual address space is occupied by the OS code, drivers, and DLL.

I want to note that the virtual address has nothing to do with the physical one .

A very exaggerated memory management process is shown in the picture below: enter image description here

  • and specifically for each wasp do not tell? - borat_brata
  • @borat_brata, The windows operating system works with segment-page memory organization. Made so for practical reasons. When you work with a segment consisting of pages, you get the opportunity to set protection (privileges) for the same type area (for the whole segment) and not lose memory on fragmentation (pages are always the same size) - Roman