[TUHS] mmap origin (was Systematic approach to command-line interfaces)

Paul Ruizendaal pnr at planet.nl
Fri Oct 1 21:36:27 AEST 2021

Dan wrote:

> 3BSD and I think 4.1BSD had vread() and vwrite(), which looked like 
> regular read() and write() but accessed pages only on demand. I was a 
> grad student at Berkeley at the time and remember their genesis. Bill 
> and I were eating lunch from Top Dog on the Etcheverry Hall plaza, and 
> were talking about memory-mapped I/O. I remember suggesting the actual 
> names, perhaps as a parallel to vfork(). I had used both TENEX and 
> Multics, which both had page mapping. Multics' memory-mapped segments 
> were quite fundamental, of course. I think we were looking for something 
> vaguely upward compatible from the existing system calls. We did not 
> leap to an mmap() right away just because it would have been a more 
> radical shift than continuing the stream orientation of UNIX. I did not 
> implement any of this: it was just a brainstorming session.

Thank you for reminding me of these. 

On a substrate with a unified buffer cache and copy-on-write, vread/vwrite would have been very close to regular read/write and maybe could have been subsumed into them, using flags to open() as the differentiator. The user discernible effect would have been the alignment requirement on the buffer argument.

John Reiser wrote that he "fretted” over adding a 6 argument system call. Perhaps he was considering something like the above as the alternative, I never asked.

I looked at the archives and vread/vwrite were introduced with 3BSD, present in 4BSD but marked deprecated, and absent from 4.1BSD. This short lifetime suggests that using vread and vwrite wasn’t entirely satisfactory in 1980/81 practice. Maybe the issue was that there was no good way to deallocate the buffer after use.

More information about the TUHS mailing list