os161-1.99
 All Data Structures
vm-data1.c
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 
00004 #define PAGE_SIZE (4096)
00005 #define PAGES     (128)
00006 #define SIZE      (PAGE_SIZE * PAGES / sizeof(int))
00007 #define NUM_REFS  (5)
00008 
00009 // unsigned int array[SIZE] = {0};
00010 unsigned int array[SIZE];
00011 
00012 int
00013 main()
00014 {
00015         unsigned int i = 0;
00016         unsigned int refs = 0;
00017 
00018         for (refs = 0; refs < NUM_REFS-1; refs++) {
00019                 for (i=0; i<SIZE; i++) {
00020                         array[i] = i;
00021                 }
00022         }
00023 
00024         for (i=0; i<SIZE; i++) {
00025                 if (array[i] != i) {
00026                         printf("FAILED array[%d] = %u != %d\n", i, array[i], i);
00027                         exit(1);
00028                 }
00029         }
00030 
00031         printf("SUCCEEDED\n");
00032         exit(0);
00033 }
 All Data Structures