To view parent comment, click here.
To read all comments associated with this story, please click here.
"Actually, you have this problem even if you have several distinct async drivers running side by side. As soon as there are shared resources, there is a synchronization overhead."
I wasn't careful with my wording, we can run many instances of the async model within multiple threads and/or processes, which can communicate to each other using lock free message queues. So although they can share certain resources this way, it's not a shared resource in the traditional "I hold the mutex" sense.
"Joking aside, I think that anything that requires some reactivity (and most drivers are included) should never, ever, depend on blocking file I/O."
I agree with you, but you do realize that this is how nearly all IO is handled in linux?
"Are all drivers fundamentally serial in nature and doing little processing ?"
I was responding to your comment about using MT graphics rendering, which I agree could benefit. However many devices are inherently serial.
"Some time ago, I was wondering about an efficient way to do an FTIR touchscreen driver."
Hey I built one myself! Drilled LED holes into a picture frame, except I used visible light.
"Blob detection and tracking might work first by locating blobs in the initial pictures the brute-force way"
That's a delightful project, I built something very similar in college, but they took down the project page. This is exactly the kind of thing I wanted to do with my degree!
"Interesting problem, actually. I think once one thread starts to hog the memory bus like this, we're doomed anyway".
Yes, but the point of my example was that IO bound processes don't benefit by running in parallel since they can displace CPU bound processes which do run in parallel. We already seem to agree on this point.
Edited 2011-05-24 20:18 UTC




Member since:
2010-03-08
Sorry for the delay, I have been too sick for complex thinking during the last few days.
Actually, you have this problem even if you have several distinct async drivers running side by side. As soon as there are shared resources, there is a synchronization overhead.
But I'm a bit curious about why separate drivers would need to share much resources with each other. It seems that you provide an example below, though so I'm reading a bit further.
Two userpace apps read from two different files. In the threaded model, this results in two user+kernel threads blocking in the file system driver, which itself has blocked in the block device driver.
Aggggghhhhhh... Disk I/O in drivers ! u_u Banish these impure thoughts from your head before becoming a fiendish servant of Satan ! You can still see the light !
Joking aside, I think that anything that requires some reactivity (and most drivers are included) should never, ever, depend on blocking file I/O. Nonblocking file I/O (like writing things is a log without caring when it's actually written to disk) is totally okay, on the other hand, but in this case we wouldn't have so much synchronization problems.
I've already admitted before that for something as I/O centric as a disk/block device driver, where there is only little processing involved, queuing events in an async model is probably best
You see, this is actually something I'm wondering about. Are all drivers fundamentally serial in nature and doing little processing ?
Some time ago, I was wondering about an efficient way to do an FTIR touchscreen driver. In case you've not heard about those, their sensitive layer uses infrared light trapped within a piece of glass through total internal reflexion, that can only be scattered outside of the glass when something (like, say, a finger) comes in contact with the it. A webcam captures the infrared image, everything from that point must be done in software.
So we have to do a webcam driver, a blob detection/tracking system, and some kind of real time video output.
Now, I don't know what kind of data comes out of a webcam, but I guess it varies from one webcam to another. Maybe some will output raw bitmap pictures, some will output jpeg frames, and some will output MPEG-ish videos with i-frames and p-frames. Most peripherals send an interrupt when their output buffer is full, so we do not know how many frames will have to be processed at once (especially for variable-sized frames like in MPEG video).
Suppose that our blob detection/tracking algorithm works with bitmap data. Then there is some amount of image conversion involved. In case the frames are sufficiently independent from each other (not guaranteed for MPEG, but certainly the case for JPEG), it's better to do the decoding in parallel because it's essentially a cpu-intensive operating, and nothing scales better on multiple cores than independent operations.
Blob detection and tracking might work first by locating blobs in the initial pictures the brute-force way (tresholding + noise removal + locating sufficiently large packs of pixels in the whole picture) and then by only looking for the blobs in a region around their former positions, based on their estimated speed. Since no writes are involved, no synchronization is needed, and looking for blobs in these slices of pictures can be done on a "one-thread-per-slice" basis, with communication between threads only needed when such slices overlap each other and it's difficult to know to which slice a blob belongs.
Edited 2011-05-24 09:53 UTC