previous | start | next

Copy on Write

        mmap(NULL, size, PROT_READ, MAP_PRIVATE | MAP_ANON, 0, 0);
                                                            |  |
                                                           fd, offset
     

MAP_PRIVATE indicates a copy on write segment will be created.

MAP_ANON and fd = 0 indicates there is no associated named file and the segment pages will be demand-zero.

The associated anonymous file is filled with zeros, but when a page fault occurs, no data is actually read from the file. The physical page is simply filled with zeros and the virtual page is marked valid.

Pages mapped to anonymous files like this are called demand-zero pages.



previous | start | next