md5sum

Rob Landley rob at landley.net
Thu Jun 18 00:17:28 UTC 2009


On Wednesday 17 June 2009 18:18:51 Cathey, Jim wrote:
> Any interest in a -jN option (like gmake) for an md5sum -c
> operation?  It's starting to look like our embedded system
> is going to be checking a file manifest at boot time, and
> we're on a dual-core MIPS so -j2 could cut the startup impact
> in half.  I envision just forking off children to do the
> individual file checks in parallel, I don't expect it to
> turn into very much code.  (And would apply to sha1sum
> as well, I'd expect.)

I've pondered making bunzip2 threaded (I broke up the toybox version to make 
that easy, but didn't get around to adding the threading stuff because it made 
the build horrific).

If you're just doing a fork you can probably do that from the calling program:

for i in file
do
  md5sum $i &
done

The real question is whether md5sum will output the results in the order you 
expect, and whether it's doing atomic writes of the whole line so that outputs 
won't overlap each other.  But then you have those same problems with an 
internally forking version.

On a semi-related note, it would be really nice if shells had some kind of 
"jobs -w 0" option to wait until there are 0 background jobs running.  I tend 
to have to do something like:

while true
do
  [ -z "$(jobs)" ] && break
  sleep .25
done

(Oddly, phrasing that as while [ ! -z "$(jobs)" ] would loop endlessly on 
Ubuntu 7.04.  Some kind of bash bug.)

Rob
-- 
Latency is more important than throughput. It's that simple. - Linus Torvalds


More information about the busybox mailing list