#! /opt/bin/dash # # os/prog/paging-policy/post.sh export PATH="/opt/bin:/bin:/usr/bin" echo "Content-type: text/html\n\n
$in\n" #exit n="15"; m="6" case "$h" in "LRU") p="LRU"; s="123456789";; *) p="FIFO"; s="123456789";; esac if [ -n "$useed" ]; then seed="$useed" msg="- seed = $seed" else x=$(perl -e "print unpack(\"C*\",$user);"); seed="${s}${x}" #echo "
s = $s, x = $x, seed = $seed" msg="" fi echo "$user - paging-policy results $msg
green = correct |
red = wrong |
Policy = $p
" #echo "
" #python3 ./paging-policy.py -s "$seed" -n "$n" -P "$P" -p "$p" -a "$a" -u "$u" -v -c # sed -e 's/) / /' -e 's/)$//' #echo "" out=$( (echo "$in"; python3 ./paging-policy.py -s "$seed" -p "$p" -n "$n" -m "$m" -c | sed -e 's/FirstIn ->//' -e 's/LRU ->//' -e 's/<-.*//') | awk -v "m=$m" 'BEGIN { v=0; print "
Time | Access | "; print "Hit or Miss | Cache (after access) |
---|---|---|---|
"v" | "a" | "; x=u["h"v"h"]; if( x != "" && x == h) color="#90EE90"; else color="#FF6347"; print ""x" | "; for(i=4;i<=NF;++i) { gsub(/[^[:digit:]]/,"",$i); c["c"v"j"$i"j"]=$i; } color="#90EE90"; for(j=0;j