Path: utzoo!utgpu!watserv1!watdragon!lion!ccplumb From: ccplumb@lion.waterloo.edu (Colin Plumb) Newsgroups: comp.arch Subject: Re: mmap() vs. read() (Was: Re: the Multics from the black lagoon :-)) Message-ID: <20837@watdragon.waterloo.edu> Date: 13 Feb 90 03:11:05 GMT References: <8859@portia.Stanford.EDU> <20571@watdragon.waterloo.edu> <1990Feb12.053616.11455@Solbourne.COM> <3556@rti.UUCP> <10468@alice.UUCP> <131682@sun.Eng.Sun.COM> <1990Feb13.003010.23356@utzoo.uucp> Sender: daemon@watdragon.waterloo.edu Reply-To: ccplumb@lion.waterloo.edu (Colin Plumb) Organization: U. of Waterloo, Ontario Lines: 16 In article <1990Feb13.003010.23356@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: >In article <131682@sun.Eng.Sun.COM> gingell@sun.UUCP (Rob Gingell) writes: >>... At the very least, the read() version will be slower >>than the mmap() version by the amount of time required to effect the >>copies from kernel to program buffers... > >Assuming your MMU can do copy-on-write, why copy? Because the odds that the user's buffers are properly aligned are not very good. If read() allocated a buffer and returned a pointer to that, they'd be pretty much the same call. One thing Mach is showing is that Unix was *not* designed with paging in mind and you can do all sorts of neat tricks if you have it. -- -Colin