This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how do exit and _exit affect mmapped memory?


On Sun, Sep 09, 2012 at 10:29:52PM -0400, Godmar Back wrote:
> You won't find specifically this case in the kernel. It's done via the
> page cache. If you modify a page, it's marked dirty (usually via the
> TLB's dirty bit) - when a dirty page is flushed from the page cache,
> it's written back to disk.  BTW, this may not happen until some time
> later; either when the system needs the memory or when pdflush writes
> such pages to disk (every 30 seconds).

Thanks for your explanation.

> 
> I think POSIX actually guarantees that, by saying that: "If MAP_SHARED
> is specified, write references change the underlying object. "

Well, i read and somehow didn't take that as a gaurantee. But now, looking at
it againt i think you are totally right. That it indeed sound like a guarantee.


BTW, posix also says the following in the requirements to _exit
- Memory mappings that were created in the process shall be unmapped before the
process is destroyed.
- [TYM] [Option Start] Any blocks of typed memory that were mapped in the calling
process shall be unmapped, as if munmap() was implicitly called to unmap them.
[Option End]

How come munmap is explicitly mentioned for typed memory as opposed to reqular
mapping?

regards, Dmitry


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]