[FFmpeg-user] Strange CPU usage when running multiple ffmpeg instances

Nicolas George george at nsup.org
Mon Aug 25 21:03:44 CEST 2014


L'octidi 8 fructidor, an CCXXII, Tal Maoz a écrit :
> One would expect the CPU usage per instance to remain the same, right

Not with hyperthreading. Hyperthreading is like multitasking on a single
core, only with a time-slice of about one CPU instruction (and no context
switch overhead). When a single thread is running, it gets 100% of the CPU
speed, but when two threads are running doing roughly the same thing, they
both get about 50% of the CPU speed.

You can try this (zsh syntax):

for i in {1..4}; { openssl speed aes > $i.txt & }

You will notice that all have roughly the same speed, and the same speed as
a single instance alone. Now replace 4 by 8: all will go at about half
speed.

But as seen by the operating system, and therefore as visible in any process
accounting tool, the threads are not sleeping, they are both running on two
CPUs, each twice slower than normal. So they need twice the same amount of
CPU to perform their task.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20140825/26367d99/attachment.asc>


More information about the ffmpeg-user mailing list