Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!uwvax!provolone.cs.wisc.edu!shekita From: shekita@provolone.cs.wisc.edu (E Shekita) Newsgroups: comp.os.mach Subject: Re: simple question on memory objects and copy-on-write Message-ID: <10870@spool.cs.wisc.edu> Date: 20 Jul 90 19:01:45 GMT Sender: news@spool.cs.wisc.edu Lines: 31 >Let's suppose I have a memory object server that is in charge of >paging object X. Further suppose that when a memory_object_data_request() >comes in for a page in X, my memory object server does the following: > > (1) vm_allocate()'s a page P in its virtual address space > (2) reads the requested page from disk into P > (3) provides P to Mach via memory_object_data_provided() > (4) vm_deallocate()'s P > >The question is: will P be mapped COW in step (3), or will Mach copy >P immediately in step (3)? Obviously it would be nice if P was mapped >COW in step (3), because then an unnecessary copy is avoided. Since nobody replied immediately, I ran a few tests, and using vm_statistics(), it looks like P is copied immediately in step (3) and not mapped COW... Oh well. In this case, it probably doesn't matter since the vm_allocate() in step (1) zeros P anyway, and this is as expensive as a copy. Given what takes place, the above steps are more efficiently written: (1) vm_allocate() page P once for all time when the program starts up. Then on memory_object_datarequest(): (2) reads the requested page from disk into P. (3) provide P to Mach via memory_object_data_provided(). Mach will copy the data it needs out of P. Gene