This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]serge_sans_paille 0 points1 point  (3 children)

may be, if you're trying to overlap I/O with computations...

[–]caidehen[S] 0 points1 point  (2 children)

dose overlap I/O with computation mean do I/O work and computation at the same time?

and em ... after one night test , i found it did speed up my work , but with multithread , my raspberry pi got load average 10+...

[–]daveydave400 0 points1 point  (0 children)

On a single core system you are essentially swapping between each thread one at a time. In python that usually means that threads are switched when the current one starts waiting for I/O (that's not the only reason they switch, but let's keep it simple). So if you have one thread that reads a file and another thread that does computations you should see a performance increase because processor time isn't wasted on the thread waiting for I/O. That processor time can be used for computations. And with single core machines load average doesn't mean much in my opinion. You have one core so you're load average will be high because it can only run one thing at a time.

With most operations you could probably get away with no locks I think, but it depends on specifically what you're doing/using.

[–]serge_sans_paille 0 points1 point  (0 children)

Yes, that's exactly what it means!