I am coding an I/O system at the moment.
I have skeleton mounting/opening done and am working on the read function. But I need to get my head around how it will work in practice.
A call is made to Read(handle, buffer, bytesneeded) to the IO manager. This has to check whether this is partially cached already and make IO requests to the device driver underneath to read in blocks as needed, caching ahead and behind for performance.
So, how to logically do this, should I loop through the number of bytes needed block by block, reading in or using the cache as necessary or should I have some sort of pre-load function and lock the cache pages in memory until all is read??
For example, say a disk block is 1K but the IO cache works in 4K chunks.
Should I deal with the beginning and end partial blocks in a dissimilar manner to the middle full blocks?
I have virtually got this clear in my head, but as usual opinions are greatly appreciated from the OS God's on here!
Daryl.
Device I/O
- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Device I/O
most OSes i know group disk sectors so that a 'logical block' has the same size as a memory page (and therefore simplify the problem you face)