Xv6 with picoc & Linkage editor
v1.0
The project delineate mutual cohesion between c library, linkage editor ( linker), interpreter and operating system by porting the same on xv6 kernel
|
00001 // Demonstrate that moving the "acquire" in iderw after the loop that 00002 // appends to the idequeue results in a race. 00003 00004 // For this to work, you should also add a spin within iderw's 00005 // idequeue traversal loop. Adding the following demonstrated a panic 00006 // after about 5 runs of stressfs in QEMU on a 2.1GHz CPU: 00007 // for (i = 0; i < 40000; i++) 00008 // asm volatile(""); 00009 00010 #include "types.h" 00011 #include "stat.h" 00012 #include "user.h" 00013 #include "fs.h" 00014 #include "fcntl.h" 00015 00016 int 00017 main(int argc, char *argv[]) 00018 { 00019 int fd, i; 00020 char path[] = "stressfs0"; 00021 char data[512]; 00022 00023 printf( "stressfs starting\n"); 00024 memset(data, 'a', sizeof(data)); 00025 00026 for(i = 0; i < 4; i++) 00027 if(fork() > 0) 00028 break; 00029 00030 printf( "write %d\n", i); 00031 00032 path[8] += i; 00033 fd = open(path, O_CREATE | O_RDWR); 00034 for(i = 0; i < 20; i++) 00035 // printf(fd, "%d\n", i); 00036 write(fd, data, sizeof(data)); 00037 close(fd); 00038 00039 printf( "read\n"); 00040 00041 fd = open(path, O_RDONLY); 00042 for (i = 0; i < 20; i++) 00043 read(fd, data, sizeof(data)); 00044 close(fd); 00045 00046 wait(); 00047 00048 exit(1); 00049 }