Device I/O

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
DarylD

Device I/O

Post by DarylD »

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.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Device I/O

Post by Pype.Clicker »

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)
Post Reply