Add a7
This commit is contained in:
parent
40bb239616
commit
e43bf362d4
42
Assignment7/code/template.c
Normal file
42
Assignment7/code/template.c
Normal file
@ -0,0 +1,42 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#define OFFSETBITS 12
|
||||
#define PAGESIZE (1 << OFFSETBITS)
|
||||
#define PAGETABLEBITS 10
|
||||
#define ARCH 32
|
||||
int framesSize;
|
||||
unsigned int pageFault=0;
|
||||
unsigned int pageHits = 0;
|
||||
unsigned int pagesSwapped = 0;
|
||||
|
||||
void printPhysicalAddress(int frameID, unsigned long logicalAddress){
|
||||
// printf("%lu -> %i\n",logicalAddress,frameID*PAGESIZE+getPageOffsetAddress(logicalAddress));
|
||||
}
|
||||
|
||||
double computeFormula(){
|
||||
// TODO work on that
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv){
|
||||
framesSize = atoi(argv[1]);
|
||||
unsigned long logicalAddress;
|
||||
char operation;
|
||||
printf("Logical addresses -> Physical addresses:\n");
|
||||
while(EOF != scanf("%c %lu\n",&operation,&logicalAddress) )
|
||||
{
|
||||
if (operation == 'r')
|
||||
{
|
||||
// readFromAddress(logicalAddress);
|
||||
}
|
||||
else
|
||||
{
|
||||
// writeToAddress(logicalAddress);
|
||||
}
|
||||
}
|
||||
|
||||
printf("\nStats:\nmajor page faults = %u\npage hits = %u\npages swapped out = %u\nEffective Access Time = %.3lf\n",pageFault,pageHits,pagesSwapped, computeFormula());
|
||||
return 0;
|
||||
}
|
BIN
Assignment7/documentation/Assignment 7.pdf
Normal file
BIN
Assignment7/documentation/Assignment 7.pdf
Normal file
Binary file not shown.
BIN
Assignment7/documentation/a7-tests-v2.zip
Normal file
BIN
Assignment7/documentation/a7-tests-v2.zip
Normal file
Binary file not shown.
7
Assignment7/in/algo-check-2.in
Normal file
7
Assignment7/in/algo-check-2.in
Normal file
@ -0,0 +1,7 @@
|
||||
r 1124955998
|
||||
w 794845611
|
||||
w 1540976830
|
||||
w 1124957700
|
||||
w 1081961846
|
||||
w 794845440
|
||||
r 1540976645
|
7
Assignment7/in/algo-check-o.in
Normal file
7
Assignment7/in/algo-check-o.in
Normal file
@ -0,0 +1,7 @@
|
||||
r 1124955998
|
||||
r 794845611
|
||||
r 1540976830
|
||||
r 1081961846
|
||||
r 1124957700
|
||||
r 794845440
|
||||
r 1540976645
|
7
Assignment7/in/algo-check.in
Normal file
7
Assignment7/in/algo-check.in
Normal file
@ -0,0 +1,7 @@
|
||||
r 1124955998
|
||||
r 794845611
|
||||
r 1540976830
|
||||
r 1124957700
|
||||
r 1081961846
|
||||
r 794845440
|
||||
r 1540976645
|
8
Assignment7/in/discard-test.in
Normal file
8
Assignment7/in/discard-test.in
Normal file
@ -0,0 +1,8 @@
|
||||
r 1622650073
|
||||
r 1144108930
|
||||
r 101027544
|
||||
r 1784484492
|
||||
r 823378840
|
||||
r 197493099
|
||||
r 1954899097
|
||||
r 530511967
|
7
Assignment7/in/fromText.in
Normal file
7
Assignment7/in/fromText.in
Normal file
@ -0,0 +1,7 @@
|
||||
r 1124955998
|
||||
r 794845611
|
||||
r 1540976830
|
||||
w 1081961846
|
||||
r 1124957700
|
||||
r 794845440
|
||||
r 1540976645
|
8
Assignment7/in/major-test.in
Normal file
8
Assignment7/in/major-test.in
Normal file
@ -0,0 +1,8 @@
|
||||
w 1622650073
|
||||
w 1144108930
|
||||
w 101027544
|
||||
w 1784484492
|
||||
w 823378840
|
||||
w 197493099
|
||||
w 1954899097
|
||||
w 530511967
|
8
Assignment7/in/page-hit-test.in
Normal file
8
Assignment7/in/page-hit-test.in
Normal file
@ -0,0 +1,8 @@
|
||||
r 1725896583
|
||||
r 1725896583
|
||||
r 1725898287
|
||||
r 1725894961
|
||||
r 1725896008
|
||||
r 1725898705
|
||||
r 1725898485
|
||||
r 1725897033
|
40
Assignment7/makefile
Normal file
40
Assignment7/makefile
Normal file
@ -0,0 +1,40 @@
|
||||
SDIR=./code
|
||||
INDIR=./in
|
||||
OUTDIR=./out
|
||||
STDOUTDIR=./student_out
|
||||
|
||||
_OBJ=./a.out
|
||||
|
||||
CC=gcc
|
||||
CFLAGS= -O0 -g -lm -std=c99
|
||||
DIFF=diff
|
||||
|
||||
all:
|
||||
$(CC) $(CFLAGS) $(SDIR)/*.c -o $(_OBJ)
|
||||
1:
|
||||
./a.out 3 < ./in/algo-check.in > ./student_out/sample_output.out
|
||||
diff ./student_out/sample_output.out ./out/sample_output.out
|
||||
2:
|
||||
./a.out 3 < ./in/algo-check-2.in > ./student_out/sample_output_2.out
|
||||
diff ./student_out/sample_output_2.out ./out/sample_output_2.out
|
||||
3:
|
||||
./a.out 1 < ./in/discard-test.in > ./student_out/discard-test-1.out
|
||||
diff ./student_out/discard-test-1.out ./out/discard-test-1.out
|
||||
4:
|
||||
./a.out 2 < ./in/discard-test.in > ./student_out/discard-test-2.out
|
||||
diff ./student_out/discard-test-2.out ./out/discard-test-2.out
|
||||
5:
|
||||
./a.out 1 < ./in/major-test.in > ./student_out/major-test-1.out
|
||||
diff ./student_out/major-test-1.out ./out/major-test-1.out
|
||||
6:
|
||||
./a.out 2 < ./in/major-test.in > ./student_out/major-test-2.out
|
||||
diff ./student_out/major-test-2.out ./out/major-test-2.out
|
||||
7:
|
||||
./a.out 5 < ./in/page-hit-test.in > ./student_out/page-hit-test.out
|
||||
diff ./student_out/page-hit-test.out ./out/page-hit-test.out
|
||||
8:
|
||||
./a.out 3 < ./in/algo-check-o.in > ./student_out/algo-check-o-l.out
|
||||
diff ./student_out/algo-check-o-l.out ./out/algo-check-o-l.out
|
||||
9:
|
||||
./a.out 3 < ./in/fromText.in > ./student_out/fromText.out
|
||||
diff ./student_out/fromText.out ./out/fromText.out
|
14
Assignment7/out/algo-check-o-l.out
Normal file
14
Assignment7/out/algo-check-o-l.out
Normal file
@ -0,0 +1,14 @@
|
||||
Logical addresses -> Physical addresses:
|
||||
1124955998 -> 1886
|
||||
794845611 -> 4523
|
||||
1540976830 -> 8382
|
||||
1081961846 -> 3446
|
||||
1124957700 -> 7684
|
||||
794845440 -> 8448
|
||||
1540976645 -> 5
|
||||
|
||||
Stats:
|
||||
major page faults = 7
|
||||
page hits = 0
|
||||
pages swapped out = 0
|
||||
Effective Access Time = 1000.000
|
15
Assignment7/out/discard-test-1.out
Normal file
15
Assignment7/out/discard-test-1.out
Normal file
@ -0,0 +1,15 @@
|
||||
Logical addresses -> Physical addresses:
|
||||
1622650073 -> 3289
|
||||
1144108930 -> 1922
|
||||
101027544 -> 3800
|
||||
1784484492 -> 652
|
||||
823378840 -> 920
|
||||
197493099 -> 363
|
||||
1954899097 -> 1177
|
||||
530511967 -> 2143
|
||||
|
||||
Stats:
|
||||
major page faults = 8
|
||||
page hits = 0
|
||||
pages swapped out = 0
|
||||
Effective Access Time = 1000.000
|
15
Assignment7/out/discard-test-2.out
Normal file
15
Assignment7/out/discard-test-2.out
Normal file
@ -0,0 +1,15 @@
|
||||
Logical addresses -> Physical addresses:
|
||||
1622650073 -> 3289
|
||||
1144108930 -> 6018
|
||||
101027544 -> 3800
|
||||
1784484492 -> 4748
|
||||
823378840 -> 920
|
||||
197493099 -> 4459
|
||||
1954899097 -> 1177
|
||||
530511967 -> 6239
|
||||
|
||||
Stats:
|
||||
major page faults = 8
|
||||
page hits = 0
|
||||
pages swapped out = 0
|
||||
Effective Access Time = 1000.000
|
14
Assignment7/out/fromText.out
Normal file
14
Assignment7/out/fromText.out
Normal file
@ -0,0 +1,14 @@
|
||||
Logical addresses -> Physical addresses:
|
||||
1124955998 -> 1886
|
||||
794845611 -> 4523
|
||||
1540976830 -> 8382
|
||||
1081961846 -> 3446
|
||||
1124957700 -> 7684
|
||||
794845440 -> 8448
|
||||
1540976645 -> 5
|
||||
|
||||
Stats:
|
||||
major page faults = 7
|
||||
page hits = 0
|
||||
pages swapped out = 1
|
||||
Effective Access Time = 1285.714
|
15
Assignment7/out/major-test-1.out
Normal file
15
Assignment7/out/major-test-1.out
Normal file
@ -0,0 +1,15 @@
|
||||
Logical addresses -> Physical addresses:
|
||||
1622650073 -> 3289
|
||||
1144108930 -> 1922
|
||||
101027544 -> 3800
|
||||
1784484492 -> 652
|
||||
823378840 -> 920
|
||||
197493099 -> 363
|
||||
1954899097 -> 1177
|
||||
530511967 -> 2143
|
||||
|
||||
Stats:
|
||||
major page faults = 8
|
||||
page hits = 0
|
||||
pages swapped out = 7
|
||||
Effective Access Time = 2750.000
|
15
Assignment7/out/major-test-2.out
Normal file
15
Assignment7/out/major-test-2.out
Normal file
@ -0,0 +1,15 @@
|
||||
Logical addresses -> Physical addresses:
|
||||
1622650073 -> 3289
|
||||
1144108930 -> 6018
|
||||
101027544 -> 3800
|
||||
1784484492 -> 4748
|
||||
823378840 -> 920
|
||||
197493099 -> 4459
|
||||
1954899097 -> 1177
|
||||
530511967 -> 6239
|
||||
|
||||
Stats:
|
||||
major page faults = 8
|
||||
page hits = 0
|
||||
pages swapped out = 6
|
||||
Effective Access Time = 2500.000
|
15
Assignment7/out/page-hit-test.out
Normal file
15
Assignment7/out/page-hit-test.out
Normal file
@ -0,0 +1,15 @@
|
||||
Logical addresses -> Physical addresses:
|
||||
1725896583 -> 1927
|
||||
1725896583 -> 1927
|
||||
1725898287 -> 3631
|
||||
1725894961 -> 305
|
||||
1725896008 -> 1352
|
||||
1725898705 -> 4049
|
||||
1725898485 -> 3829
|
||||
1725897033 -> 2377
|
||||
|
||||
Stats:
|
||||
major page faults = 1
|
||||
page hits = 7
|
||||
pages swapped out = 0
|
||||
Effective Access Time = 133.750
|
14
Assignment7/out/sample_output.out
Normal file
14
Assignment7/out/sample_output.out
Normal file
@ -0,0 +1,14 @@
|
||||
Logical addresses -> Physical addresses:
|
||||
1124955998 -> 1886
|
||||
794845611 -> 4523
|
||||
1540976830 -> 8382
|
||||
1124957700 -> 3588
|
||||
1081961846 -> 7542
|
||||
794845440 -> 8448
|
||||
1540976645 -> 5
|
||||
|
||||
Stats:
|
||||
major page faults = 6
|
||||
page hits = 1
|
||||
pages swapped out = 0
|
||||
Effective Access Time = 858.571
|
14
Assignment7/out/sample_output_2.out
Normal file
14
Assignment7/out/sample_output_2.out
Normal file
@ -0,0 +1,14 @@
|
||||
Logical addresses -> Physical addresses:
|
||||
1124955998 -> 1886
|
||||
794845611 -> 4523
|
||||
1540976830 -> 8382
|
||||
1124957700 -> 3588
|
||||
1081961846 -> 7542
|
||||
794845440 -> 8448
|
||||
1540976645 -> 5
|
||||
|
||||
Stats:
|
||||
major page faults = 6
|
||||
page hits = 1
|
||||
pages swapped out = 3
|
||||
Effective Access Time = 1715.714
|
Loading…
Reference in New Issue
Block a user