Here's a good bash hack for linux 2.6. If there are less jobs in the current shell than cores in the box, then it will background the job. Otherwise it will block.

_count() {
  echo $#
}

_num_cpus() {
  [ -d /sys/devices/system/cpu/ ] && echo $(_count /sys/devices/system/cpu/*) || echo 1
}

sat() {
  local go=0

  if [ $(jobs -l | wc -l) -ge $(_num_cpus) ] ; then
    while trap '((go++))' SIGCHLD ; sleep 1 ; ((go--)) ; [ $go -eq 0 ] ; do : ; done
  fi

  $@ &

  trap SIGCHLD
}


And here's how I use it.

    for i in a b c d ; do sat lzma $i ; done