问题描述
//Shell 中循环调度的代码:
echo "Enter Total Number of Processes: "
read n
x=$limit
for ((i=0; i <$n; i++ ))
do
echo "Enter Details of Process `expr $i + 1`: "
echo “Arrival Time: “
read at[$i]
echo "Burst Time: "
read bt[$i]
(( temp[$i]=bt[$i] ))
done
echo "Enter Time Quantum: "
read qt
echo “Process ID Burst Time Turnaround Time Waiting Time “
for ((total=0,i=0; x > 0; i+=0))
do
if [[ ${temp[$i]} -le qt && ${temp[$i]} -gt 0 ]]
then
(( total = total + temp[$i] ))
(( temp[$i] = 0 ))
((counter = 1 ))
elif [ ${temp[$i]} -gt 0 ]
then
(( temp[$i] = temp[$i] - qt ))
(( total = total + qt ))
fi
if [[ ${temp[$i]} -eq 0 && counter -eq 1 ]]
then
(( $x= $x – 1 ))
echo "Process ${i} + 1 ${bt[$i]} ${total - at[$i]} ${total - at[$i] - bt[$i]} “
(( wt = wt + total - at[$i] - bt[$i] ))
(( tt = tt + total - at[$i] ))
(( counter = 0 ))
fi
if [$i -eq $n - 1]
then
$i=0
elif [ ${at[$i + 1]} -le $total ]
then
$i++
else
$i=0
fi
done
(( average_wait_time = at / n ))
(( average_turnaround_time = tt / n ))
echo "Average Waiting Time: $average_wait_time "
echo “Avg Turnaround Time: $average_turnaround_time ”
//错误:
./f1: line 60: unexpected EOF while looking for matching `"'
./f1: line 63: Syntax error: unexpected end of file
我不明白出了什么问题。文件中有匹配的双引号仍然在倒数第二行显示错误。还有一些语法错误,文件意外结束。有人可以帮我吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)