-
Notifications
You must be signed in to change notification settings - Fork 18
/
pager-lru.c
51 lines (42 loc) · 1.22 KB
/
pager-lru.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* File: pager-lru.c
* Author: Andy Sayler
* http://www.andysayler.com
* Adopted From: Dr. Alva Couch
* http://www.cs.tufts.edu/~couch/
*
* Project: CSCI 3753 Programming Assignment 4
* Create Date: Unknown
* Modify Date: 2012/04/03
* Description:
* This file contains an lru pageit
* implmentation.
*/
#include <stdio.h>
#include <stdlib.h>
#include "simulator.h"
void pageit(Pentry q[MAXPROCESSES]) {
/* This file contains the stub for an LRU pager */
/* You may need to add/remove/modify any part of this file */
/* Static vars */
static int initialized = 0;
static int tick = 1; // artificial time
static int timestamps[MAXPROCESSES][MAXPROCPAGES];
/* Local vars */
int proctmp;
int pagetmp;
/* initialize static vars on first run */
if(!initialized){
for(proctmp=0; proctmp < MAXPROCESSES; proctmp++){
for(pagetmp=0; pagetmp < MAXPROCPAGES; pagetmp++){
timestamps[proctmp][pagetmp] = 0;
}
}
initialized = 1;
}
/* TODO: Implement LRU Paging */
fprintf(stderr, "pager-lru not yet implemented. Exiting...\n");
exit(EXIT_FAILURE);
/* advance time for next pageit iteration */
tick++;
}