Hi Matteo,

> If not using an HW crypto engine, the code doesn't have locks, but I
> tried it anyway on a quad core machine:
> 
> $ time ./sha1sum 2g.bin
> 752ef2367f479e79e4f0cded9c270c2890506ab0  2g.bin
> 
> real    0m2.198s
> user    0m0.000s
> sys     0m2.198s
> $ for i in {1..4}; do time ./sha1sum 2g.bin & done
> [1] 27893
> [2] 27894
> [3] 27896
> [4] 27897
> 752ef2367f479e79e4f0cded9c270c2890506ab0  2g.bin
> 
> real    0m2.367s
> user    0m0.001s
> sys     0m2.367s
> 752ef2367f479e79e4f0cded9c270c2890506ab0  2g.bin
> 
> real    0m2.374s
> user    0m0.000s
> sys     0m2.365s
> 752ef2367f479e79e4f0cded9c270c2890506ab0  2g.bin
> 
> real    0m2.383s
> user    0m0.001s
> sys     0m2.383s
> 752ef2367f479e79e4f0cded9c270c2890506ab0  2g.bin
> 
> real    0m2.383s
> user    0m0.001s
> sys     0m2.382s
> 
> [1]   Done                    time ./sha1sum 2g.bin
> [2]   Done                    time ./sha1sum 2g.bin
> [3]-  Done                    time ./sha1sum 2g.bin
> [4]+  Done                    time ./sha1sum 2g.bin

So there is no bottleneck here. Perfect.

> If you're using an HW crypto engine, locking can happen depending on
> how the hardware works, but such chips can be 100x faster than CPUs so
> it's not an issue.

This is understandable. Should be a win anyway, even with a small number
of processes or threads operating in parallel.

Thanks for the clarifications!

Bruno


Reply via email to