zwilling@edam.cs.wisc.edu (Mike Zwilling) (03/28/90)
I have a question concerning physical memory sharing among multiple clients of an external pager. Consider the following scenario: Assume we have one the same machine an external pager with 2 clients. Client 1 uses memory_object_1 and client 2 uses memory_object_2. Both memory objects are maintained by the same external pager. Further assume that page 1 in each object is identical (eg. in the same file) and that each client requires only read access to page 1. Now, it would be preferable for the clients to share the same physical page containing page 1 (since they are not writing the page). This could be "implemented" by return a pointer to the same data in the memory_object_data_provided calls. It is my understanding that when the external pager provides a pointer to the data, the data is mapped copy-on-write in the client thus giving the sharing I want. But, according to the document, "The Duality of Memory and Communication in the Implementation of a Multiprocessor Operating System", each physical page has a *resident page* structure containing *the memory object* associated with the page. So, my question is, will physical page be shared in the above scenario or will a copy be done behind-the-scene? If the page is shared, I'm curious as to how that is implemented. Note: I do realize that sharing would occur if each client mapped the same memory object. But, I'm interested in the case where they don't. Thanks for any help, and if the question isn't clear, just let me know. Mike -- Mike Zwilling University of Wisconsin -- Madison Computer Sciences Dept. 1210 W. Dayton St. Madison, WI 53706 email: zwilling@cs.wisc.edu ph# (608) 263-4076
Richard.Draves@CS.CMU.EDU (03/29/90)
> Excerpts from netnews.comp.os.mach: 27-Mar-90 External pagers and > sharing Mike Zwilling@edam.cs.wi (1766) > I have a question concerning physical memory sharing among multiple > clients of an external pager. Consider the following scenario: > Assume we have one the same machine an external pager with 2 > clients. Client 1 uses memory_object_1 and client 2 uses > memory_object_2. Both memory objects are maintained by the > same external pager. Further assume that page 1 in each object > is identical (eg. in the same file) and that each client requires > only read access to page 1. Now, it would be preferable for the > clients to share the same physical page containing page 1 (since > they are not writing the page). This could be "implemented" by > return a pointer to the same data in the > memory_object_data_provided calls. Unfortunately, no. The VM implementation doesn't allow sharing of physical pages among multiple memory objects. You can only get sharing by mapping the same memory object multiple times. The implementation of memory_object_data_provided can't take advantage of copy-on-write; it actually copies the data you give it into the target memory object. Mach would need another page-level copy-on-write mechanism to make this kind of sharing happen. Rich