资 源 简 介
fifo lru opt 页面置换调度算法
void LRU(int pagenum, int treq) {
int i,j, count = 0;
int effect = 0;
pageInit();
for (i = 0; i < treq; i++){
if (vp[req[i]].mp == INVALID) {
if (count < pagenum) {
vp[req[i]].mp = count;
mp[count] = req[i];
count++;
for (j = 0; j < count; j++) {
vp[mp[j]].dura++;
}
}
else {
int maxtime = 0, maxtimevpNum = 0;
for (j = 0; j < pagenum; j++) {
if (vp[mp[j]].dura > maxtime){
maxtime = vp[mp