Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This fragment:</p> <blockquote> <p>A consequence of this design is that a virtual page that maps a file privately sees changes done to the file by other programs <em>as long as the page has only been read from</em>.</p> </blockquote> <p>is telling you that the kernel cheats a little bit in the name of optimization. Even though you've asked for a private mapping, the kernel will actually give you a shared one at first. Then, if you write the page, it becomes private.</p> <p>Observe that this "cheating" doesn't matter (doesn't make any difference) if all processes which are accessing the file are doing it with <code>MAP_PRIVATE</code>, because no actual changes to the file will ever occur in that case. Different processes' mappings will simply be upgraded from "fake cheating MAP_PRIVATE" to true "MAP_PRIVATE" at different times according to whenever each process first writes to the file. This is probably a common scenario. It's only if the file is being concurrently updated by other means (<code>MAP_SHARED</code> with <code>PROT_WRITE</code> or else regular, non-<code>mmap</code> I/O operations) that it makes a difference.</p> <blockquote> <p>I'm told that pages itself can also have permissions (read/write/execute).</p> </blockquote> <p>Sure, they can. You have to ask for the permissions you want when you initially map the file, in fact: the third argument to <code>mmap</code>, which will be a combination of <code>PROT_READ</code>, <code>PROT_WRITE</code>, <code>PROT_EXEC</code>, and <code>PROT_NONE</code>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload