On Tuesday, February 10, 2015, Maziar Mehrabi <[email protected]>
wrote:

> Hi,
>
> I wonder why multithreading causes latency.
> My understanding is that having concurrent threads should improve
> performance.
> Is there any explanation for this?
>
> Thanks,
>
>
Without any knowledge of the code in question: concurrency can increase
overall throughput (for particular kinds of task) but increased latency is
a common payoff.

Imagine each thread as a separate decoder with carefully controlled access
to some common data/state. To fully decode the Nth frame probably requires
at least a partial decode (possibly a complete decode) of the N-1 frame.
Therefore although the decoding for the Nth frame may happen on a separate
processor core, it's likely not truly independent of the other cores.

So if you have 4 threads, T4 is waiting on T3, which is waiting on T2 and
on T1. Even though T1 may have finished frame 1, it probably can't fully
decode frame 5 until 4 is available from T4...

But that's just my guess!
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to