How much can you read at once?

Posted by Doug Fri, 18 Nov 2005 21:06:22 GMT

I was recently asked how much data you can read from disk at once. In retrospect, I think it was something of a trick question. There are a couple of factors that affect this. First, the disk has a limit on it’s buffer sizes and how much it can read at once. Second, the system bus has some limit on how much data it can pass around. Third, the kernel probably has some limit on it’s buffer sizes too. Finally, your application makes a read(2) syscall with a buffer and buffer size. I wasn’t really sure which of these buffer sizes he was after and he wasn’t very forthcoming on what he was looking for.

Honestly, I didn’t really know the answer. I’ve done some kernel programming with mass storage devices; but that was over USB. That protocol isn’t really designed for mass data transfer that well. The max packet size is pretty low. At or below the kernel I don’t really have any good way of knowing what’s what and how large buffers are.

In userland I know you’re supposed to wrap your calls to read in a while loop capturing the return value of the number of bytes read. In practice, how much does a single read syscall read? I didn’t really know. Frankly, I’m not sure he did either. He was telling me it was probably something around 64KB. I was sure it had to be higher than that; at least in the MB range.

It was nagging at me so much, I decided to test and measure. I wrote this little blocksize.c program to try and figure it out. Basically, I tried different sized buffers and reading from various sources each time tracking how many times I had to call read and how much data was passed in each time. On my Mac with 1.25GB of real memory, I never could make it do anything less than a single syscall! I had a 1GB VOB file laying around that I had ripped from a DVD. Even in that case, my test program read the whole thing into memory! Of course, most of my system was swapped out. I make no claims for efficiency, but a single syscall is all that was required.

Posted in ,  | 2 comments

Refurbished Monitors

Posted by Doug Wed, 12 Oct 2005 15:32:05 GMT

21-inch Sony GDM-5010DPT at Accurate ITThis sounds like a sellout post, but I’d like to make a plug for Accurate IT. They sell refurbished and used monitors at pretty good prices. While I don’t get anything from them for posting this link, I wanted it in my blog so I could search for it easily.

My consulting company bought me a used 19” at a previous engagement. It was OK. It worked consistently and calibrated pretty well. My only complaint was that it was not as sharp as I’d like. I guess that’s the risk you take with buying used gear over the net. If I had the energy (and it was my money), I probably would have tried to work with them on getting the monitor to perform better.

Anyway, if you don’t want to drop a pile of cash on a fancy new LCD check these guys out.

Posted in  | Tags  | no comments

I have no idea what title to give this

Posted by Doug Tue, 16 Aug 2005 17:35:51 GMT

Something just happened I thought would never happen. A Microsoft Recruiter just called me. He said he found my resume by searching the net. I said, “You know I’m a Unix guy, right?” He said he knew that, but also saw I had done kernel development. He was looking for that “special type of person” who does kernel dev. I was just so stunned he was calling me I couldn’t think of anything witty to say. Yes, I’ve done kernel development. I wrote a fairly slick little USB driver for a proprietary mass-storage-like device (DataPlay). Of course, about the time my driver goes into production on shipping units they release a firmware upgrade that makes it an actual mass-storage device relegating my driver to nowhere. Anyway, I told the Microsoft guy I didn’t think it’d work out but thanks anyway. He asked me if I’d like to stay on their mailing list and get an email about every six months. I declined that too. Oh, well. I could have been a millionaire too!

When I told my coworker, he said I should have told the recruiter I’d take the spot if they’d let me do the development on my Mac. Ha! “Yea, I’ll test on whatever platform you need, but I like to development on my Mac. It’s so nice!”

Posted in ,  | 1 comment

Older posts: 1 ... 4 5 6 7 8 ... 13

Copyright 2001 - 2005 by Lathi.net and Doug Alcorn

Creative Commons, Some Rights Reserved Ruby on Rails Developer Powered by Debian GNU/Linux Powered by Typo