To Thread or not to Thread....?

Jack Keegan whatsjacksemail at gmail.com
Wed Dec 1 06:50:46 EST 2010


Hi Antoine,

On Wed, Dec 1, 2010 at 9:24 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>
>
> The main question IMO: the I2C bus operates at 400kHz, but how much
> received data can it buffer? That will give you a hint as to how much
> latency you can tolerate.
>
I'm not sure on buffering, but I have to ask the device on the I2C bus for a
sample each time I want one. This is done by sending out the address of the
device on the I2C bus, waiting for a reply, then addressing the registers I
want to read data from, then read the data. Therefore, I would need to make
the request at the rate I require.

>
> I don't think soft threads would work at all, since they wouldn't allow
> overlapping between frame reading and other ops. If frame reading
> releases the GIL (as any properly implemented IO primitive in Python
> should), then at least you can try using OS threads.
>
It's actually a separate piece of hardware that does the frame
reading/encoding. I then interface to this via a DLL so I'm not sure how it
handles things in the background. Unless I am mistaken, I have to allocate a
chunk of memory for it to read the frames into, while I read from there.
It's probably some sort of ring buffer implementation so I'd have to read
the frames out and store them to disk before the next run through the buffer
overwrites the old frames.

How does that sound, process/thread wise?

Thanks,

Jack


-- 
The earth is a very small stage in a vast cosmic arena. Think of the rivers
of blood spilled by all those generals and emperors so that in glory and in
triumph they could become the momentary masters of a fraction of a dot.
- Carl Sagan [Pale Blue Dot]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101201/f7b9162a/attachment.html>


More information about the Python-list mailing list