Hard Disk DMA
Posted: Sun Jan 02, 2005 10:24 am
I have been working on an Operating System for a Science Fair Project. I have begun to do some simple benchmarking tests, and have noticed that my code for reading a sector from the hard disk drive is over 30 times slower than similar code in the linux kernel (using the read system call). At first I attributed this to caching, but further tests revealed that even when the data was not cached, it was read significantly faster than it was read using my kernel.
Currently I am reading from the hard disk using port i/o, which dates back to the 286. I have tried to write a DMA driver, but am having trouble with this. I have written a DMA driver for floppy disk i/o, but apparently the floppy disk already has a hard wired DMA number (number 2), but the hdd does not. I am not sure how to set up the DMA in this case.
Also, I have seen information about Ultra DMA but this seems extremely complicated, so I think that I will avoid this if possible.
If I use regular DMA, would I gain any speed (would the reading be faster), or would that just free up CPU time? Also, does anyone have any links to any documents. tutorials, code, etc. about hard disk i/o and using the DMA.
Thanks.
Currently I am reading from the hard disk using port i/o, which dates back to the 286. I have tried to write a DMA driver, but am having trouble with this. I have written a DMA driver for floppy disk i/o, but apparently the floppy disk already has a hard wired DMA number (number 2), but the hdd does not. I am not sure how to set up the DMA in this case.
Also, I have seen information about Ultra DMA but this seems extremely complicated, so I think that I will avoid this if possible.
If I use regular DMA, would I gain any speed (would the reading be faster), or would that just free up CPU time? Also, does anyone have any links to any documents. tutorials, code, etc. about hard disk i/o and using the DMA.
Thanks.