From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Wed, 10 Oct 2018 19:34:39 +0200 From: cinap_lenrek@felloff.net To: 9fans@9fans.net In-Reply-To: 1806122E-7160-403A-A2F0-027E5E77E31A@bitblocks.com MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] PDP11 (Was: Re: what heavy negativity!) Topicbox-Message-UUID: eb505eba-ead9-11e9-9d60-3106f5b1d025 > But the reason I want this is to reduce latency to the first > access, especially for very large files. With read() I have > to wait until the read completes. With mmap() processing can > start much earlier and can be interleaved with background > data fetch or prefetch. With read() a lot more resources > are tied down. If I need random access and don't need to > read all of the data, the application has to do pread(), > pwrite() a lot thus complicating it. With mmap() I can just > map in the whole file and excess reading (beyond what the > app needs) will not be a large fraction. you think doing single 4K page sized reads in the pagefault handler is better than doing precise >4K reads from your application? possibly in a background thread so you can overlap processing with data fetching? the advantage of mmap is not prefetch. its about not to do any I/O when data is already in the *SHARED* buffer cache! which plan9 does not have (except the mntcache, but that is optional and only works for the disk fileservers that maintain ther file qid ver info consistently). its *IS* really a linux thing where all block device i/o goes thru the buffer cache. -- cinap