Re: SANE Net backend suggestion...

Klaus Espenlaub (espenlaub@informatik.uni-ulm.de)
Fri, 03 Dec 1999 09:57:04 +0100

Brian Macy wrote:
> My though is to...
> - First change the code in do_scan to make it read from the scanner if
> there is room and the buffer and the socket isn't ready for writing.
> This likely will make *zero* difference in the real world but it will at
> least make it so the logic makes more sense to me. I'll submit a patch
> once I'm reasonably happy with it.

How about using nonblocking I/O and a few calls to select here and there?
It should be possible to keep all buffers as full as possible, though it
cannot do anything about slow network connections or scanners.

> - Second change I see is to add an option to saned to enable file
> buffered scanning... that way if you never have a problem with your
> remote machines keeping up with the scanning you can use the old method
> which will most certainly use fewer resources. I'll submit a patch for
> that too. I personally don't have a problem with requiring as much temp
> space as the size of the image *if* people want to the intermediate
> buffering.

For some users it would be probably sufficient to have memory buffering
with say 20 Megs of buffer. But this is probably easily doable once you
implemented file buffered scanning. Again - select is your friend here
if you can afford some memory buffers.

> Thoughts?
>
> I take it pthreads is not common across all the platforms SANE supports.
> I seem to remember vfork being used/wrapped and it does something funky
> under OS/2. Anyways, this is doable without threading... though nicer
> with it since both scanner and socket IO could be done in parallel.

I can't check (no OS/2 installation around), but is select() and nonblocking
I/O available on OS/2? Or can it be replaced in a reasonable way by
asynchronous I/O? I usually prefer the single process solution to the
double buffering required to keep the equipment busy. Threads and (v)fork
are for more complicated cases.

-- 
Klaus Espenlaub                      Email:  espenlaub@informatik.uni-ulm.de
Universitaet Ulm                     Phone:  +49 731 50-24178
Abteilung Rechnerstrukturen          Fax:    +49 731 50-24182
D-89069 Ulm                          Office: Building O27, Room 316

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com