#!/bin/sh
mkfifo myfifo //创建管道
exec 8<>myfifo //管道与8fd绑定
rm -rf myfifo
for((i=1;i <= "$1";i++))
do
echo >&8 //分配资源
done
start=`date "+%s%N"`
for((i=1;i <= "$1";i++))
do
read -u8
{
./a.out $i //执行程序
}&
done
wait
echo "xxx"
end=`date "+%s%N"`
echo "x"
time=`expr $end - $start`
echo "Time = `expr $time / 100000`"