├── .gitignore ├── Notes ├── README.md └── img │ ├── 1.png │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 15.png │ ├── 16.png │ ├── 17.png │ ├── 18.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ └── 9.png ├── README.md ├── lab00 ├── hello.c ├── hello.sh ├── hello2.c └── ls.out ├── lab01 ├── dis.sh ├── file.info ├── opt.c ├── opt.s ├── opt0.s └── opt1.s ├── lab02 ├── README.md ├── fork │ ├── fork1 │ ├── fork1.c │ ├── fork2 │ ├── fork2.c │ ├── fork_ex │ └── fork_ex.c ├── getpid ├── getpid.c ├── pipe │ ├── pipe_creation │ ├── pipe_creation.c │ ├── pipe_ex1.c │ ├── pipe_lsless.c │ ├── pipe_withfork.c │ └── pipe_withfork2.c ├── report │ ├── fork │ ├── fork.c │ ├── pipe.c │ ├── process │ ├── process.c │ ├── signal.c │ └── sys.c └── signals │ ├── custom │ ├── custom.c │ ├── kill │ ├── kill.c │ └── sigign.c ├── lab03 ├── Lcode │ ├── deq │ ├── deq.c │ ├── enq │ ├── enq.c │ ├── job.h │ ├── sample │ ├── sample.c │ ├── scheduler │ ├── scheduler.c │ ├── scheduler.c~ │ ├── stat │ └── stat.c └── Tcode │ ├── reparent.c │ ├── time_1.c │ ├── time_2.c │ ├── time_example_fast.c │ ├── time_example_slow.c │ └── wait_and_exit.c ├── lab04 ├── a.c ├── a_sol.c ├── b.c ├── b_sol.c └── semaphore.c ├── lab05 ├── producer_consumer.c └── reader-writer │ ├── BUFFER.TXT │ ├── Main_file │ ├── Main_file.c │ ├── init.h │ ├── output_sample.txt │ ├── read.h │ └── write.h ├── lab06 ├── CMakeLists.txt ├── cmake-build-debug │ ├── CMakeCache.txt │ ├── CMakeFiles │ │ ├── 3.10.3 │ │ │ ├── CMakeCCompiler.cmake │ │ │ ├── CMakeCXXCompiler.cmake │ │ │ ├── CMakeDetermineCompilerABI_C.bin │ │ │ ├── CMakeDetermineCompilerABI_CXX.bin │ │ │ ├── CMakeSystem.cmake │ │ │ ├── CompilerIdC │ │ │ │ ├── CMakeCCompilerId.c │ │ │ │ └── a.out │ │ │ └── CompilerIdCXX │ │ │ │ ├── CMakeCXXCompilerId.cpp │ │ │ │ └── a.out │ │ ├── CMakeDirectoryInformation.cmake │ │ ├── CMakeOutput.log │ │ ├── Makefile.cmake │ │ ├── Makefile2 │ │ ├── TargetDirectories.txt │ │ ├── clion-environment.txt │ │ ├── clion-log.txt │ │ ├── cmake.check_cache │ │ ├── feature_tests.bin │ │ ├── feature_tests.c │ │ ├── feature_tests.cxx │ │ ├── lab6.dir │ │ │ ├── CXX.includecache │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── depend.internal │ │ │ ├── depend.make │ │ │ ├── flags.make │ │ │ ├── link.txt │ │ │ ├── progress.make │ │ │ └── temp.cpp.o │ │ └── progress.marks │ ├── Makefile │ ├── cmake_install.cmake │ ├── lab6 │ └── lab6.cbp ├── lab7.cpp ├── main.cpp └── temp.cpp ├── lab07 ├── CMakeLists.txt ├── cmake-build-debug │ ├── CMakeCache.txt │ ├── CMakeFiles │ │ ├── 3.10.3 │ │ │ ├── CMakeCCompiler.cmake │ │ │ ├── CMakeCXXCompiler.cmake │ │ │ ├── CMakeDetermineCompilerABI_C.bin │ │ │ ├── CMakeDetermineCompilerABI_CXX.bin │ │ │ ├── CMakeSystem.cmake │ │ │ ├── CompilerIdC │ │ │ │ ├── CMakeCCompilerId.c │ │ │ │ └── a.out │ │ │ └── CompilerIdCXX │ │ │ │ ├── CMakeCXXCompilerId.cpp │ │ │ │ └── a.out │ │ ├── CMakeDirectoryInformation.cmake │ │ ├── CMakeOutput.log │ │ ├── Makefile.cmake │ │ ├── Makefile2 │ │ ├── TargetDirectories.txt │ │ ├── clion-environment.txt │ │ ├── clion-log.txt │ │ ├── cmake.check_cache │ │ ├── code.dir │ │ │ ├── C.includecache │ │ │ ├── CXX.includecache │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── depend.internal │ │ │ ├── depend.make │ │ │ ├── flags.make │ │ │ ├── lab7.c.o │ │ │ ├── lab7.cpp.o │ │ │ ├── link.txt │ │ │ └── progress.make │ │ ├── feature_tests.bin │ │ ├── feature_tests.c │ │ ├── feature_tests.cxx │ │ └── progress.marks │ ├── Makefile │ ├── cmake_install.cmake │ ├── code │ └── code.cbp ├── lab7.c ├── lab7.cpp ├── main.c └── test.txt ├── lab08 ├── 1.in ├── 2.in ├── 3.in ├── Algo_real ├── Algo_real.cpp ├── CMakeLists.txt ├── cmake-build-debug │ ├── CMakeCache.txt │ ├── CMakeFiles │ │ ├── 3.10.3 │ │ │ ├── CMakeCCompiler.cmake │ │ │ ├── CMakeCXXCompiler.cmake │ │ │ ├── CMakeDetermineCompilerABI_C.bin │ │ │ ├── CMakeDetermineCompilerABI_CXX.bin │ │ │ ├── CMakeSystem.cmake │ │ │ ├── CompilerIdC │ │ │ │ ├── CMakeCCompilerId.c │ │ │ │ └── a.out │ │ │ └── CompilerIdCXX │ │ │ │ ├── CMakeCXXCompilerId.cpp │ │ │ │ └── a.out │ │ ├── CMakeDirectoryInformation.cmake │ │ ├── CMakeOutput.log │ │ ├── Makefile.cmake │ │ ├── Makefile2 │ │ ├── TargetDirectories.txt │ │ ├── clion-environment.txt │ │ ├── clion-log.txt │ │ ├── cmake.check_cache │ │ ├── feature_tests.bin │ │ ├── feature_tests.c │ │ ├── feature_tests.cxx │ │ ├── lab8.dir │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── depend.make │ │ │ ├── flags.make │ │ │ ├── link.txt │ │ │ └── progress.make │ │ └── progress.marks │ ├── Makefile │ ├── cmake_install.cmake │ ├── lab8 │ └── lab8.cbp └── real_correct_code.cpp ├── lab09 ├── 0.in ├── 1.in ├── 2.in ├── 3.in ├── CMakeLists.txt ├── a.out ├── additional-test │ ├── 4-1.in │ ├── 4-2.in │ ├── 4-3.in │ ├── 5-1.in │ ├── 5-2.in │ └── 5-3.in ├── cmake-build-debug │ ├── CMakeCache.txt │ ├── CMakeFiles │ │ ├── 3.10.3 │ │ │ ├── CMakeCCompiler.cmake │ │ │ ├── CMakeCXXCompiler.cmake │ │ │ ├── CMakeDetermineCompilerABI_C.bin │ │ │ ├── CMakeDetermineCompilerABI_CXX.bin │ │ │ ├── CMakeSystem.cmake │ │ │ ├── CompilerIdC │ │ │ │ ├── CMakeCCompilerId.c │ │ │ │ └── a.out │ │ │ └── CompilerIdCXX │ │ │ │ ├── CMakeCXXCompilerId.cpp │ │ │ │ └── a.out │ │ ├── CMakeDirectoryInformation.cmake │ │ ├── CMakeOutput.log │ │ ├── Makefile.cmake │ │ ├── Makefile2 │ │ ├── TargetDirectories.txt │ │ ├── clion-environment.txt │ │ ├── clion-log.txt │ │ ├── cmake.check_cache │ │ ├── feature_tests.bin │ │ ├── feature_tests.c │ │ ├── feature_tests.cxx │ │ ├── lab9.dir │ │ │ ├── CXX.includecache │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── depend.internal │ │ │ ├── depend.make │ │ │ ├── flags.make │ │ │ ├── lab9_11510225.cpp.o │ │ │ ├── link.txt │ │ │ └── progress.make │ │ └── progress.marks │ ├── Makefile │ ├── cmake_install.cmake │ ├── lab9 │ └── lab9.cbp ├── disk-scheduling-master │ ├── .gitignore │ ├── README.md │ ├── clook.c │ ├── cscan.c │ ├── disk_sch_java │ │ └── src │ │ │ ├── SCAN.java │ │ │ ├── SSTF.java │ │ │ └── fcfs.java │ ├── disk_scheduling_algorithms.c │ ├── fcfs.c │ ├── look.c │ ├── scan.c │ └── sstf.c ├── lab92.cpp └── lab9_11510225.cpp ├── lab10 ├── a.out └── file_system.cpp ├── lab11 ├── 11510225.cpp ├── CMakeLists.txt ├── cmake-build-debug │ ├── CMakeCache.txt │ ├── CMakeFiles │ │ ├── 3.10.3 │ │ │ ├── CMakeCCompiler.cmake │ │ │ ├── CMakeCXXCompiler.cmake │ │ │ ├── CMakeDetermineCompilerABI_C.bin │ │ │ ├── CMakeDetermineCompilerABI_CXX.bin │ │ │ ├── CMakeSystem.cmake │ │ │ ├── CompilerIdC │ │ │ │ ├── CMakeCCompilerId.c │ │ │ │ └── a.out │ │ │ └── CompilerIdCXX │ │ │ │ ├── CMakeCXXCompilerId.cpp │ │ │ │ └── a.out │ │ ├── CMakeDirectoryInformation.cmake │ │ ├── CMakeOutput.log │ │ ├── Makefile.cmake │ │ ├── Makefile2 │ │ ├── TargetDirectories.txt │ │ ├── clion-environment.txt │ │ ├── clion-log.txt │ │ ├── cmake.check_cache │ │ ├── feature_tests.bin │ │ ├── feature_tests.c │ │ ├── feature_tests.cxx │ │ ├── lab11.dir │ │ │ ├── 11510225.cpp.o │ │ │ ├── CXX.includecache │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── depend.internal │ │ │ ├── depend.make │ │ │ ├── file_system.cpp.o │ │ │ ├── flags.make │ │ │ ├── link.txt │ │ │ └── progress.make │ │ └── progress.marks │ ├── Makefile │ ├── cmake_install.cmake │ ├── lab11 │ └── lab11.cbp └── test.in ├── proj1 ├── README.md └── src │ ├── .gitignore │ ├── LICENSE │ ├── Make.config │ ├── Makefile │ ├── Makefile.build │ ├── Makefile.kernel │ ├── Makefile.userprog │ ├── devices │ ├── block.c │ ├── block.h │ ├── ide.c │ ├── ide.h │ ├── input.c │ ├── input.h │ ├── intq.c │ ├── intq.h │ ├── kbd.c │ ├── kbd.h │ ├── partition.c │ ├── partition.h │ ├── pit.c │ ├── pit.h │ ├── rtc.c │ ├── rtc.h │ ├── serial.c │ ├── serial.h │ ├── shutdown.c │ ├── shutdown.h │ ├── speaker.c │ ├── speaker.h │ ├── timer.c │ ├── timer.h │ ├── vga.c │ └── vga.h │ ├── examples │ ├── .gitignore │ ├── Makefile │ ├── bubsort.c │ ├── cat.c │ ├── cmp.c │ ├── cp.c │ ├── echo.c │ ├── halt.c │ ├── hex-dump.c │ ├── insult.c │ ├── lib │ │ ├── .gitignore │ │ └── user │ │ │ ├── .dummy │ │ │ └── .gitignore │ ├── lineup.c │ ├── ls.c │ ├── matmult.c │ ├── mcat.c │ ├── mcp.c │ ├── mkdir.c │ ├── pwd.c │ ├── recursor.c │ ├── rm.c │ └── shell.c │ ├── filesys │ ├── .gitignore │ ├── Make.vars │ ├── Makefile │ ├── directory.c │ ├── directory.h │ ├── file.c │ ├── file.h │ ├── filesys.c │ ├── filesys.h │ ├── free-map.c │ ├── free-map.h │ ├── fsutil.c │ ├── fsutil.h │ ├── inode.c │ ├── inode.h │ └── off_t.h │ ├── lib │ ├── arithmetic.c │ ├── ctype.h │ ├── debug.c │ ├── debug.h │ ├── inttypes.h │ ├── kernel │ │ ├── bitmap.c │ │ ├── bitmap.h │ │ ├── console.c │ │ ├── console.h │ │ ├── debug.c │ │ ├── hash.c │ │ ├── hash.h │ │ ├── list.c │ │ ├── list.h │ │ └── stdio.h │ ├── limits.h │ ├── packed.h │ ├── random.c │ ├── random.h │ ├── round.h │ ├── stdarg.h │ ├── stdbool.h │ ├── stddef.h │ ├── stdint.h │ ├── stdio.c │ ├── stdio.h │ ├── stdlib.c │ ├── stdlib.h │ ├── string.c │ ├── string.h │ ├── syscall-nr.h │ ├── user │ │ ├── console.c │ │ ├── debug.c │ │ ├── entry.c │ │ ├── stdio.h │ │ ├── syscall.c │ │ ├── syscall.h │ │ └── user.lds │ ├── ustar.c │ └── ustar.h │ ├── misc │ ├── bochs-2.2.6-big-endian.patch │ ├── bochs-2.2.6-build.sh │ ├── bochs-2.2.6-gdbstub-ENN.patch │ ├── bochs-2.2.6-jitter.patch │ ├── bochs-2.2.6-ms-extensions.patch │ ├── bochs-2.2.6-namespace.patch │ ├── bochs-2.2.6-page-fault-segv.patch │ ├── bochs-2.2.6-paranoia.patch │ ├── bochs-2.2.6-solaris-link.patch │ ├── bochs-2.2.6-solaris-tty.patch │ ├── bochs-2.2.6-triple-fault.patch │ ├── bochs-2.6.2-build.sh │ ├── bochs-2.6.2-jitter-plus-segv.patch │ ├── bochs-2.6.2-xrandr-pkgconfig.patch │ ├── gcc-3.3.6-cross-howto │ └── gdb-macros │ ├── tests │ ├── Algorithm │ │ └── Diff.pm │ ├── Make.tests │ ├── arc4.c │ ├── arc4.h │ ├── arc4.pm │ ├── cksum.c │ ├── cksum.h │ ├── cksum.pm │ ├── filesys │ │ ├── Grading.no-vm │ │ ├── Grading.with-vm │ │ ├── base │ │ │ ├── Make.tests │ │ │ ├── Rubric │ │ │ ├── child-syn-read.c │ │ │ ├── child-syn-wrt.c │ │ │ ├── full.inc │ │ │ ├── lg-create.c │ │ │ ├── lg-create.ck │ │ │ ├── lg-full.c │ │ │ ├── lg-full.ck │ │ │ ├── lg-random.c │ │ │ ├── lg-random.ck │ │ │ ├── lg-seq-block.c │ │ │ ├── lg-seq-block.ck │ │ │ ├── lg-seq-random.c │ │ │ ├── lg-seq-random.ck │ │ │ ├── random.inc │ │ │ ├── seq-block.inc │ │ │ ├── seq-random.inc │ │ │ ├── sm-create.c │ │ │ ├── sm-create.ck │ │ │ ├── sm-full.c │ │ │ ├── sm-full.ck │ │ │ ├── sm-random.c │ │ │ ├── sm-random.ck │ │ │ ├── sm-seq-block.c │ │ │ ├── sm-seq-block.ck │ │ │ ├── sm-seq-random.c │ │ │ ├── sm-seq-random.ck │ │ │ ├── syn-read.c │ │ │ ├── syn-read.ck │ │ │ ├── syn-read.h │ │ │ ├── syn-remove.c │ │ │ ├── syn-remove.ck │ │ │ ├── syn-write.c │ │ │ ├── syn-write.ck │ │ │ └── syn-write.h │ │ ├── create.inc │ │ ├── extended │ │ │ ├── Make.tests │ │ │ ├── Rubric.functionality │ │ │ ├── Rubric.persistence │ │ │ ├── Rubric.robustness │ │ │ ├── child-syn-rw.c │ │ │ ├── dir-empty-name-persistence.ck │ │ │ ├── dir-empty-name.c │ │ │ ├── dir-empty-name.ck │ │ │ ├── dir-mk-tree-persistence.ck │ │ │ ├── dir-mk-tree.c │ │ │ ├── dir-mk-tree.ck │ │ │ ├── dir-mkdir-persistence.ck │ │ │ ├── dir-mkdir.c │ │ │ ├── dir-mkdir.ck │ │ │ ├── dir-open-persistence.ck │ │ │ ├── dir-open.c │ │ │ ├── dir-open.ck │ │ │ ├── dir-over-file-persistence.ck │ │ │ ├── dir-over-file.c │ │ │ ├── dir-over-file.ck │ │ │ ├── dir-rm-cwd-persistence.ck │ │ │ ├── dir-rm-cwd.c │ │ │ ├── dir-rm-cwd.ck │ │ │ ├── dir-rm-parent-persistence.ck │ │ │ ├── dir-rm-parent.c │ │ │ ├── dir-rm-parent.ck │ │ │ ├── dir-rm-root-persistence.ck │ │ │ ├── dir-rm-root.c │ │ │ ├── dir-rm-root.ck │ │ │ ├── dir-rm-tree-persistence.ck │ │ │ ├── dir-rm-tree.c │ │ │ ├── dir-rm-tree.ck │ │ │ ├── dir-rmdir-persistence.ck │ │ │ ├── dir-rmdir.c │ │ │ ├── dir-rmdir.ck │ │ │ ├── dir-under-file-persistence.ck │ │ │ ├── dir-under-file.c │ │ │ ├── dir-under-file.ck │ │ │ ├── dir-vine-persistence.ck │ │ │ ├── dir-vine.c │ │ │ ├── dir-vine.ck │ │ │ ├── grow-create-persistence.ck │ │ │ ├── grow-create.c │ │ │ ├── grow-create.ck │ │ │ ├── grow-dir-lg-persistence.ck │ │ │ ├── grow-dir-lg.c │ │ │ ├── grow-dir-lg.ck │ │ │ ├── grow-dir.inc │ │ │ ├── grow-file-size-persistence.ck │ │ │ ├── grow-file-size.c │ │ │ ├── grow-file-size.ck │ │ │ ├── grow-root-lg-persistence.ck │ │ │ ├── grow-root-lg.c │ │ │ ├── grow-root-lg.ck │ │ │ ├── grow-root-sm-persistence.ck │ │ │ ├── grow-root-sm.c │ │ │ ├── grow-root-sm.ck │ │ │ ├── grow-seq-lg-persistence.ck │ │ │ ├── grow-seq-lg.c │ │ │ ├── grow-seq-lg.ck │ │ │ ├── grow-seq-sm-persistence.ck │ │ │ ├── grow-seq-sm.c │ │ │ ├── grow-seq-sm.ck │ │ │ ├── grow-seq.inc │ │ │ ├── grow-sparse-persistence.ck │ │ │ ├── grow-sparse.c │ │ │ ├── grow-sparse.ck │ │ │ ├── grow-tell-persistence.ck │ │ │ ├── grow-tell.c │ │ │ ├── grow-tell.ck │ │ │ ├── grow-two-files-persistence.ck │ │ │ ├── grow-two-files.c │ │ │ ├── grow-two-files.ck │ │ │ ├── mk-tree.c │ │ │ ├── mk-tree.h │ │ │ ├── syn-rw-persistence.ck │ │ │ ├── syn-rw.c │ │ │ ├── syn-rw.ck │ │ │ ├── syn-rw.h │ │ │ └── tar.c │ │ ├── seq-test.c │ │ └── seq-test.h │ ├── internal │ │ ├── list.c │ │ ├── stdio.c │ │ └── stdlib.c │ ├── lib.c │ ├── lib.h │ ├── lib.pm │ ├── main.c │ ├── main.h │ ├── make-grade │ ├── random.pm │ ├── tests.pm │ ├── threads │ │ ├── Grading │ │ ├── Make.tests │ │ ├── Rubric.alarm │ │ ├── Rubric.mlfqs │ │ ├── Rubric.priority │ │ ├── alarm-multiple.ck │ │ ├── alarm-negative.c │ │ ├── alarm-negative.ck │ │ ├── alarm-priority.c │ │ ├── alarm-priority.ck │ │ ├── alarm-simultaneous.c │ │ ├── alarm-simultaneous.ck │ │ ├── alarm-single.ck │ │ ├── alarm-wait.c │ │ ├── alarm-zero.c │ │ ├── alarm-zero.ck │ │ ├── alarm.pm │ │ ├── mlfqs-block.c │ │ ├── mlfqs-block.ck │ │ ├── mlfqs-fair-2.ck │ │ ├── mlfqs-fair-20.ck │ │ ├── mlfqs-fair.c │ │ ├── mlfqs-load-1.c │ │ ├── mlfqs-load-1.ck │ │ ├── mlfqs-load-60.c │ │ ├── mlfqs-load-60.ck │ │ ├── mlfqs-load-avg.c │ │ ├── mlfqs-load-avg.ck │ │ ├── mlfqs-nice-10.ck │ │ ├── mlfqs-nice-2.ck │ │ ├── mlfqs-recent-1.c │ │ ├── mlfqs-recent-1.ck │ │ ├── mlfqs.pm │ │ ├── priority-change.c │ │ ├── priority-change.ck │ │ ├── priority-condvar.c │ │ ├── priority-condvar.ck │ │ ├── priority-donate-chain.c │ │ ├── priority-donate-chain.ck │ │ ├── priority-donate-lower.c │ │ ├── priority-donate-lower.ck │ │ ├── priority-donate-multiple.c │ │ ├── priority-donate-multiple.ck │ │ ├── priority-donate-multiple2.c │ │ ├── priority-donate-multiple2.ck │ │ ├── priority-donate-nest.c │ │ ├── priority-donate-nest.ck │ │ ├── priority-donate-one.c │ │ ├── priority-donate-one.ck │ │ ├── priority-donate-sema.c │ │ ├── priority-donate-sema.ck │ │ ├── priority-fifo.c │ │ ├── priority-fifo.ck │ │ ├── priority-preempt.c │ │ ├── priority-preempt.ck │ │ ├── priority-sema.c │ │ ├── priority-sema.ck │ │ ├── tests.c │ │ └── tests.h │ ├── userprog │ │ ├── Grading │ │ ├── Make.tests │ │ ├── Rubric.functionality │ │ ├── Rubric.robustness │ │ ├── args-dbl-space.ck │ │ ├── args-many.ck │ │ ├── args-multiple.ck │ │ ├── args-none.ck │ │ ├── args-single.ck │ │ ├── args.c │ │ ├── bad-jump.c │ │ ├── bad-jump.ck │ │ ├── bad-jump2.c │ │ ├── bad-jump2.ck │ │ ├── bad-read.c │ │ ├── bad-read.ck │ │ ├── bad-read2.c │ │ ├── bad-read2.ck │ │ ├── bad-write.c │ │ ├── bad-write.ck │ │ ├── bad-write2.c │ │ ├── bad-write2.ck │ │ ├── boundary.c │ │ ├── boundary.h │ │ ├── child-bad.c │ │ ├── child-close.c │ │ ├── child-rox.c │ │ ├── child-simple.c │ │ ├── close-bad-fd.c │ │ ├── close-bad-fd.ck │ │ ├── close-normal.c │ │ ├── close-normal.ck │ │ ├── close-stdin.c │ │ ├── close-stdin.ck │ │ ├── close-stdout.c │ │ ├── close-stdout.ck │ │ ├── close-twice.c │ │ ├── close-twice.ck │ │ ├── create-bad-ptr.c │ │ ├── create-bad-ptr.ck │ │ ├── create-bound.c │ │ ├── create-bound.ck │ │ ├── create-empty.c │ │ ├── create-empty.ck │ │ ├── create-exists.c │ │ ├── create-exists.ck │ │ ├── create-long.c │ │ ├── create-long.ck │ │ ├── create-normal.c │ │ ├── create-normal.ck │ │ ├── create-null.c │ │ ├── create-null.ck │ │ ├── exec-arg.c │ │ ├── exec-arg.ck │ │ ├── exec-bad-ptr.c │ │ ├── exec-bad-ptr.ck │ │ ├── exec-missing.c │ │ ├── exec-missing.ck │ │ ├── exec-multiple.c │ │ ├── exec-multiple.ck │ │ ├── exec-once.c │ │ ├── exec-once.ck │ │ ├── exit.c │ │ ├── exit.ck │ │ ├── halt.c │ │ ├── halt.ck │ │ ├── lib │ │ │ ├── .gitignore │ │ │ └── user │ │ │ │ ├── .dummy │ │ │ │ └── .gitignore │ │ ├── multi-child-fd.c │ │ ├── multi-child-fd.ck │ │ ├── multi-recurse.c │ │ ├── multi-recurse.ck │ │ ├── no-vm │ │ │ ├── Make.tests │ │ │ ├── Rubric │ │ │ ├── multi-oom.c │ │ │ └── multi-oom.ck │ │ ├── null.ck │ │ ├── open-bad-ptr.c │ │ ├── open-bad-ptr.ck │ │ ├── open-boundary.c │ │ ├── open-boundary.ck │ │ ├── open-empty.c │ │ ├── open-empty.ck │ │ ├── open-missing.c │ │ ├── open-missing.ck │ │ ├── open-normal.c │ │ ├── open-normal.ck │ │ ├── open-null.c │ │ ├── open-null.ck │ │ ├── open-twice.c │ │ ├── open-twice.ck │ │ ├── read-bad-fd.c │ │ ├── read-bad-fd.ck │ │ ├── read-bad-ptr.c │ │ ├── read-bad-ptr.ck │ │ ├── read-boundary.c │ │ ├── read-boundary.ck │ │ ├── read-normal.c │ │ ├── read-normal.ck │ │ ├── read-stdout.c │ │ ├── read-stdout.ck │ │ ├── read-zero.c │ │ ├── read-zero.ck │ │ ├── rox-child.c │ │ ├── rox-child.ck │ │ ├── rox-child.inc │ │ ├── rox-multichild.c │ │ ├── rox-multichild.ck │ │ ├── rox-simple.c │ │ ├── rox-simple.ck │ │ ├── sample.inc │ │ ├── sample.txt │ │ ├── sc-bad-arg.c │ │ ├── sc-bad-arg.ck │ │ ├── sc-bad-sp.c │ │ ├── sc-bad-sp.ck │ │ ├── sc-boundary-2.c │ │ ├── sc-boundary-2.ck │ │ ├── sc-boundary.c │ │ ├── sc-boundary.ck │ │ ├── wait-bad-pid.c │ │ ├── wait-bad-pid.ck │ │ ├── wait-killed.c │ │ ├── wait-killed.ck │ │ ├── wait-simple.c │ │ ├── wait-simple.ck │ │ ├── wait-twice.c │ │ ├── wait-twice.ck │ │ ├── write-bad-fd.c │ │ ├── write-bad-fd.ck │ │ ├── write-bad-ptr.c │ │ ├── write-bad-ptr.ck │ │ ├── write-boundary.c │ │ ├── write-boundary.ck │ │ ├── write-normal.c │ │ ├── write-normal.ck │ │ ├── write-stdin.c │ │ ├── write-stdin.ck │ │ ├── write-zero.c │ │ └── write-zero.ck │ └── vm │ │ ├── Grading │ │ ├── Make.tests │ │ ├── Rubric.functionality │ │ ├── Rubric.robustness │ │ ├── child-inherit.c │ │ ├── child-linear.c │ │ ├── child-mm-wrt.c │ │ ├── child-qsort-mm.c │ │ ├── child-qsort.c │ │ ├── child-sort.c │ │ ├── mmap-bad-fd.c │ │ ├── mmap-bad-fd.ck │ │ ├── mmap-clean.c │ │ ├── mmap-clean.ck │ │ ├── mmap-close.c │ │ ├── mmap-close.ck │ │ ├── mmap-exit.c │ │ ├── mmap-exit.ck │ │ ├── mmap-inherit.c │ │ ├── mmap-inherit.ck │ │ ├── mmap-misalign.c │ │ ├── mmap-misalign.ck │ │ ├── mmap-null.c │ │ ├── mmap-null.ck │ │ ├── mmap-over-code.c │ │ ├── mmap-over-code.ck │ │ ├── mmap-over-data.c │ │ ├── mmap-over-data.ck │ │ ├── mmap-over-stk.c │ │ ├── mmap-over-stk.ck │ │ ├── mmap-overlap.c │ │ ├── mmap-overlap.ck │ │ ├── mmap-read.c │ │ ├── mmap-read.ck │ │ ├── mmap-remove.c │ │ ├── mmap-remove.ck │ │ ├── mmap-shuffle.c │ │ ├── mmap-shuffle.ck │ │ ├── mmap-twice.c │ │ ├── mmap-twice.ck │ │ ├── mmap-unmap.c │ │ ├── mmap-unmap.ck │ │ ├── mmap-write.c │ │ ├── mmap-write.ck │ │ ├── mmap-zero.c │ │ ├── mmap-zero.ck │ │ ├── page-linear.c │ │ ├── page-linear.ck │ │ ├── page-merge-mm.c │ │ ├── page-merge-mm.ck │ │ ├── page-merge-par.c │ │ ├── page-merge-par.ck │ │ ├── page-merge-seq.c │ │ ├── page-merge-seq.ck │ │ ├── page-merge-stk.c │ │ ├── page-merge-stk.ck │ │ ├── page-parallel.c │ │ ├── page-parallel.ck │ │ ├── page-shuffle.c │ │ ├── page-shuffle.ck │ │ ├── parallel-merge.c │ │ ├── parallel-merge.h │ │ ├── process_death.pm │ │ ├── pt-bad-addr.c │ │ ├── pt-bad-addr.ck │ │ ├── pt-bad-read.c │ │ ├── pt-bad-read.ck │ │ ├── pt-big-stk-obj.c │ │ ├── pt-big-stk-obj.ck │ │ ├── pt-grow-bad.c │ │ ├── pt-grow-bad.ck │ │ ├── pt-grow-pusha.c │ │ ├── pt-grow-pusha.ck │ │ ├── pt-grow-stack.c │ │ ├── pt-grow-stack.ck │ │ ├── pt-grow-stk-sc.c │ │ ├── pt-grow-stk-sc.ck │ │ ├── pt-write-code-2.c │ │ ├── pt-write-code.c │ │ ├── pt-write-code.ck │ │ ├── pt-write-code2.ck │ │ ├── qsort.c │ │ ├── qsort.h │ │ ├── sample.inc │ │ └── sample.txt │ ├── threads │ ├── .gitignore │ ├── Make.vars │ ├── Makefile │ ├── flags.h │ ├── init.c │ ├── init.h │ ├── interrupt.c │ ├── interrupt.h │ ├── intr-stubs.S │ ├── intr-stubs.h │ ├── io.h │ ├── kernel.lds.S │ ├── loader.S │ ├── loader.h │ ├── malloc.c │ ├── malloc.h │ ├── palloc.c │ ├── palloc.h │ ├── pte.h │ ├── start.S │ ├── switch.S │ ├── switch.h │ ├── synch.c │ ├── synch.h │ ├── thread.c │ ├── thread.h │ └── vaddr.h │ ├── userprog │ ├── .gitignore │ ├── Make.vars │ ├── Makefile │ ├── exception.c │ ├── exception.h │ ├── gdt.c │ ├── gdt.h │ ├── pagedir.c │ ├── pagedir.h │ ├── process.c │ ├── process.h │ ├── syscall.c │ ├── syscall.h │ ├── tss.c │ └── tss.h │ ├── utils │ ├── .gitignore │ ├── Makefile │ ├── Pintos.pm │ ├── backtrace │ ├── pintos │ ├── pintos-gdb │ ├── pintos-mkdisk │ ├── pintos-set-cmdline │ ├── setitimer-helper.c │ ├── squish-pty.c │ └── squish-unix.c │ └── vm │ ├── .gitignore │ ├── Make.vars │ └── Makefile └── proj2 ├── README.md ├── p1.png ├── p2.png ├── src ├── .gitignore ├── LICENSE ├── Make.config ├── Makefile ├── Makefile.build ├── Makefile.kernel ├── Makefile.userprog ├── devices │ ├── block.c │ ├── block.h │ ├── ide.c │ ├── ide.h │ ├── input.c │ ├── input.h │ ├── intq.c │ ├── intq.h │ ├── kbd.c │ ├── kbd.h │ ├── partition.c │ ├── partition.h │ ├── pit.c │ ├── pit.h │ ├── rtc.c │ ├── rtc.h │ ├── serial.c │ ├── serial.h │ ├── shutdown.c │ ├── shutdown.h │ ├── speaker.c │ ├── speaker.h │ ├── timer.c │ ├── timer.h │ ├── vga.c │ └── vga.h ├── examples │ ├── .gitignore │ ├── Makefile │ ├── bubsort.c │ ├── cat.c │ ├── cmp.c │ ├── cp.c │ ├── echo.c │ ├── halt.c │ ├── hex-dump.c │ ├── insult.c │ ├── lib │ │ ├── .gitignore │ │ └── user │ │ │ ├── .dummy │ │ │ └── .gitignore │ ├── lineup.c │ ├── ls.c │ ├── matmult.c │ ├── mcat.c │ ├── mcp.c │ ├── mkdir.c │ ├── pwd.c │ ├── recursor.c │ ├── rm.c │ └── shell.c ├── filesys │ ├── .gitignore │ ├── Make.vars │ ├── Makefile │ ├── directory.c │ ├── directory.h │ ├── file.c │ ├── file.h │ ├── filesys.c │ ├── filesys.h │ ├── free-map.c │ ├── free-map.h │ ├── fsutil.c │ ├── fsutil.h │ ├── inode.c │ ├── inode.h │ └── off_t.h ├── lib │ ├── arithmetic.c │ ├── ctype.h │ ├── debug.c │ ├── debug.h │ ├── inttypes.h │ ├── kernel │ │ ├── bitmap.c │ │ ├── bitmap.h │ │ ├── console.c │ │ ├── console.h │ │ ├── debug.c │ │ ├── hash.c │ │ ├── hash.h │ │ ├── list.c │ │ ├── list.h │ │ └── stdio.h │ ├── limits.h │ ├── packed.h │ ├── random.c │ ├── random.h │ ├── round.h │ ├── stdarg.h │ ├── stdbool.h │ ├── stddef.h │ ├── stdint.h │ ├── stdio.c │ ├── stdio.h │ ├── stdlib.c │ ├── stdlib.h │ ├── string.c │ ├── string.h │ ├── syscall-nr.h │ ├── user │ │ ├── console.c │ │ ├── debug.c │ │ ├── entry.c │ │ ├── stdio.h │ │ ├── syscall.c │ │ ├── syscall.h │ │ └── user.lds │ ├── ustar.c │ └── ustar.h ├── misc │ ├── bochs-2.2.6-big-endian.patch │ ├── bochs-2.2.6-build.sh │ ├── bochs-2.2.6-gdbstub-ENN.patch │ ├── bochs-2.2.6-jitter.patch │ ├── bochs-2.2.6-ms-extensions.patch │ ├── bochs-2.2.6-namespace.patch │ ├── bochs-2.2.6-page-fault-segv.patch │ ├── bochs-2.2.6-paranoia.patch │ ├── bochs-2.2.6-solaris-link.patch │ ├── bochs-2.2.6-solaris-tty.patch │ ├── bochs-2.2.6-triple-fault.patch │ ├── bochs-2.6.2-build.sh │ ├── bochs-2.6.2-jitter-plus-segv.patch │ ├── bochs-2.6.2-xrandr-pkgconfig.patch │ ├── gcc-3.3.6-cross-howto │ └── gdb-macros ├── tests │ ├── Algorithm │ │ └── Diff.pm │ ├── Make.tests │ ├── arc4.c │ ├── arc4.h │ ├── arc4.pm │ ├── cksum.c │ ├── cksum.h │ ├── cksum.pm │ ├── filesys │ │ ├── Grading.no-vm │ │ ├── Grading.with-vm │ │ ├── base │ │ │ ├── Make.tests │ │ │ ├── Rubric │ │ │ ├── child-syn-read.c │ │ │ ├── child-syn-wrt.c │ │ │ ├── full.inc │ │ │ ├── lg-create.c │ │ │ ├── lg-create.ck │ │ │ ├── lg-full.c │ │ │ ├── lg-full.ck │ │ │ ├── lg-random.c │ │ │ ├── lg-random.ck │ │ │ ├── lg-seq-block.c │ │ │ ├── lg-seq-block.ck │ │ │ ├── lg-seq-random.c │ │ │ ├── lg-seq-random.ck │ │ │ ├── random.inc │ │ │ ├── seq-block.inc │ │ │ ├── seq-random.inc │ │ │ ├── sm-create.c │ │ │ ├── sm-create.ck │ │ │ ├── sm-full.c │ │ │ ├── sm-full.ck │ │ │ ├── sm-random.c │ │ │ ├── sm-random.ck │ │ │ ├── sm-seq-block.c │ │ │ ├── sm-seq-block.ck │ │ │ ├── sm-seq-random.c │ │ │ ├── sm-seq-random.ck │ │ │ ├── syn-read-max.c │ │ │ ├── syn-read-max.ck │ │ │ ├── syn-read.c │ │ │ ├── syn-read.ck │ │ │ ├── syn-read.h │ │ │ ├── syn-remove.c │ │ │ ├── syn-remove.ck │ │ │ ├── syn-write.c │ │ │ ├── syn-write.ck │ │ │ └── syn-write.h │ │ ├── create.inc │ │ ├── extended │ │ │ ├── Make.tests │ │ │ ├── Rubric.functionality │ │ │ ├── Rubric.persistence │ │ │ ├── Rubric.robustness │ │ │ ├── child-syn-rw.c │ │ │ ├── dir-empty-name-persistence.ck │ │ │ ├── dir-empty-name.c │ │ │ ├── dir-empty-name.ck │ │ │ ├── dir-mk-tree-persistence.ck │ │ │ ├── dir-mk-tree.c │ │ │ ├── dir-mk-tree.ck │ │ │ ├── dir-mkdir-persistence.ck │ │ │ ├── dir-mkdir.c │ │ │ ├── dir-mkdir.ck │ │ │ ├── dir-open-persistence.ck │ │ │ ├── dir-open.c │ │ │ ├── dir-open.ck │ │ │ ├── dir-over-file-persistence.ck │ │ │ ├── dir-over-file.c │ │ │ ├── dir-over-file.ck │ │ │ ├── dir-rm-cwd-persistence.ck │ │ │ ├── dir-rm-cwd.c │ │ │ ├── dir-rm-cwd.ck │ │ │ ├── dir-rm-parent-persistence.ck │ │ │ ├── dir-rm-parent.c │ │ │ ├── dir-rm-parent.ck │ │ │ ├── dir-rm-root-persistence.ck │ │ │ ├── dir-rm-root.c │ │ │ ├── dir-rm-root.ck │ │ │ ├── dir-rm-tree-persistence.ck │ │ │ ├── dir-rm-tree.c │ │ │ ├── dir-rm-tree.ck │ │ │ ├── dir-rmdir-persistence.ck │ │ │ ├── dir-rmdir.c │ │ │ ├── dir-rmdir.ck │ │ │ ├── dir-under-file-persistence.ck │ │ │ ├── dir-under-file.c │ │ │ ├── dir-under-file.ck │ │ │ ├── dir-vine-persistence.ck │ │ │ ├── dir-vine.c │ │ │ ├── dir-vine.ck │ │ │ ├── grow-create-persistence.ck │ │ │ ├── grow-create.c │ │ │ ├── grow-create.ck │ │ │ ├── grow-dir-lg-persistence.ck │ │ │ ├── grow-dir-lg.c │ │ │ ├── grow-dir-lg.ck │ │ │ ├── grow-dir.inc │ │ │ ├── grow-file-size-persistence.ck │ │ │ ├── grow-file-size.c │ │ │ ├── grow-file-size.ck │ │ │ ├── grow-root-lg-persistence.ck │ │ │ ├── grow-root-lg.c │ │ │ ├── grow-root-lg.ck │ │ │ ├── grow-root-sm-persistence.ck │ │ │ ├── grow-root-sm.c │ │ │ ├── grow-root-sm.ck │ │ │ ├── grow-seq-lg-persistence.ck │ │ │ ├── grow-seq-lg.c │ │ │ ├── grow-seq-lg.ck │ │ │ ├── grow-seq-sm-persistence.ck │ │ │ ├── grow-seq-sm.c │ │ │ ├── grow-seq-sm.ck │ │ │ ├── grow-seq.inc │ │ │ ├── grow-sparse-persistence.ck │ │ │ ├── grow-sparse.c │ │ │ ├── grow-sparse.ck │ │ │ ├── grow-tell-persistence.ck │ │ │ ├── grow-tell.c │ │ │ ├── grow-tell.ck │ │ │ ├── grow-two-files-persistence.ck │ │ │ ├── grow-two-files.c │ │ │ ├── grow-two-files.ck │ │ │ ├── mk-tree.c │ │ │ ├── mk-tree.h │ │ │ ├── syn-rw-persistence.ck │ │ │ ├── syn-rw.c │ │ │ ├── syn-rw.ck │ │ │ ├── syn-rw.h │ │ │ └── tar.c │ │ ├── seq-test.c │ │ └── seq-test.h │ ├── internal │ │ ├── list.c │ │ ├── stdio.c │ │ └── stdlib.c │ ├── lib.c │ ├── lib.h │ ├── lib.pm │ ├── main.c │ ├── main.h │ ├── make-grade │ ├── random.pm │ ├── tests.pm │ ├── threads │ │ ├── Grading │ │ ├── Make.tests │ │ ├── Rubric.alarm │ │ ├── Rubric.mlfqs │ │ ├── Rubric.priority │ │ ├── alarm-multiple.ck │ │ ├── alarm-negative.c │ │ ├── alarm-negative.ck │ │ ├── alarm-priority.c │ │ ├── alarm-priority.ck │ │ ├── alarm-simultaneous.c │ │ ├── alarm-simultaneous.ck │ │ ├── alarm-single.ck │ │ ├── alarm-wait.c │ │ ├── alarm-zero.c │ │ ├── alarm-zero.ck │ │ ├── alarm.pm │ │ ├── mlfqs-block.c │ │ ├── mlfqs-block.ck │ │ ├── mlfqs-fair-2.ck │ │ ├── mlfqs-fair-20.ck │ │ ├── mlfqs-fair.c │ │ ├── mlfqs-load-1.c │ │ ├── mlfqs-load-1.ck │ │ ├── mlfqs-load-60.c │ │ ├── mlfqs-load-60.ck │ │ ├── mlfqs-load-avg.c │ │ ├── mlfqs-load-avg.ck │ │ ├── mlfqs-nice-10.ck │ │ ├── mlfqs-nice-2.ck │ │ ├── mlfqs-recent-1.c │ │ ├── mlfqs-recent-1.ck │ │ ├── mlfqs.pm │ │ ├── priority-change.c │ │ ├── priority-change.ck │ │ ├── priority-condvar.c │ │ ├── priority-condvar.ck │ │ ├── priority-donate-chain.c │ │ ├── priority-donate-chain.ck │ │ ├── priority-donate-lower.c │ │ ├── priority-donate-lower.ck │ │ ├── priority-donate-multiple.c │ │ ├── priority-donate-multiple.ck │ │ ├── priority-donate-multiple2.c │ │ ├── priority-donate-multiple2.ck │ │ ├── priority-donate-nest.c │ │ ├── priority-donate-nest.ck │ │ ├── priority-donate-one.c │ │ ├── priority-donate-one.ck │ │ ├── priority-donate-sema.c │ │ ├── priority-donate-sema.ck │ │ ├── priority-fifo.c │ │ ├── priority-fifo.ck │ │ ├── priority-preempt.c │ │ ├── priority-preempt.ck │ │ ├── priority-sema.c │ │ ├── priority-sema.ck │ │ ├── tests.c │ │ └── tests.h │ ├── userprog │ │ ├── Grading │ │ ├── Make.tests │ │ ├── Rubric.functionality │ │ ├── Rubric.robustness │ │ ├── args-dbl-space.ck │ │ ├── args-many.ck │ │ ├── args-multiple.ck │ │ ├── args-none.ck │ │ ├── args-single.ck │ │ ├── args.c │ │ ├── bad-jump.c │ │ ├── bad-jump.ck │ │ ├── bad-jump2.c │ │ ├── bad-jump2.ck │ │ ├── bad-read.c │ │ ├── bad-read.ck │ │ ├── bad-read2.c │ │ ├── bad-read2.ck │ │ ├── bad-write.c │ │ ├── bad-write.ck │ │ ├── bad-write2.c │ │ ├── bad-write2.ck │ │ ├── boundary.c │ │ ├── boundary.h │ │ ├── child-bad.c │ │ ├── child-close.c │ │ ├── child-rox.c │ │ ├── child-simple.c │ │ ├── close-bad-fd.c │ │ ├── close-bad-fd.ck │ │ ├── close-normal.c │ │ ├── close-normal.ck │ │ ├── close-stdin.c │ │ ├── close-stdin.ck │ │ ├── close-stdout.c │ │ ├── close-stdout.ck │ │ ├── close-twice.c │ │ ├── close-twice.ck │ │ ├── create-bad-ptr.c │ │ ├── create-bad-ptr.ck │ │ ├── create-bound.c │ │ ├── create-bound.ck │ │ ├── create-empty.c │ │ ├── create-empty.ck │ │ ├── create-exists.c │ │ ├── create-exists.ck │ │ ├── create-long.c │ │ ├── create-long.ck │ │ ├── create-normal.c │ │ ├── create-normal.ck │ │ ├── create-null.c │ │ ├── create-null.ck │ │ ├── exec-arg.c │ │ ├── exec-arg.ck │ │ ├── exec-bad-ptr.c │ │ ├── exec-bad-ptr.ck │ │ ├── exec-missing.c │ │ ├── exec-missing.ck │ │ ├── exec-multiple.c │ │ ├── exec-multiple.ck │ │ ├── exec-once.c │ │ ├── exec-once.ck │ │ ├── exit.c │ │ ├── exit.ck │ │ ├── halt.c │ │ ├── halt.ck │ │ ├── lib │ │ │ ├── .gitignore │ │ │ └── user │ │ │ │ ├── .dummy │ │ │ │ └── .gitignore │ │ ├── multi-child-fd.c │ │ ├── multi-child-fd.ck │ │ ├── multi-recurse.c │ │ ├── multi-recurse.ck │ │ ├── no-vm │ │ │ ├── Make.tests │ │ │ ├── Rubric │ │ │ ├── multi-oom.c │ │ │ └── multi-oom.ck │ │ ├── null.ck │ │ ├── open-bad-ptr.c │ │ ├── open-bad-ptr.ck │ │ ├── open-boundary.c │ │ ├── open-boundary.ck │ │ ├── open-empty.c │ │ ├── open-empty.ck │ │ ├── open-missing.c │ │ ├── open-missing.ck │ │ ├── open-normal.c │ │ ├── open-normal.ck │ │ ├── open-null.c │ │ ├── open-null.ck │ │ ├── open-twice.c │ │ ├── open-twice.ck │ │ ├── read-bad-fd.c │ │ ├── read-bad-fd.ck │ │ ├── read-bad-ptr.c │ │ ├── read-bad-ptr.ck │ │ ├── read-boundary.c │ │ ├── read-boundary.ck │ │ ├── read-normal.c │ │ ├── read-normal.ck │ │ ├── read-stdout.c │ │ ├── read-stdout.ck │ │ ├── read-zero.c │ │ ├── read-zero.ck │ │ ├── rox-child.c │ │ ├── rox-child.ck │ │ ├── rox-child.inc │ │ ├── rox-maxchild.c │ │ ├── rox-maxchild.ck │ │ ├── rox-multichild.c │ │ ├── rox-multichild.ck │ │ ├── rox-simple.c │ │ ├── rox-simple.ck │ │ ├── sample.inc │ │ ├── sample.txt │ │ ├── sc-bad-arg.c │ │ ├── sc-bad-arg.ck │ │ ├── sc-bad-sp.c │ │ ├── sc-bad-sp.ck │ │ ├── sc-boundary-2.c │ │ ├── sc-boundary-2.ck │ │ ├── sc-boundary.c │ │ ├── sc-boundary.ck │ │ ├── wait-bad-pid.c │ │ ├── wait-bad-pid.ck │ │ ├── wait-killed.c │ │ ├── wait-killed.ck │ │ ├── wait-simple.c │ │ ├── wait-simple.ck │ │ ├── wait-twice.c │ │ ├── wait-twice.ck │ │ ├── write-bad-fd.c │ │ ├── write-bad-fd.ck │ │ ├── write-bad-ptr.c │ │ ├── write-bad-ptr.ck │ │ ├── write-boundary.c │ │ ├── write-boundary.ck │ │ ├── write-normal.c │ │ ├── write-normal.ck │ │ ├── write-stdin.c │ │ ├── write-stdin.ck │ │ ├── write-zero.c │ │ └── write-zero.ck │ └── vm │ │ ├── Grading │ │ ├── Make.tests │ │ ├── Rubric.functionality │ │ ├── Rubric.robustness │ │ ├── child-inherit.c │ │ ├── child-linear.c │ │ ├── child-mm-wrt.c │ │ ├── child-qsort-mm.c │ │ ├── child-qsort.c │ │ ├── child-sort.c │ │ ├── mmap-bad-fd.c │ │ ├── mmap-bad-fd.ck │ │ ├── mmap-clean.c │ │ ├── mmap-clean.ck │ │ ├── mmap-close.c │ │ ├── mmap-close.ck │ │ ├── mmap-exit.c │ │ ├── mmap-exit.ck │ │ ├── mmap-inherit.c │ │ ├── mmap-inherit.ck │ │ ├── mmap-misalign.c │ │ ├── mmap-misalign.ck │ │ ├── mmap-null.c │ │ ├── mmap-null.ck │ │ ├── mmap-over-code.c │ │ ├── mmap-over-code.ck │ │ ├── mmap-over-data.c │ │ ├── mmap-over-data.ck │ │ ├── mmap-over-stk.c │ │ ├── mmap-over-stk.ck │ │ ├── mmap-overlap.c │ │ ├── mmap-overlap.ck │ │ ├── mmap-read.c │ │ ├── mmap-read.ck │ │ ├── mmap-remove.c │ │ ├── mmap-remove.ck │ │ ├── mmap-shuffle.c │ │ ├── mmap-shuffle.ck │ │ ├── mmap-twice.c │ │ ├── mmap-twice.ck │ │ ├── mmap-unmap.c │ │ ├── mmap-unmap.ck │ │ ├── mmap-write.c │ │ ├── mmap-write.ck │ │ ├── mmap-zero.c │ │ ├── mmap-zero.ck │ │ ├── page-linear.c │ │ ├── page-linear.ck │ │ ├── page-merge-mm.c │ │ ├── page-merge-mm.ck │ │ ├── page-merge-par.c │ │ ├── page-merge-par.ck │ │ ├── page-merge-seq.c │ │ ├── page-merge-seq.ck │ │ ├── page-merge-stk.c │ │ ├── page-merge-stk.ck │ │ ├── page-parallel.c │ │ ├── page-parallel.ck │ │ ├── page-shuffle.c │ │ ├── page-shuffle.ck │ │ ├── parallel-merge.c │ │ ├── parallel-merge.h │ │ ├── process_death.pm │ │ ├── pt-bad-addr.c │ │ ├── pt-bad-addr.ck │ │ ├── pt-bad-read.c │ │ ├── pt-bad-read.ck │ │ ├── pt-big-stk-obj.c │ │ ├── pt-big-stk-obj.ck │ │ ├── pt-grow-bad.c │ │ ├── pt-grow-bad.ck │ │ ├── pt-grow-pusha.c │ │ ├── pt-grow-pusha.ck │ │ ├── pt-grow-stack.c │ │ ├── pt-grow-stack.ck │ │ ├── pt-grow-stk-sc.c │ │ ├── pt-grow-stk-sc.ck │ │ ├── pt-write-code-2.c │ │ ├── pt-write-code.c │ │ ├── pt-write-code.ck │ │ ├── pt-write-code2.ck │ │ ├── qsort.c │ │ ├── qsort.h │ │ ├── sample.inc │ │ └── sample.txt ├── threads │ ├── .gitignore │ ├── Make.vars │ ├── Makefile │ ├── flags.h │ ├── init.c │ ├── init.h │ ├── interrupt.c │ ├── interrupt.h │ ├── intr-stubs.S │ ├── intr-stubs.h │ ├── io.h │ ├── kernel.lds.S │ ├── loader.S │ ├── loader.h │ ├── malloc.c │ ├── malloc.h │ ├── palloc.c │ ├── palloc.h │ ├── pte.h │ ├── start.S │ ├── switch.S │ ├── switch.h │ ├── synch.c │ ├── synch.h │ ├── thread.c │ ├── thread.h │ └── vaddr.h ├── userprog │ ├── .gitignore │ ├── Make.vars │ ├── Makefile │ ├── exception.c │ ├── exception.h │ ├── gdt.c │ ├── gdt.h │ ├── pagedir.c │ ├── pagedir.h │ ├── process.c │ ├── process.h │ ├── syscall.c │ ├── syscall.h │ ├── tss.c │ └── tss.h ├── utils │ ├── .gitignore │ ├── Makefile │ ├── Pintos.pm │ ├── backtrace │ ├── pintos │ ├── pintos-gdb │ ├── pintos-mkdisk │ ├── pintos-set-cmdline │ ├── setitimer-helper.c │ ├── setitimer-helper.o │ ├── squish-pty.c │ ├── squish-pty.o │ ├── squish-unix.c │ └── squish-unix.o └── vm │ ├── .gitignore │ ├── Make.vars │ └── Makefile ├── test1.jpg ├── test2.jpg └── testall.jpg /.gitignore: -------------------------------------------------------------------------------- 1 | *.pdf 2 | *.doc 3 | .DS_Store 4 | .idea 5 | *.docx 6 | *.pl -------------------------------------------------------------------------------- /Notes/img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/1.png -------------------------------------------------------------------------------- /Notes/img/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/10.png -------------------------------------------------------------------------------- /Notes/img/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/11.png -------------------------------------------------------------------------------- /Notes/img/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/12.png -------------------------------------------------------------------------------- /Notes/img/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/13.png -------------------------------------------------------------------------------- /Notes/img/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/14.png -------------------------------------------------------------------------------- /Notes/img/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/15.png -------------------------------------------------------------------------------- /Notes/img/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/16.png -------------------------------------------------------------------------------- /Notes/img/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/17.png -------------------------------------------------------------------------------- /Notes/img/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/18.png -------------------------------------------------------------------------------- /Notes/img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/2.png -------------------------------------------------------------------------------- /Notes/img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/3.png -------------------------------------------------------------------------------- /Notes/img/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/4.png -------------------------------------------------------------------------------- /Notes/img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/5.png -------------------------------------------------------------------------------- /Notes/img/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/6.png -------------------------------------------------------------------------------- /Notes/img/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/7.png -------------------------------------------------------------------------------- /Notes/img/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/8.png -------------------------------------------------------------------------------- /Notes/img/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/Notes/img/9.png -------------------------------------------------------------------------------- /lab00/hello.c: -------------------------------------------------------------------------------- 1 | first line 2 | second line 3 | third line 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 0 11 | -------------------------------------------------------------------------------- /lab00/hello.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | NAME="cs302" 4 | echo $NAME 5 | -------------------------------------------------------------------------------- /lab00/hello2.c: -------------------------------------------------------------------------------- 1 | ` 2 | -------------------------------------------------------------------------------- /lab00/ls.out: -------------------------------------------------------------------------------- 1 | hello.c 2 | hello2.c 3 | ls.out 4 | -------------------------------------------------------------------------------- /lab01/opt.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int x = 0; 5 | x += 1; 6 | x += 1; 7 | x += 1; 8 | printf ("%d\n", x); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /lab02/README.md: -------------------------------------------------------------------------------- 1 | # OS_Lab2 2 | -------------------------------------------------------------------------------- /lab02/fork/fork1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab02/fork/fork1 -------------------------------------------------------------------------------- /lab02/fork/fork1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc,char *argv[]) 6 | { 7 | printf("Before Fork, My PID: [%d]\n",getpid()); 8 | fork(); 9 | printf("After Fork, My PID: [%d]\n",getpid()); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /lab02/fork/fork2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab02/fork/fork2 -------------------------------------------------------------------------------- /lab02/fork/fork_ex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab02/fork/fork_ex -------------------------------------------------------------------------------- /lab02/fork/fork_ex.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc,char *argv[]) 5 | { 6 | printf("A\n"); 7 | fork(); 8 | printf("B\n"); 9 | fork(); 10 | printf("C\n"); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /lab02/getpid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab02/getpid -------------------------------------------------------------------------------- /lab02/getpid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc,char *argv[]) 5 | 6 | { 7 | 8 | printf("My PID is %d\n",getpid()); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /lab02/pipe/pipe_creation: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab02/pipe/pipe_creation -------------------------------------------------------------------------------- /lab02/report/fork: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab02/report/fork -------------------------------------------------------------------------------- /lab02/report/fork.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab02/report/fork.c -------------------------------------------------------------------------------- /lab02/report/pipe.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab02/report/pipe.c -------------------------------------------------------------------------------- /lab02/report/process: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab02/report/process -------------------------------------------------------------------------------- /lab02/report/process.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab02/report/process.c -------------------------------------------------------------------------------- /lab02/report/signal.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab02/report/signal.c -------------------------------------------------------------------------------- /lab02/report/sys.c: -------------------------------------------------------------------------------- 1 | #include < stdlib.h > 2 | 3 | int main() 4 | { 5 | system( "ls -l /bin" ); 6 | return 0; 7 | } -------------------------------------------------------------------------------- /lab02/signals/custom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab02/signals/custom -------------------------------------------------------------------------------- /lab02/signals/custom.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void handler(int signal) 5 | { 6 | printf("Signal %d Received.Kill me if you can\n",signal); 7 | } 8 | 9 | int main(int argc,char *argv[]) 10 | { 11 | signal(SIGINT,handler); 12 | printf("Put into while 1 loop..\n"); 13 | while(1) { } 14 | printf("OK!\n"); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /lab02/signals/kill: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab02/signals/kill -------------------------------------------------------------------------------- /lab02/signals/kill.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc,char *argv[]) 7 | { 8 | printf("My PID: %d\n",getpid()); 9 | sleep(5); 10 | kill(getpid(),SIGSEGV); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /lab02/signals/sigign.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc,char *argv[]) 5 | { 6 | signal(SIGINT,SIG_IGN); 7 | printf("Put into while 1 loop..\n"); 8 | while(1) { } 9 | printf("OK!\n"); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /lab03/Lcode/deq: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab03/Lcode/deq -------------------------------------------------------------------------------- /lab03/Lcode/deq.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab03/Lcode/deq.c -------------------------------------------------------------------------------- /lab03/Lcode/enq: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab03/Lcode/enq -------------------------------------------------------------------------------- /lab03/Lcode/job.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab03/Lcode/job.h -------------------------------------------------------------------------------- /lab03/Lcode/sample: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab03/Lcode/sample -------------------------------------------------------------------------------- /lab03/Lcode/sample.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab03/Lcode/sample.c -------------------------------------------------------------------------------- /lab03/Lcode/scheduler: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab03/Lcode/scheduler -------------------------------------------------------------------------------- /lab03/Lcode/stat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab03/Lcode/stat -------------------------------------------------------------------------------- /lab03/Lcode/stat.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab03/Lcode/stat.c -------------------------------------------------------------------------------- /lab03/Tcode/reparent.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main (void){ 3 | int i; 4 | if (fork () == 0) { 5 | for (i = 0; i < 5; i++) { 6 | printf ("(%d) parent's PID = %d\n", 7 | getpid (), getppid () ); 8 | sleep (1); 9 | } 10 | } 11 | else 12 | sleep (1); 13 | printf ("(%d) bye.\n", getpid ()); 14 | } 15 | -------------------------------------------------------------------------------- /lab03/Tcode/time_1.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main (void){ 3 | int x = 0; 4 | for (int i = 1; i <= 10000; i++) { 5 | x = x + i; 6 | //printf ("x = %d\n", x); 7 | } 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /lab03/Tcode/time_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main (void) { 3 | int x = 0; 4 | for (int i = 1; i <= 10000; i++) { 5 | x = x + i; 6 | printf ("x = %d\n", x); 7 | } 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /lab03/Tcode/time_example_fast.c: -------------------------------------------------------------------------------- 1 | #include 2 | #define MAX 1000000 3 | 4 | int main (void) { 5 | int i; 6 | for (i = 0; i < MAX / 5; i++) 7 | printf ("x\nx\nx\nx\nx\n"); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /lab03/Tcode/time_example_slow.c: -------------------------------------------------------------------------------- 1 | #include 2 | #define MAX 1000000 3 | 4 | int main (void) { 5 | int i; 6 | for (i = 0; i < MAX; i++) 7 | printf ("x\n"); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /lab03/Tcode/wait_and_exit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main (void) { 4 | int pid; 5 | if ( (pid = fork ()) != 0) { 6 | printf ("Look at the status of the child process %d\n", pid); 7 | while (getchar () != '\n'); 8 | wait (NULL); 9 | printf ("Look again!\n"); 10 | while (getchar () != '\n'); 11 | } 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /lab05/reader-writer/BUFFER.TXT: -------------------------------------------------------------------------------- 1 | G -------------------------------------------------------------------------------- /lab05/reader-writer/Main_file: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab05/reader-writer/Main_file -------------------------------------------------------------------------------- /lab05/reader-writer/init.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | -------------------------------------------------------------------------------- /lab05/reader-writer/write.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | sem_t db,rc; 10 | int readcount; 11 | 12 | void *writer(int *buffer){ 13 | sem_wait(&db); 14 | *buffer+=1; 15 | printf ("write ::%d\n", *buffer); 16 | sem_post(&db); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /lab06/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(lab6) 3 | 4 | set(CMAKE_CXX_STANDARD 11) 5 | 6 | add_executable(lab6 temp.cpp) 7 | -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_C.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab06/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_C.bin -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_CXX.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab06/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_CXX.bin -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdC/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab06/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdC/a.out -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdCXX/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab06/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdCXX/a.out -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/TargetDirectories.txt: -------------------------------------------------------------------------------- 1 | /Users/lifesaver/Documents/University/OS/lab6/lab6/cmake-build-debug/CMakeFiles/rebuild_cache.dir 2 | /Users/lifesaver/Documents/University/OS/lab6/lab6/cmake-build-debug/CMakeFiles/edit_cache.dir 3 | /Users/lifesaver/Documents/University/OS/lab6/lab6/cmake-build-debug/CMakeFiles/lab6.dir 4 | -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/clion-environment.txt: -------------------------------------------------------------------------------- 1 | Options: 2 | 3 | Options: -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/cmake.check_cache: -------------------------------------------------------------------------------- 1 | # This file is generated by cmake for dependency checking of the CMakeCache.txt file 2 | -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/feature_tests.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab06/cmake-build-debug/CMakeFiles/feature_tests.bin -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/lab6.dir/CXX.includecache: -------------------------------------------------------------------------------- 1 | #IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">]) 2 | 3 | #IncludeRegexScan: ^.*$ 4 | 5 | #IncludeRegexComplain: ^$ 6 | 7 | #IncludeRegexTransform: 8 | 9 | /Users/lifesaver/Documents/University/OS/lab6/lab6/temp.cpp 10 | unistd.h 11 | - 12 | string 13 | - 14 | 15 | -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/lab6.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/lab6.dir/temp.cpp.o" 3 | "lab6.pdb" 4 | "lab6" 5 | ) 6 | 7 | # Per-language clean rules from dependency scanning. 8 | foreach(lang CXX) 9 | include(CMakeFiles/lab6.dir/cmake_clean_${lang}.cmake OPTIONAL) 10 | endforeach() 11 | -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/lab6.dir/depend.internal: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | CMakeFiles/lab6.dir/temp.cpp.o 5 | /Users/lifesaver/Documents/University/OS/lab6/lab6/temp.cpp 6 | -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/lab6.dir/depend.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | CMakeFiles/lab6.dir/temp.cpp.o: ../temp.cpp 5 | 6 | -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/lab6.dir/link.txt: -------------------------------------------------------------------------------- 1 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/lab6.dir/temp.cpp.o -o lab6 2 | -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/lab6.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 1 2 | CMAKE_PROGRESS_2 = 2 3 | 4 | -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/lab6.dir/temp.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab06/cmake-build-debug/CMakeFiles/lab6.dir/temp.cpp.o -------------------------------------------------------------------------------- /lab06/cmake-build-debug/CMakeFiles/progress.marks: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /lab06/cmake-build-debug/lab6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab06/cmake-build-debug/lab6 -------------------------------------------------------------------------------- /lab07/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(code) 3 | 4 | 5 | set(CMAKE_CXX_STANDARD 11) 6 | 7 | add_executable(code lab7.cpp) 8 | -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_C.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab07/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_C.bin -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_CXX.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab07/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_CXX.bin -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdC/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab07/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdC/a.out -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdCXX/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab07/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdCXX/a.out -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/TargetDirectories.txt: -------------------------------------------------------------------------------- 1 | /Users/lifesaver/Documents/University/OS/lab7/code/cmake-build-debug/CMakeFiles/rebuild_cache.dir 2 | /Users/lifesaver/Documents/University/OS/lab7/code/cmake-build-debug/CMakeFiles/edit_cache.dir 3 | /Users/lifesaver/Documents/University/OS/lab7/code/cmake-build-debug/CMakeFiles/code.dir 4 | -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/clion-environment.txt: -------------------------------------------------------------------------------- 1 | Options: 2 | 3 | Options: -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/cmake.check_cache: -------------------------------------------------------------------------------- 1 | # This file is generated by cmake for dependency checking of the CMakeCache.txt file 2 | -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/code.dir/C.includecache: -------------------------------------------------------------------------------- 1 | #IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">]) 2 | 3 | #IncludeRegexScan: ^.*$ 4 | 5 | #IncludeRegexComplain: ^$ 6 | 7 | #IncludeRegexTransform: 8 | 9 | /Users/lifesaver/Documents/University/OS/lab7/code/lab7.c 10 | stdio.h 11 | - 12 | stdlib.h 13 | - 14 | string.h 15 | - 16 | 17 | -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/code.dir/CXX.includecache: -------------------------------------------------------------------------------- 1 | #IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">]) 2 | 3 | #IncludeRegexScan: ^.*$ 4 | 5 | #IncludeRegexComplain: ^$ 6 | 7 | #IncludeRegexTransform: 8 | 9 | /Users/lifesaver/Documents/University/OS/lab7/code/lab7.cpp 10 | unistd.h 11 | - 12 | string 13 | - 14 | iostream 15 | - 16 | 17 | -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/code.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/code.dir/lab7.cpp.o" 3 | "code.pdb" 4 | "code" 5 | ) 6 | 7 | # Per-language clean rules from dependency scanning. 8 | foreach(lang CXX) 9 | include(CMakeFiles/code.dir/cmake_clean_${lang}.cmake OPTIONAL) 10 | endforeach() 11 | -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/code.dir/depend.internal: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | CMakeFiles/code.dir/lab7.cpp.o 5 | /Users/lifesaver/Documents/University/OS/lab7/code/lab7.cpp 6 | -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/code.dir/depend.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | CMakeFiles/code.dir/lab7.cpp.o: ../lab7.cpp 5 | 6 | -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/code.dir/lab7.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab07/cmake-build-debug/CMakeFiles/code.dir/lab7.c.o -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/code.dir/lab7.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab07/cmake-build-debug/CMakeFiles/code.dir/lab7.cpp.o -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/code.dir/link.txt: -------------------------------------------------------------------------------- 1 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/code.dir/lab7.cpp.o -o code 2 | -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/code.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 1 2 | CMAKE_PROGRESS_2 = 2 3 | 4 | -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/feature_tests.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab07/cmake-build-debug/CMakeFiles/feature_tests.bin -------------------------------------------------------------------------------- /lab07/cmake-build-debug/CMakeFiles/progress.marks: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /lab07/cmake-build-debug/code: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab07/cmake-build-debug/code -------------------------------------------------------------------------------- /lab07/test.txt: -------------------------------------------------------------------------------- 1 | BCDE000 2 | 00010B2 3 | 00010BA -------------------------------------------------------------------------------- /lab08/Algo_real: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab08/Algo_real -------------------------------------------------------------------------------- /lab08/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(lab8) 3 | 4 | set(CMAKE_CXX_STANDARD 11) 5 | 6 | add_executable(lab8 7 | Algo_real.cpp) 8 | -------------------------------------------------------------------------------- /lab08/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_C.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab08/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_C.bin -------------------------------------------------------------------------------- /lab08/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_CXX.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab08/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_CXX.bin -------------------------------------------------------------------------------- /lab08/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdC/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab08/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdC/a.out -------------------------------------------------------------------------------- /lab08/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdCXX/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab08/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdCXX/a.out -------------------------------------------------------------------------------- /lab08/cmake-build-debug/CMakeFiles/clion-environment.txt: -------------------------------------------------------------------------------- 1 | Options: 2 | 3 | Options: -------------------------------------------------------------------------------- /lab08/cmake-build-debug/CMakeFiles/cmake.check_cache: -------------------------------------------------------------------------------- 1 | # This file is generated by cmake for dependency checking of the CMakeCache.txt file 2 | -------------------------------------------------------------------------------- /lab08/cmake-build-debug/CMakeFiles/feature_tests.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab08/cmake-build-debug/CMakeFiles/feature_tests.bin -------------------------------------------------------------------------------- /lab08/cmake-build-debug/CMakeFiles/lab8.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/lab8.dir/Algo_real.cpp.o" 3 | "lab8.pdb" 4 | "lab8" 5 | ) 6 | 7 | # Per-language clean rules from dependency scanning. 8 | foreach(lang CXX) 9 | include(CMakeFiles/lab8.dir/cmake_clean_${lang}.cmake OPTIONAL) 10 | endforeach() 11 | -------------------------------------------------------------------------------- /lab08/cmake-build-debug/CMakeFiles/lab8.dir/depend.make: -------------------------------------------------------------------------------- 1 | # Empty dependencies file for lab8. 2 | # This may be replaced when dependencies are built. 3 | -------------------------------------------------------------------------------- /lab08/cmake-build-debug/CMakeFiles/lab8.dir/link.txt: -------------------------------------------------------------------------------- 1 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/lab8.dir/Algo_real.cpp.o -o lab8 2 | -------------------------------------------------------------------------------- /lab08/cmake-build-debug/CMakeFiles/lab8.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 1 2 | CMAKE_PROGRESS_2 = 2 3 | 4 | -------------------------------------------------------------------------------- /lab08/cmake-build-debug/CMakeFiles/progress.marks: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /lab08/cmake-build-debug/lab8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab08/cmake-build-debug/lab8 -------------------------------------------------------------------------------- /lab09/0.in: -------------------------------------------------------------------------------- 1 | 50 200 8 2 | 95 180 34 119 11 123 62 64 -------------------------------------------------------------------------------- /lab09/1.in: -------------------------------------------------------------------------------- 1 | 300 555 6 2 | 312 360 265 289 171 550 -------------------------------------------------------------------------------- /lab09/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(lab9) 3 | 4 | set(CMAKE_CXX_STANDARD 11) 5 | 6 | add_executable(lab9 7 | lab9_11510225.cpp) 8 | -------------------------------------------------------------------------------- /lab09/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab09/a.out -------------------------------------------------------------------------------- /lab09/additional-test/4-1.in: -------------------------------------------------------------------------------- 1 | 50 200 1 2 | 50 -------------------------------------------------------------------------------- /lab09/additional-test/4-2.in: -------------------------------------------------------------------------------- 1 | 50 200 1 2 | 40 -------------------------------------------------------------------------------- /lab09/additional-test/4-3.in: -------------------------------------------------------------------------------- 1 | 50 200 1 2 | 60 -------------------------------------------------------------------------------- /lab09/additional-test/5-1.in: -------------------------------------------------------------------------------- 1 | 50 200 3 2 | 50 40 60 -------------------------------------------------------------------------------- /lab09/additional-test/5-2.in: -------------------------------------------------------------------------------- 1 | 50 200 4 2 | 40 30 20 10 -------------------------------------------------------------------------------- /lab09/additional-test/5-3.in: -------------------------------------------------------------------------------- 1 | 50 200 4 2 | 60 70 80 90 -------------------------------------------------------------------------------- /lab09/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_C.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab09/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_C.bin -------------------------------------------------------------------------------- /lab09/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_CXX.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab09/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_CXX.bin -------------------------------------------------------------------------------- /lab09/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdC/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab09/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdC/a.out -------------------------------------------------------------------------------- /lab09/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdCXX/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab09/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdCXX/a.out -------------------------------------------------------------------------------- /lab09/cmake-build-debug/CMakeFiles/clion-environment.txt: -------------------------------------------------------------------------------- 1 | Options: 2 | 3 | Options: -------------------------------------------------------------------------------- /lab09/cmake-build-debug/CMakeFiles/cmake.check_cache: -------------------------------------------------------------------------------- 1 | # This file is generated by cmake for dependency checking of the CMakeCache.txt file 2 | -------------------------------------------------------------------------------- /lab09/cmake-build-debug/CMakeFiles/feature_tests.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab09/cmake-build-debug/CMakeFiles/feature_tests.bin -------------------------------------------------------------------------------- /lab09/cmake-build-debug/CMakeFiles/lab9.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/lab9.dir/lab9_11510225.cpp.o" 3 | "lab9.pdb" 4 | "lab9" 5 | ) 6 | 7 | # Per-language clean rules from dependency scanning. 8 | foreach(lang CXX) 9 | include(CMakeFiles/lab9.dir/cmake_clean_${lang}.cmake OPTIONAL) 10 | endforeach() 11 | -------------------------------------------------------------------------------- /lab09/cmake-build-debug/CMakeFiles/lab9.dir/depend.internal: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | CMakeFiles/lab9.dir/lab9_11510225.cpp.o 5 | /Users/lifesaver/Documents/University/OS/CS302-Operating-System/lab9/lab9_11510225.cpp 6 | -------------------------------------------------------------------------------- /lab09/cmake-build-debug/CMakeFiles/lab9.dir/depend.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | CMakeFiles/lab9.dir/lab9_11510225.cpp.o: ../lab9_11510225.cpp 5 | 6 | -------------------------------------------------------------------------------- /lab09/cmake-build-debug/CMakeFiles/lab9.dir/lab9_11510225.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab09/cmake-build-debug/CMakeFiles/lab9.dir/lab9_11510225.cpp.o -------------------------------------------------------------------------------- /lab09/cmake-build-debug/CMakeFiles/lab9.dir/link.txt: -------------------------------------------------------------------------------- 1 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/lab9.dir/lab9_11510225.cpp.o -o lab9 2 | -------------------------------------------------------------------------------- /lab09/cmake-build-debug/CMakeFiles/lab9.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 1 2 | CMAKE_PROGRESS_2 = 2 3 | 4 | -------------------------------------------------------------------------------- /lab09/cmake-build-debug/CMakeFiles/progress.marks: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /lab09/cmake-build-debug/lab9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab09/cmake-build-debug/lab9 -------------------------------------------------------------------------------- /lab09/disk-scheduling-master/README.md: -------------------------------------------------------------------------------- 1 | disk-scheduling 2 | -------------------------------------------------------------------------------- /lab10/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab10/a.out -------------------------------------------------------------------------------- /lab11/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(lab11) 3 | 4 | set(CMAKE_CXX_STANDARD 11) 5 | 6 | add_executable(lab11 7 | 11510225.cpp) 8 | -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_C.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab11/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_C.bin -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_CXX.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab11/cmake-build-debug/CMakeFiles/3.10.3/CMakeDetermineCompilerABI_CXX.bin -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdC/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab11/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdC/a.out -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdCXX/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab11/cmake-build-debug/CMakeFiles/3.10.3/CompilerIdCXX/a.out -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/clion-environment.txt: -------------------------------------------------------------------------------- 1 | Options: 2 | 3 | Options: -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/cmake.check_cache: -------------------------------------------------------------------------------- 1 | # This file is generated by cmake for dependency checking of the CMakeCache.txt file 2 | -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/feature_tests.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab11/cmake-build-debug/CMakeFiles/feature_tests.bin -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/lab11.dir/11510225.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab11/cmake-build-debug/CMakeFiles/lab11.dir/11510225.cpp.o -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/lab11.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/lab11.dir/11510225.cpp.o" 3 | "lab11.pdb" 4 | "lab11" 5 | ) 6 | 7 | # Per-language clean rules from dependency scanning. 8 | foreach(lang CXX) 9 | include(CMakeFiles/lab11.dir/cmake_clean_${lang}.cmake OPTIONAL) 10 | endforeach() 11 | -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/lab11.dir/depend.internal: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | CMakeFiles/lab11.dir/11510225.cpp.o 5 | /Users/lifesaver/Documents/University/OS/CS302-Operating-System/lab11/11510225.cpp 6 | -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/lab11.dir/depend.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | CMakeFiles/lab11.dir/11510225.cpp.o: ../11510225.cpp 5 | 6 | -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/lab11.dir/file_system.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab11/cmake-build-debug/CMakeFiles/lab11.dir/file_system.cpp.o -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/lab11.dir/link.txt: -------------------------------------------------------------------------------- 1 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/lab11.dir/11510225.cpp.o -o lab11 2 | -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/lab11.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 1 2 | CMAKE_PROGRESS_2 = 2 3 | 4 | -------------------------------------------------------------------------------- /lab11/cmake-build-debug/CMakeFiles/progress.marks: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /lab11/cmake-build-debug/lab11: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/lab11/cmake-build-debug/lab11 -------------------------------------------------------------------------------- /proj1/src/.gitignore: -------------------------------------------------------------------------------- 1 | cscope.files 2 | cscope.out 3 | TAGS 4 | tags 5 | -------------------------------------------------------------------------------- /proj1/src/devices/ide.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_IDE_H 2 | #define DEVICES_IDE_H 3 | 4 | void ide_init (void); 5 | 6 | #endif /* devices/ide.h */ 7 | -------------------------------------------------------------------------------- /proj1/src/devices/input.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_INPUT_H 2 | #define DEVICES_INPUT_H 3 | 4 | #include 5 | #include 6 | 7 | void input_init (void); 8 | void input_putc (uint8_t); 9 | uint8_t input_getc (void); 10 | bool input_full (void); 11 | 12 | #endif /* devices/input.h */ 13 | -------------------------------------------------------------------------------- /proj1/src/devices/kbd.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_KBD_H 2 | #define DEVICES_KBD_H 3 | 4 | #include 5 | 6 | void kbd_init (void); 7 | void kbd_print_stats (void); 8 | 9 | #endif /* devices/kbd.h */ 10 | -------------------------------------------------------------------------------- /proj1/src/devices/partition.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_PARTITION_H 2 | #define DEVICES_PARTITION_H 3 | 4 | struct block; 5 | 6 | void partition_scan (struct block *); 7 | 8 | #endif /* devices/partition.h */ 9 | -------------------------------------------------------------------------------- /proj1/src/devices/pit.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_PIT_H 2 | #define DEVICES_PIT_H 3 | 4 | #include 5 | 6 | void pit_configure_channel (int channel, int mode, int frequency); 7 | 8 | #endif /* devices/pit.h */ 9 | -------------------------------------------------------------------------------- /proj1/src/devices/rtc.h: -------------------------------------------------------------------------------- 1 | #ifndef RTC_H 2 | #define RTC_H 3 | 4 | typedef unsigned long time_t; 5 | 6 | time_t rtc_get_time (void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /proj1/src/devices/serial.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_SERIAL_H 2 | #define DEVICES_SERIAL_H 3 | 4 | #include 5 | 6 | void serial_init_queue (void); 7 | void serial_putc (uint8_t); 8 | void serial_flush (void); 9 | void serial_notify (void); 10 | 11 | #endif /* devices/serial.h */ 12 | -------------------------------------------------------------------------------- /proj1/src/devices/speaker.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_SPEAKER_H 2 | #define DEVICES_SPEAKER_H 3 | 4 | void speaker_on (int frequency); 5 | void speaker_off (void); 6 | void speaker_beep (void); 7 | 8 | #endif /* devices/speaker.h */ 9 | -------------------------------------------------------------------------------- /proj1/src/devices/vga.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_VGA_H 2 | #define DEVICES_VGA_H 3 | 4 | void vga_putc (int); 5 | 6 | #endif /* devices/vga.h */ 7 | -------------------------------------------------------------------------------- /proj1/src/examples/.gitignore: -------------------------------------------------------------------------------- 1 | cat 2 | cmp 3 | cp 4 | echo 5 | halt 6 | hex-dump 7 | ls 8 | mcat 9 | mcp 10 | mkdir 11 | pwd 12 | rm 13 | shell 14 | bubsort 15 | insult 16 | lineup 17 | matmult 18 | recursor 19 | *.d 20 | -------------------------------------------------------------------------------- /proj1/src/examples/echo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int 5 | main (int argc, char **argv) 6 | { 7 | int i; 8 | 9 | for (i = 0; i < argc; i++) 10 | printf ("%s ", argv[i]); 11 | printf ("\n"); 12 | 13 | return EXIT_SUCCESS; 14 | } 15 | -------------------------------------------------------------------------------- /proj1/src/examples/halt.c: -------------------------------------------------------------------------------- 1 | /* halt.c 2 | 3 | Simple program to test whether running a user program works. 4 | 5 | Just invokes a system call that shuts down the OS. */ 6 | 7 | #include 8 | 9 | int 10 | main (void) 11 | { 12 | halt (); 13 | /* not reached */ 14 | } 15 | -------------------------------------------------------------------------------- /proj1/src/examples/lib/.gitignore: -------------------------------------------------------------------------------- 1 | *.d 2 | -------------------------------------------------------------------------------- /proj1/src/examples/lib/user/.dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/proj1/src/examples/lib/user/.dummy -------------------------------------------------------------------------------- /proj1/src/examples/lib/user/.gitignore: -------------------------------------------------------------------------------- 1 | *.d 2 | -------------------------------------------------------------------------------- /proj1/src/filesys/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | bochsrc.txt 3 | bochsout.txt 4 | -------------------------------------------------------------------------------- /proj1/src/filesys/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.kernel 2 | -------------------------------------------------------------------------------- /proj1/src/filesys/fsutil.h: -------------------------------------------------------------------------------- 1 | #ifndef FILESYS_FSUTIL_H 2 | #define FILESYS_FSUTIL_H 3 | 4 | void fsutil_ls (char **argv); 5 | void fsutil_cat (char **argv); 6 | void fsutil_rm (char **argv); 7 | void fsutil_extract (char **argv); 8 | void fsutil_append (char **argv); 9 | 10 | #endif /* filesys/fsutil.h */ 11 | -------------------------------------------------------------------------------- /proj1/src/lib/kernel/console.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIB_KERNEL_CONSOLE_H 2 | #define __LIB_KERNEL_CONSOLE_H 3 | 4 | void console_init (void); 5 | void console_panic (void); 6 | void console_print_stats (void); 7 | 8 | #endif /* lib/kernel/console.h */ 9 | -------------------------------------------------------------------------------- /proj1/src/lib/kernel/stdio.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIB_KERNEL_STDIO_H 2 | #define __LIB_KERNEL_STDIO_H 3 | 4 | void putbuf (const char *, size_t); 5 | 6 | #endif /* lib/kernel/stdio.h */ 7 | -------------------------------------------------------------------------------- /proj1/src/lib/random.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIB_RANDOM_H 2 | #define __LIB_RANDOM_H 3 | 4 | #include 5 | 6 | void random_init (unsigned seed); 7 | void random_bytes (void *, size_t); 8 | unsigned long random_ulong (void); 9 | 10 | #endif /* lib/random.h */ 11 | -------------------------------------------------------------------------------- /proj1/src/lib/stdbool.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIB_STDBOOL_H 2 | #define __LIB_STDBOOL_H 3 | 4 | #define bool _Bool 5 | #define true 1 6 | #define false 0 7 | #define __bool_true_false_are_defined 1 8 | 9 | #endif /* lib/stdbool.h */ 10 | -------------------------------------------------------------------------------- /proj1/src/lib/user/entry.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (int, char *[]); 4 | void _start (int argc, char *argv[]); 5 | 6 | void 7 | _start (int argc, char *argv[]) 8 | { 9 | exit (main (argc, argv)); 10 | } 11 | -------------------------------------------------------------------------------- /proj1/src/lib/user/stdio.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIB_USER_STDIO_H 2 | #define __LIB_USER_STDIO_H 3 | 4 | int hprintf (int, const char *, ...) PRINTF_FORMAT (2, 3); 5 | int vhprintf (int, const char *, va_list) PRINTF_FORMAT (2, 0); 6 | 7 | #endif /* lib/user/stdio.h */ 8 | -------------------------------------------------------------------------------- /proj1/src/misc/bochs-2.2.6-namespace.patch: -------------------------------------------------------------------------------- 1 | --- bochs-2.2.6/bx_debug/symbols.cc 2011-08-19 11:04:11.760139836 -0600 2 | +++ bochs-2.2.6-patched/bx_debug/symbols.cc 2011-08-19 11:04:04.980139837 -0600 3 | @@ -92,6 +92,7 @@ 4 | #endif 5 | 6 | using namespace std; 7 | +namespace std { using namespace __gnu_cxx; } 8 | 9 | struct symbol_entry_t 10 | { 11 | -------------------------------------------------------------------------------- /proj1/src/tests/cksum.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_CKSUM_H 2 | #define TESTS_CKSUM_H 3 | 4 | #include 5 | 6 | unsigned long cksum(const void *, size_t); 7 | 8 | #endif /* tests/cksum.h */ 9 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/base/lg-create.c: -------------------------------------------------------------------------------- 1 | /* Tests that create properly zeros out the contents of a fairly 2 | large file. */ 3 | 4 | #define TEST_SIZE 75678 5 | #include "tests/filesys/create.inc" 6 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/base/lg-full.c: -------------------------------------------------------------------------------- 1 | /* Writes out the contents of a fairly large file all at once, 2 | and then reads it back to make sure that it was written 3 | properly. */ 4 | 5 | #define TEST_SIZE 75678 6 | #include "tests/filesys/base/full.inc" 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/base/lg-random.c: -------------------------------------------------------------------------------- 1 | /* Writes out the content of a fairly large file in random order, 2 | then reads it back in random order to verify that it was 3 | written properly. */ 4 | 5 | #define BLOCK_SIZE 512 6 | #define TEST_SIZE (512 * 150) 7 | #include "tests/filesys/base/random.inc" 8 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/base/lg-seq-block.c: -------------------------------------------------------------------------------- 1 | /* Writes out a fairly large file sequentially, one fixed-size 2 | block at a time, then reads it back to verify that it was 3 | written properly. */ 4 | 5 | #define TEST_SIZE 75678 6 | #define BLOCK_SIZE 513 7 | #include "tests/filesys/base/seq-block.inc" 8 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/base/lg-seq-random.c: -------------------------------------------------------------------------------- 1 | /* Writes out a fairly large file sequentially, one random-sized 2 | block at a time, then reads it back to verify that it was 3 | written properly. */ 4 | 5 | #define TEST_SIZE 75678 6 | #include "tests/filesys/base/seq-random.inc" 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/base/sm-create.c: -------------------------------------------------------------------------------- 1 | /* Tests that create properly zeros out the contents of a fairly 2 | small file. */ 3 | 4 | #define TEST_SIZE 5678 5 | #include "tests/filesys/create.inc" 6 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/base/sm-full.c: -------------------------------------------------------------------------------- 1 | /* Writes out the contents of a fairly small file all at once, 2 | and then reads it back to make sure that it was written 3 | properly. */ 4 | 5 | #define TEST_SIZE 5678 6 | #include "tests/filesys/base/full.inc" 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/base/sm-random.c: -------------------------------------------------------------------------------- 1 | /* Writes out the content of a fairly small file in random order, 2 | then reads it back in random order to verify that it was 3 | written properly. */ 4 | 5 | #define BLOCK_SIZE 13 6 | #define TEST_SIZE (13 * 123) 7 | #include "tests/filesys/base/random.inc" 8 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/base/sm-seq-block.c: -------------------------------------------------------------------------------- 1 | /* Writes out a fairly small file sequentially, one fixed-size 2 | block at a time, then reads it back to verify that it was 3 | written properly. */ 4 | 5 | #define TEST_SIZE 5678 6 | #define BLOCK_SIZE 513 7 | #include "tests/filesys/base/seq-block.inc" 8 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/base/sm-seq-random.c: -------------------------------------------------------------------------------- 1 | /* Writes out a fairly large file sequentially, one random-sized 2 | block at a time, then reads it back to verify that it was 3 | written properly. */ 4 | 5 | #define TEST_SIZE 5678 6 | #include "tests/filesys/base/seq-random.inc" 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/base/syn-read.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_FILESYS_BASE_SYN_READ_H 2 | #define TESTS_FILESYS_BASE_SYN_READ_H 3 | 4 | #define BUF_SIZE 1024 5 | static const char file_name[] = "data"; 6 | 7 | #endif /* tests/filesys/base/syn-read.h */ 8 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/base/syn-write.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_FILESYS_BASE_SYN_WRITE_H 2 | #define TESTS_FILESYS_BASE_SYN_WRITE_H 3 | 4 | #define CHILD_CNT 10 5 | #define CHUNK_SIZE 512 6 | #define BUF_SIZE (CHILD_CNT * CHUNK_SIZE) 7 | static const char file_name[] = "stuff"; 8 | 9 | #endif /* tests/filesys/base/syn-write.h */ 10 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/Rubric.robustness: -------------------------------------------------------------------------------- 1 | Robustness of file system: 2 | 1 dir-empty-name 3 | 1 dir-open 4 | 1 dir-over-file 5 | 1 dir-under-file 6 | 7 | 3 dir-rm-cwd 8 | 2 dir-rm-parent 9 | 1 dir-rm-root 10 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-empty-name-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-empty-name.c: -------------------------------------------------------------------------------- 1 | /* Tries to create a directory named as the empty string, 2 | which must return failure. */ 3 | 4 | #include 5 | #include "tests/lib.h" 6 | #include "tests/main.h" 7 | 8 | void 9 | test_main (void) 10 | { 11 | CHECK (!mkdir (""), "mkdir \"\" (must return false)"); 12 | } 13 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-empty-name.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-empty-name) begin 7 | (dir-empty-name) mkdir "" (must return false) 8 | (dir-empty-name) end 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-mk-tree-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | my ($tree); 6 | for my $a (0...3) { 7 | for my $b (0...2) { 8 | for my $c (0...2) { 9 | for my $d (0...3) { 10 | $tree->{$a}{$b}{$c}{$d} = ['']; 11 | } 12 | } 13 | } 14 | } 15 | check_archive ($tree); 16 | pass; 17 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-mk-tree.c: -------------------------------------------------------------------------------- 1 | /* Creates directories /0/0/0 through /3/2/2 and creates files in 2 | the leaf directories. */ 3 | 4 | #include "tests/filesys/extended/mk-tree.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | make_tree (4, 3, 3, 4); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-mk-tree.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-mk-tree) begin 7 | (dir-mk-tree) creating /0/0/0/0 through /3/2/2/3... 8 | (dir-mk-tree) open "/0/2/0/3" 9 | (dir-mk-tree) close "/0/2/0/3" 10 | (dir-mk-tree) end 11 | EOF 12 | pass; 13 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-mkdir-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({'a' => {'b' => ["\0" x 512]}}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-mkdir.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-mkdir) begin 7 | (dir-mkdir) mkdir "a" 8 | (dir-mkdir) create "a/b" 9 | (dir-mkdir) chdir "a" 10 | (dir-mkdir) open "b" 11 | (dir-mkdir) end 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-open-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({"xyzzy" => {}}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-over-file-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({"abc" => {}}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-over-file.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-over-file) begin 7 | (dir-over-file) mkdir "abc" 8 | (dir-over-file) create "abc" (must return false) 9 | (dir-over-file) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-rm-cwd-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | my ($cwd_removable) = read_text_file ("tests/filesys/extended/can-rmdir-cwd"); 6 | $cwd_removable eq 'YES' || $cwd_removable eq 'NO' or die; 7 | check_archive ($cwd_removable eq 'YES' ? {} : {"a" => {}}); 8 | pass; 9 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-rm-parent-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({"a" => {"b" => {}}}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-rm-root-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({"a" => ["\0" x 243]}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-rm-root.c: -------------------------------------------------------------------------------- 1 | /* Try to remove the root directory. 2 | This must fail. */ 3 | 4 | #include 5 | #include "tests/lib.h" 6 | #include "tests/main.h" 7 | 8 | void 9 | test_main (void) 10 | { 11 | CHECK (!remove ("/"), "remove \"/\" (must fail)"); 12 | CHECK (create ("/a", 243), "create \"/a\""); 13 | } 14 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-rm-root.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-rm-root) begin 7 | (dir-rm-root) remove "/" (must fail) 8 | (dir-rm-root) create "/a" 9 | (dir-rm-root) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-rm-tree-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-rmdir-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-rmdir.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-rmdir) begin 7 | (dir-rmdir) mkdir "a" 8 | (dir-rmdir) rmdir "a" 9 | (dir-rmdir) chdir "a" (must return false) 10 | (dir-rmdir) end 11 | EOF 12 | pass; 13 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-under-file-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({"abc" => ['']}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-under-file.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-under-file) begin 7 | (dir-under-file) create "abc" 8 | (dir-under-file) mkdir "abc" (must return false) 9 | (dir-under-file) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/dir-vine.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-vine) begin 7 | (dir-vine) creating many levels of files and directories... 8 | (dir-vine) removing all but top 10 levels of files and directories... 9 | (dir-vine) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-create-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({"blargle" => ['']}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-create.c: -------------------------------------------------------------------------------- 1 | /* Create a file of size 0. */ 2 | 3 | #define TEST_SIZE 0 4 | #include "tests/filesys/create.inc" 5 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-dir-lg-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | my ($fs); 7 | $fs->{'x'}{"file$_"} = [random_bytes (512)] foreach 0...49; 8 | check_archive ($fs); 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-dir-lg.c: -------------------------------------------------------------------------------- 1 | /* Creates a directory, 2 | then creates 50 files in that directory. */ 3 | 4 | #define FILE_CNT 50 5 | #define DIRECTORY "/x" 6 | #include "tests/filesys/extended/grow-dir.inc" 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-file-size-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | check_archive ({"testfile" => [random_bytes (2134)]}); 7 | pass; 8 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-root-lg-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | my ($fs); 7 | $fs->{"file$_"} = [random_bytes (512)] foreach 0...49; 8 | check_archive ($fs); 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-root-lg.c: -------------------------------------------------------------------------------- 1 | /* Creates 50 files in the root directory. */ 2 | 3 | #define FILE_CNT 50 4 | #include "tests/filesys/extended/grow-dir.inc" 5 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-root-sm-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | my ($fs); 7 | $fs->{"file$_"} = [random_bytes (512)] foreach 0...19; 8 | check_archive ($fs); 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-root-sm.c: -------------------------------------------------------------------------------- 1 | /* Creates 20 files in the root directory. */ 2 | 3 | #define FILE_CNT 20 4 | #include "tests/filesys/extended/grow-dir.inc" 5 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-seq-lg-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | check_archive ({"testme" => [random_bytes (72943)]}); 7 | pass; 8 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-seq-lg.c: -------------------------------------------------------------------------------- 1 | /* Grows a file from 0 bytes to 72,943 bytes, 1,234 bytes at a 2 | time. */ 3 | 4 | #define TEST_SIZE 72943 5 | #include "tests/filesys/extended/grow-seq.inc" 6 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-seq-sm-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | check_archive ({"testme" => [random_bytes (5678)]}); 7 | pass; 8 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-seq-sm.c: -------------------------------------------------------------------------------- 1 | /* Grows a file from 0 bytes to 5,678 bytes, 1,234 bytes at a 2 | time. */ 3 | 4 | #define TEST_SIZE 5678 5 | #include "tests/filesys/extended/grow-seq.inc" 6 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-sparse-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({"testfile" => ["\0" x 76543]}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-tell-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | check_archive ({"foobar" => [random_bytes (2134)]}); 7 | pass; 8 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/grow-two-files-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | my ($a) = random_bytes (8143); 7 | my ($b) = random_bytes (8143); 8 | check_archive ({"a" => [$a], "b" => [$b]}); 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/mk-tree.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_FILESYS_EXTENDED_MK_TREE_H 2 | #define TESTS_FILESYS_EXTENDED_MK_TREE_H 3 | 4 | void make_tree (int at, int bt, int ct, int dt); 5 | 6 | #endif /* tests/filesys/extended/mk-tree.h */ 7 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/syn-rw-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | check_archive ({"child-syn-rw" => "tests/filesys/extended/child-syn-rw", 7 | "logfile" => [random_bytes (8 * 512)]}); 8 | pass; 9 | -------------------------------------------------------------------------------- /proj1/src/tests/filesys/extended/syn-rw.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_FILESYS_EXTENDED_SYN_RW_H 2 | #define TESTS_FILESYS_EXTENDED_SYN_RW_H 3 | 4 | #define CHUNK_SIZE 8 5 | #define CHUNK_CNT 512 6 | #define BUF_SIZE (CHUNK_SIZE * CHUNK_CNT) 7 | static const char file_name[] = "logfile"; 8 | 9 | #endif /* tests/filesys/extended/syn-rw.h */ 10 | -------------------------------------------------------------------------------- /proj1/src/tests/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "tests/lib.h" 3 | #include "tests/main.h" 4 | 5 | int 6 | main (int argc UNUSED, char *argv[]) 7 | { 8 | test_name = argv[0]; 9 | 10 | msg ("begin"); 11 | random_init (0); 12 | test_main (); 13 | msg ("end"); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /proj1/src/tests/main.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_MAIN_H 2 | #define TESTS_MAIN_H 3 | 4 | void test_main (void); 5 | 6 | #endif /* tests/main.h */ 7 | -------------------------------------------------------------------------------- /proj1/src/tests/threads/Grading: -------------------------------------------------------------------------------- 1 | # Percentage of the testing point total designated for each set of 2 | # tests. 3 | 4 | 20.0% tests/threads/Rubric.alarm 5 | 40.0% tests/threads/Rubric.priority 6 | 40.0% tests/threads/Rubric.mlfqs 7 | -------------------------------------------------------------------------------- /proj1/src/tests/threads/Rubric.alarm: -------------------------------------------------------------------------------- 1 | Functionality and robustness of alarm clock: 2 | 4 alarm-single 3 | 4 alarm-multiple 4 | 4 alarm-simultaneous 5 | 4 alarm-priority 6 | 7 | 1 alarm-zero 8 | 1 alarm-negative 9 | -------------------------------------------------------------------------------- /proj1/src/tests/threads/Rubric.mlfqs: -------------------------------------------------------------------------------- 1 | Functionality of advanced scheduler: 2 | 5 mlfqs-load-1 3 | 5 mlfqs-load-60 4 | 3 mlfqs-load-avg 5 | 6 | 5 mlfqs-recent-1 7 | 8 | 5 mlfqs-fair-2 9 | 3 mlfqs-fair-20 10 | 11 | 4 mlfqs-nice-2 12 | 2 mlfqs-nice-10 13 | 14 | 5 mlfqs-block 15 | -------------------------------------------------------------------------------- /proj1/src/tests/threads/alarm-multiple.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use tests::tests; 3 | use tests::threads::alarm; 4 | check_alarm (7); 5 | -------------------------------------------------------------------------------- /proj1/src/tests/threads/alarm-negative.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (alarm-negative) begin 7 | (alarm-negative) PASS 8 | (alarm-negative) end 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj1/src/tests/threads/alarm-single.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use tests::tests; 3 | use tests::threads::alarm; 4 | check_alarm (1); 5 | -------------------------------------------------------------------------------- /proj1/src/tests/threads/alarm-zero.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (alarm-zero) begin 7 | (alarm-zero) PASS 8 | (alarm-zero) end 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj1/src/tests/threads/mlfqs-fair-2.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::threads::mlfqs; 6 | 7 | check_mlfqs_fair ([0, 0], 50); 8 | -------------------------------------------------------------------------------- /proj1/src/tests/threads/mlfqs-fair-20.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::threads::mlfqs; 6 | 7 | check_mlfqs_fair ([(0) x 20], 20); 8 | -------------------------------------------------------------------------------- /proj1/src/tests/threads/mlfqs-nice-10.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::threads::mlfqs; 6 | 7 | check_mlfqs_fair ([0...9], 25); 8 | -------------------------------------------------------------------------------- /proj1/src/tests/threads/mlfqs-nice-2.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::threads::mlfqs; 6 | 7 | check_mlfqs_fair ([0, 5], 50); 8 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/args-dbl-space.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (args) begin 7 | (args) argc = 3 8 | (args) argv[0] = 'args-dbl-space' 9 | (args) argv[1] = 'two' 10 | (args) argv[2] = 'spaces!' 11 | (args) argv[3] = null 12 | (args) end 13 | args-dbl-space: exit(0) 14 | EOF 15 | pass; 16 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/args-none.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (args) begin 7 | (args) argc = 1 8 | (args) argv[0] = 'args-none' 9 | (args) argv[1] = null 10 | (args) end 11 | args-none: exit(0) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/args-single.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (args) begin 7 | (args) argc = 2 8 | (args) argv[0] = 'args-single' 9 | (args) argv[1] = 'onearg' 10 | (args) argv[2] = null 11 | (args) end 12 | args-single: exit(0) 13 | EOF 14 | pass; 15 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/bad-jump.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (bad-jump) begin 7 | bad-jump: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/bad-jump2.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (bad-jump2) begin 7 | bad-jump2: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/bad-read.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (bad-read) begin 7 | bad-read: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/bad-read2.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (bad-read2) begin 7 | bad-read2: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/bad-write.c: -------------------------------------------------------------------------------- 1 | /* This program attempts to write to memory at an address that is not mapped. 2 | This should terminate the process with a -1 exit code. */ 3 | 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | *(int *)NULL = 42; 11 | fail ("should have exited with -1"); 12 | } 13 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/bad-write.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (bad-write) begin 7 | bad-write: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/bad-write2.c: -------------------------------------------------------------------------------- 1 | /* This program attempts to write to kernel memory. 2 | This should terminate the process with a -1 exit code. */ 3 | 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | *(int *)0xC0000000 = 42; 11 | fail ("should have exited with -1"); 12 | } 13 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/bad-write2.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (bad-write2) begin 7 | bad-write2: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/boundary.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_USERPROG_BOUNDARY_H 2 | #define TESTS_USERPROG_BOUNDARY_H 3 | 4 | void *get_boundary_area (void); 5 | char *copy_string_across_boundary (const char *); 6 | 7 | #endif /* tests/userprog/boundary.h */ 8 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/child-simple.c: -------------------------------------------------------------------------------- 1 | /* Child process run by exec-multiple, exec-one, wait-simple, and 2 | wait-twice tests. 3 | Just prints a single message and terminates. */ 4 | 5 | #include 6 | #include "tests/lib.h" 7 | 8 | const char *test_name = "child-simple"; 9 | 10 | int 11 | main (void) 12 | { 13 | msg ("run"); 14 | return 81; 15 | } 16 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/close-bad-fd.c: -------------------------------------------------------------------------------- 1 | /* Tries to close an invalid fd, which must either fail silently 2 | or terminate with exit code -1. */ 3 | 4 | #include 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | close (0x20101234); 11 | } 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/close-bad-fd.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (close-bad-fd) begin 7 | (close-bad-fd) end 8 | close-bad-fd: exit(0) 9 | EOF 10 | (close-bad-fd) begin 11 | close-bad-fd: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/close-normal.c: -------------------------------------------------------------------------------- 1 | /* Opens a file and then closes it. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | int handle; 11 | CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); 12 | msg ("close \"sample.txt\""); 13 | close (handle); 14 | } 15 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/close-normal.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (close-normal) begin 7 | (close-normal) open "sample.txt" 8 | (close-normal) close "sample.txt" 9 | (close-normal) end 10 | close-normal: exit(0) 11 | EOF 12 | pass; 13 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/close-stdin.c: -------------------------------------------------------------------------------- 1 | /* Tries to close the keyboard input stream, which must either 2 | fail silently or terminate with exit code -1. */ 3 | 4 | #include 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | close (0); 11 | } 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/close-stdin.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (close-stdin) begin 7 | (close-stdin) end 8 | close-stdin: exit(0) 9 | EOF 10 | (close-stdin) begin 11 | close-stdin: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/close-stdout.c: -------------------------------------------------------------------------------- 1 | /* Tries to close the console output stream, which must either 2 | fail silently or terminate with exit code -1. */ 3 | 4 | #include 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | close (1); 11 | } 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/close-stdout.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (close-stdout) begin 7 | (close-stdout) end 8 | close-stdout: exit(0) 9 | EOF 10 | (close-stdout) begin 11 | close-stdout: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/create-bad-ptr.c: -------------------------------------------------------------------------------- 1 | /* Passes a bad pointer to the create system call, 2 | which must cause the process to be terminated with exit code 3 | -1. */ 4 | 5 | #include "tests/lib.h" 6 | #include "tests/main.h" 7 | 8 | void 9 | test_main (void) 10 | { 11 | msg ("create(0x20101234): %d", create ((char *) 0x20101234, 0)); 12 | } 13 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/create-bad-ptr.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (create-bad-ptr) begin 7 | create-bad-ptr: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/create-bound.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (create-bound) begin 7 | (create-bound) create("quux.dat"): 1 8 | (create-bound) end 9 | create-bound: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/create-empty.c: -------------------------------------------------------------------------------- 1 | /* Tries to create a file with the empty string as its name. */ 2 | 3 | #include "tests/lib.h" 4 | #include "tests/main.h" 5 | 6 | void 7 | test_main (void) 8 | { 9 | msg ("create(\"\"): %d", create ("", 0)); 10 | } 11 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/create-empty.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (create-empty) begin 7 | (create-empty) create(""): 0 8 | (create-empty) end 9 | create-empty: exit(0) 10 | EOF 11 | (create-empty) begin 12 | create-empty: exit(-1) 13 | EOF 14 | pass; 15 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/create-long.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (create-long) begin 7 | (create-long) create("x..."): 0 8 | (create-long) end 9 | create-long: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/create-normal.c: -------------------------------------------------------------------------------- 1 | /* Creates an ordinary empty file. */ 2 | 3 | #include "tests/lib.h" 4 | #include "tests/main.h" 5 | 6 | void 7 | test_main (void) 8 | { 9 | CHECK (create ("quux.dat", 0), "create quux.dat"); 10 | } 11 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/create-normal.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (create-normal) begin 7 | (create-normal) create quux.dat 8 | (create-normal) end 9 | create-normal: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/create-null.c: -------------------------------------------------------------------------------- 1 | /* Tries to create a file with the null pointer as its name. 2 | The process must be terminated with exit code -1. */ 3 | 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | msg ("create(NULL): %d", create (NULL, 0)); 11 | } 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/create-null.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (create-null) begin 7 | create-null: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/exec-arg.c: -------------------------------------------------------------------------------- 1 | /* Tests argument passing to child processes. */ 2 | 3 | #include 4 | #include "tests/main.h" 5 | 6 | void 7 | test_main (void) 8 | { 9 | wait (exec ("child-args childarg")); 10 | } 11 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/exec-bad-ptr.c: -------------------------------------------------------------------------------- 1 | /* Passes an invalid pointer to the exec system call. 2 | The process must be terminated with -1 exit code. */ 3 | 4 | #include 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | exec ((char *) 0x20101234); 11 | } 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/exec-bad-ptr.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (exec-bad-ptr) begin 7 | (exec-bad-ptr) end 8 | exec-bad-ptr: exit(0) 9 | EOF 10 | (exec-bad-ptr) begin 11 | exec-bad-ptr: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/exec-missing.c: -------------------------------------------------------------------------------- 1 | /* Tries to execute a nonexistent process. 2 | The exec system call must return -1. */ 3 | 4 | #include 5 | #include "tests/lib.h" 6 | #include "tests/main.h" 7 | 8 | void 9 | test_main (void) 10 | { 11 | msg ("exec(\"no-such-file\"): %d", exec ("no-such-file")); 12 | } 13 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/exec-multiple.c: -------------------------------------------------------------------------------- 1 | /* Executes and waits for multiple child processes. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | wait (exec ("child-simple")); 11 | wait (exec ("child-simple")); 12 | wait (exec ("child-simple")); 13 | wait (exec ("child-simple")); 14 | } 15 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/exec-once.c: -------------------------------------------------------------------------------- 1 | /* Executes and waits for a single child process. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | wait (exec ("child-simple")); 11 | } 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/exec-once.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (exec-once) begin 7 | (child-simple) run 8 | child-simple: exit(81) 9 | (exec-once) end 10 | exec-once: exit(0) 11 | EOF 12 | pass; 13 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/exit.c: -------------------------------------------------------------------------------- 1 | /* Tests the exit system call. */ 2 | 3 | #include "tests/lib.h" 4 | #include "tests/main.h" 5 | 6 | void 7 | test_main (void) 8 | { 9 | exit (57); 10 | fail ("should have called exit(57)"); 11 | } 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/exit.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (exit) begin 7 | exit: exit(57) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/halt.c: -------------------------------------------------------------------------------- 1 | /* Tests the halt system call. */ 2 | 3 | #include "tests/lib.h" 4 | #include "tests/main.h" 5 | 6 | void 7 | test_main (void) 8 | { 9 | halt (); 10 | fail ("should have halted"); 11 | } 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/lib/.gitignore: -------------------------------------------------------------------------------- 1 | *.d 2 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/lib/user/.dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/proj1/src/tests/userprog/lib/user/.dummy -------------------------------------------------------------------------------- /proj1/src/tests/userprog/lib/user/.gitignore: -------------------------------------------------------------------------------- 1 | *.d 2 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/no-vm/Make.tests: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | 3 | tests/userprog/no-vm_TESTS = tests/userprog/no-vm/multi-oom 4 | tests/userprog/no-vm_PROGS = $(tests/userprog/no-vm_TESTS) 5 | tests/userprog/no-vm/multi-oom_SRC = tests/userprog/no-vm/multi-oom.c \ 6 | tests/lib.c 7 | 8 | tests/userprog/no-vm/multi-oom.output: TIMEOUT = 360 9 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/no-vm/Rubric: -------------------------------------------------------------------------------- 1 | Functionality of features that VM might break: 2 | 3 | 1 multi-oom 4 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/no-vm/multi-oom.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (multi-oom) begin 7 | (multi-oom) success. program forked 10 times. 8 | (multi-oom) end 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/null.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | system call! 7 | EOF 8 | pass; 9 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/open-bad-ptr.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (open-bad-ptr) begin 7 | (open-bad-ptr) end 8 | open-bad-ptr: exit(0) 9 | EOF 10 | (open-bad-ptr) begin 11 | open-bad-ptr: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/open-boundary.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (open-boundary) begin 7 | (open-boundary) open "sample.txt" 8 | (open-boundary) end 9 | open-boundary: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/open-empty.c: -------------------------------------------------------------------------------- 1 | /* Tries to open a file with the empty string as its name. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | int handle = open (""); 11 | if (handle != -1) 12 | fail ("open() returned %d instead of -1", handle); 13 | } 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/open-empty.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (open-empty) begin 7 | (open-empty) end 8 | open-empty: exit(0) 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/open-missing.c: -------------------------------------------------------------------------------- 1 | /* Tries to open a nonexistent file. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | int handle = open ("no-such-file"); 11 | if (handle != -1) 12 | fail ("open() returned %d", handle); 13 | } 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/open-missing.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (open-missing) begin 7 | (open-missing) end 8 | open-missing: exit(0) 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/open-normal.c: -------------------------------------------------------------------------------- 1 | /* Open a file. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | int handle = open ("sample.txt"); 11 | if (handle < 2) 12 | fail ("open() returned %d", handle); 13 | } 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/open-normal.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (open-normal) begin 7 | (open-normal) end 8 | open-normal: exit(0) 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/open-null.c: -------------------------------------------------------------------------------- 1 | /* Tries to open a file with the null pointer as its name. 2 | The process must be terminated with exit code -1. */ 3 | 4 | #include 5 | #include 6 | #include "tests/main.h" 7 | 8 | void 9 | test_main (void) 10 | { 11 | open (NULL); 12 | } 13 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/open-null.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (open-null) begin 7 | (open-null) end 8 | open-null: exit(0) 9 | EOF 10 | (open-null) begin 11 | open-null: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/open-twice.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (open-twice) begin 7 | (open-twice) open "sample.txt" once 8 | (open-twice) open "sample.txt" again 9 | (open-twice) end 10 | open-twice: exit(0) 11 | EOF 12 | pass; 13 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/read-bad-fd.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (read-bad-fd) begin 7 | (read-bad-fd) end 8 | read-bad-fd: exit(0) 9 | EOF 10 | (read-bad-fd) begin 11 | read-bad-fd: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/read-boundary.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (read-boundary) begin 7 | (read-boundary) open "sample.txt" 8 | (read-boundary) end 9 | read-boundary: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/read-normal.c: -------------------------------------------------------------------------------- 1 | /* Try reading a file in the most normal way. */ 2 | 3 | #include "tests/userprog/sample.inc" 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | check_file ("sample.txt", sample, sizeof sample - 1); 11 | } 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/read-stdout.c: -------------------------------------------------------------------------------- 1 | /* Try reading from fd 1 (stdout), 2 | which may just fail or terminate the process with -1 exit 3 | code. */ 4 | 5 | #include 6 | #include 7 | #include "tests/main.h" 8 | 9 | void 10 | test_main (void) 11 | { 12 | char buf; 13 | read (STDOUT_FILENO, &buf, 1); 14 | } 15 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/read-stdout.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (read-stdout) begin 7 | (read-stdout) end 8 | read-stdout: exit(0) 9 | EOF 10 | (read-stdout) begin 11 | read-stdout: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/read-zero.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (read-zero) begin 7 | (read-zero) open "sample.txt" 8 | (read-zero) end 9 | read-zero: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/rox-child.c: -------------------------------------------------------------------------------- 1 | /* Ensure that the executable of a running process cannot be 2 | modified, even by a child process. */ 3 | 4 | #define CHILD_CNT "1" 5 | #include "tests/userprog/rox-child.inc" 6 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/rox-multichild.c: -------------------------------------------------------------------------------- 1 | /* Ensure that the executable of a running process cannot be 2 | modified, even in the presence of multiple children. */ 3 | 4 | #define CHILD_CNT "5" 5 | #include "tests/userprog/rox-child.inc" 6 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/rox-simple.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (rox-simple) begin 7 | (rox-simple) open "rox-simple" 8 | (rox-simple) read "rox-simple" 9 | (rox-simple) try to write "rox-simple" 10 | (rox-simple) end 11 | rox-simple: exit(0) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/sample.inc: -------------------------------------------------------------------------------- 1 | char sample[] = { 2 | "\"Amazing Electronic Fact: If you scuffed your feet long enough without\n" 3 | " touching anything, you would build up so many electrons that your\n" 4 | " finger would explode! But this is nothing to worry about unless you\n" 5 | " have carpeting.\" --Dave Barry\n" 6 | }; 7 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/sample.txt: -------------------------------------------------------------------------------- 1 | "Amazing Electronic Fact: If you scuffed your feet long enough without 2 | touching anything, you would build up so many electrons that your 3 | finger would explode! But this is nothing to worry about unless you 4 | have carpeting." --Dave Barry 5 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/sc-bad-arg.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (sc-bad-arg) begin 7 | sc-bad-arg: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/sc-bad-sp.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (sc-bad-sp) begin 7 | sc-bad-sp: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/sc-boundary-2.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (sc-boundary-2) begin 7 | sc-boundary-2: exit(67) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/sc-boundary.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (sc-boundary) begin 7 | sc-boundary: exit(42) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/wait-bad-pid.c: -------------------------------------------------------------------------------- 1 | /* Waits for an invalid pid. This may fail or terminate the 2 | process with -1 exit code. */ 3 | 4 | #include 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | wait ((pid_t) 0x0c020301); 11 | } 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/wait-bad-pid.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (wait-bad-pid) begin 7 | (wait-bad-pid) end 8 | wait-bad-pid: exit(0) 9 | EOF 10 | (wait-bad-pid) begin 11 | wait-bad-pid: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/wait-killed.c: -------------------------------------------------------------------------------- 1 | /* Wait for a process that will be killed for bad behavior. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | msg ("wait(exec()) = %d", wait (exec ("child-bad"))); 11 | } 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/wait-killed.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (wait-killed) begin 7 | (child-bad) begin 8 | child-bad: exit(-1) 9 | (wait-killed) wait(exec()) = -1 10 | (wait-killed) end 11 | wait-killed: exit(0) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/wait-simple.c: -------------------------------------------------------------------------------- 1 | /* Wait for a subprocess to finish. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | msg ("wait(exec()) = %d", wait (exec ("child-simple"))); 11 | } 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/wait-simple.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (wait-simple) begin 7 | (child-simple) run 8 | child-simple: exit(81) 9 | (wait-simple) wait(exec()) = 81 10 | (wait-simple) end 11 | wait-simple: exit(0) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/wait-twice.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (wait-twice) begin 7 | (child-simple) run 8 | child-simple: exit(81) 9 | (wait-twice) wait(exec()) = 81 10 | (wait-twice) wait(exec()) = -1 11 | (wait-twice) end 12 | wait-twice: exit(0) 13 | EOF 14 | pass; 15 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/write-bad-fd.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (write-bad-fd) begin 7 | (write-bad-fd) end 8 | write-bad-fd: exit(0) 9 | EOF 10 | (write-bad-fd) begin 11 | write-bad-fd: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/write-boundary.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (write-boundary) begin 7 | (write-boundary) open "sample.txt" 8 | (write-boundary) end 9 | write-boundary: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/write-normal.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (write-normal) begin 7 | (write-normal) create "test.txt" 8 | (write-normal) open "test.txt" 9 | (write-normal) end 10 | write-normal: exit(0) 11 | EOF 12 | pass; 13 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/write-stdin.c: -------------------------------------------------------------------------------- 1 | /* Try writing to fd 0 (stdin), 2 | which may just fail or terminate the process with -1 exit 3 | code. */ 4 | 5 | #include 6 | #include "tests/lib.h" 7 | #include "tests/main.h" 8 | 9 | void 10 | test_main (void) 11 | { 12 | char buf = 123; 13 | write (0, &buf, 1); 14 | } 15 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/write-stdin.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (write-stdin) begin 7 | (write-stdin) end 8 | write-stdin: exit(0) 9 | EOF 10 | (write-stdin) begin 11 | write-stdin: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj1/src/tests/userprog/write-zero.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (write-zero) begin 7 | (write-zero) open "sample.txt" 8 | (write-zero) end 9 | write-zero: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/mmap-close.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (mmap-close) begin 7 | (mmap-close) open "sample.txt" 8 | (mmap-close) mmap "sample.txt" 9 | (mmap-close) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/mmap-misalign.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (mmap-misalign) begin 7 | (mmap-misalign) open "sample.txt" 8 | (mmap-misalign) try to mmap at misaligned address 9 | (mmap-misalign) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/mmap-null.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (mmap-null) begin 7 | (mmap-null) open "sample.txt" 8 | (mmap-null) try to mmap at address 0 9 | (mmap-null) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/mmap-over-code.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (mmap-over-code) begin 7 | (mmap-over-code) open "sample.txt" 8 | (mmap-over-code) try to mmap over code segment 9 | (mmap-over-code) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/mmap-over-data.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (mmap-over-data) begin 7 | (mmap-over-data) open "sample.txt" 8 | (mmap-over-data) try to mmap over data segment 9 | (mmap-over-data) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/mmap-over-stk.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (mmap-over-stk) begin 7 | (mmap-over-stk) open "sample.txt" 8 | (mmap-over-stk) try to mmap over stack segment 9 | (mmap-over-stk) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/mmap-read.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (mmap-read) begin 7 | (mmap-read) open "sample.txt" 8 | (mmap-read) mmap "sample.txt" 9 | (mmap-read) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/mmap-unmap.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::vm::process_death; 6 | 7 | check_process_death ('mmap-unmap'); 8 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/mmap-zero.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (mmap-zero) begin 7 | (mmap-zero) create empty file "empty" 8 | (mmap-zero) open "empty" 9 | (mmap-zero) mmap "empty" 10 | mmap-zero: exit(-1) 11 | EOF 12 | pass; 13 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/page-merge-mm.c: -------------------------------------------------------------------------------- 1 | #include "tests/main.h" 2 | #include "tests/vm/parallel-merge.h" 3 | 4 | void 5 | test_main (void) 6 | { 7 | parallel_merge ("child-qsort-mm", 80); 8 | } 9 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/page-merge-par.c: -------------------------------------------------------------------------------- 1 | #include "tests/main.h" 2 | #include "tests/vm/parallel-merge.h" 3 | 4 | void 5 | test_main (void) 6 | { 7 | parallel_merge ("child-sort", 123); 8 | } 9 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/page-merge-stk.c: -------------------------------------------------------------------------------- 1 | #include "tests/main.h" 2 | #include "tests/vm/parallel-merge.h" 3 | 4 | void 5 | test_main (void) 6 | { 7 | parallel_merge ("child-qsort", 72); 8 | } 9 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/parallel-merge.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_VM_PARALLEL_MERGE 2 | #define TESTS_VM_PARALLEL_MERGE 1 3 | 4 | void parallel_merge (const char *child_name, int exit_status); 5 | 6 | #endif /* tests/vm/parallel-merge.h */ 7 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/pt-bad-addr.c: -------------------------------------------------------------------------------- 1 | /* Accesses a bad address. 2 | The process must be terminated with -1 exit code. */ 3 | 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | fail ("bad addr read as %d", *(int *) 0x04000000); 11 | } 12 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/pt-bad-addr.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::vm::process_death; 6 | 7 | check_process_death ('pt-bad-addr'); 8 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/pt-bad-read.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (pt-bad-read) begin 7 | (pt-bad-read) open "sample.txt" 8 | pt-bad-read: exit(-1) 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/pt-big-stk-obj.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (pt-big-stk-obj) begin 7 | (pt-big-stk-obj) cksum: 3256410166 8 | (pt-big-stk-obj) end 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/pt-grow-bad.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (pt-grow-bad) begin 7 | pt-grow-bad: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/pt-grow-pusha.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (pt-grow-pusha) begin 7 | (pt-grow-pusha) end 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/pt-grow-stack.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (pt-grow-stack) begin 7 | (pt-grow-stack) cksum: 3424492700 8 | (pt-grow-stack) end 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/pt-write-code.c: -------------------------------------------------------------------------------- 1 | /* Try to write to the code segment. 2 | The process must be terminated with -1 exit code. */ 3 | 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | *(int *) test_main = 0; 11 | fail ("writing the code segment succeeded"); 12 | } 13 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/pt-write-code.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::vm::process_death; 6 | 7 | check_process_death ('pt-write-code'); 8 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/pt-write-code2.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (pt-write-code2) begin 7 | (pt-write-code2) open "sample.txt" 8 | pt-write-code2: exit(-1) 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj1/src/tests/vm/qsort.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_VM_QSORT_H 2 | #define TESTS_VM_QSORT_H 1 3 | 4 | #include 5 | 6 | void qsort_bytes (unsigned char *buf, size_t size); 7 | 8 | #endif /* tests/vm/qsort.h */ 9 | -------------------------------------------------------------------------------- /proj1/src/threads/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | bochsrc.txt 3 | bochsout.txt 4 | -------------------------------------------------------------------------------- /proj1/src/threads/Make.vars: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | 3 | kernel.bin: DEFINES = 4 | KERNEL_SUBDIRS = threads devices lib lib/kernel $(TEST_SUBDIRS) 5 | TEST_SUBDIRS = tests/threads 6 | GRADING_FILE = $(SRCDIR)/tests/threads/Grading 7 | SIMULATOR = --bochs 8 | -------------------------------------------------------------------------------- /proj1/src/threads/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.kernel 2 | -------------------------------------------------------------------------------- /proj1/src/threads/flags.h: -------------------------------------------------------------------------------- 1 | #ifndef THREADS_FLAGS_H 2 | #define THREADS_FLAGS_H 3 | 4 | /* EFLAGS Register. */ 5 | #define FLAG_MBS 0x00000002 /* Must be set. */ 6 | #define FLAG_IF 0x00000200 /* Interrupt Flag. */ 7 | 8 | #endif /* threads/flags.h */ 9 | -------------------------------------------------------------------------------- /proj1/src/threads/init.h: -------------------------------------------------------------------------------- 1 | #ifndef THREADS_INIT_H 2 | #define THREADS_INIT_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | /* Page directory with kernel mappings only. */ 10 | extern uint32_t *init_page_dir; 11 | 12 | #endif /* threads/init.h */ 13 | -------------------------------------------------------------------------------- /proj1/src/userprog/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | bochsrc.txt 3 | bochsout.txt 4 | -------------------------------------------------------------------------------- /proj1/src/userprog/Make.vars: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | 3 | kernel.bin: DEFINES = -DUSERPROG -DFILESYS 4 | KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys 5 | TEST_SUBDIRS = tests/userprog tests/userprog/no-vm tests/filesys/base 6 | GRADING_FILE = $(SRCDIR)/tests/userprog/Grading 7 | SIMULATOR = --qemu 8 | -------------------------------------------------------------------------------- /proj1/src/userprog/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.kernel 2 | -------------------------------------------------------------------------------- /proj1/src/userprog/process.h: -------------------------------------------------------------------------------- 1 | #ifndef USERPROG_PROCESS_H 2 | #define USERPROG_PROCESS_H 3 | 4 | #include "threads/thread.h" 5 | 6 | tid_t process_execute (const char *file_name); 7 | int process_wait (tid_t); 8 | void process_exit (void); 9 | void process_activate (void); 10 | 11 | #endif /* userprog/process.h */ 12 | -------------------------------------------------------------------------------- /proj1/src/userprog/syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef USERPROG_SYSCALL_H 2 | #define USERPROG_SYSCALL_H 3 | 4 | void syscall_init (void); 5 | 6 | #endif /* userprog/syscall.h */ 7 | -------------------------------------------------------------------------------- /proj1/src/userprog/tss.h: -------------------------------------------------------------------------------- 1 | #ifndef USERPROG_TSS_H 2 | #define USERPROG_TSS_H 3 | 4 | #include 5 | 6 | struct tss; 7 | void tss_init (void); 8 | struct tss *tss_get (void); 9 | void tss_update (void); 10 | 11 | #endif /* userprog/tss.h */ 12 | -------------------------------------------------------------------------------- /proj1/src/utils/.gitignore: -------------------------------------------------------------------------------- 1 | setitimer-helper 2 | squish-pty 3 | squish-unix 4 | -------------------------------------------------------------------------------- /proj1/src/utils/Makefile: -------------------------------------------------------------------------------- 1 | all: setitimer-helper squish-pty squish-unix 2 | 3 | CC = gcc 4 | CFLAGS = -Wall -W 5 | LOADLIBES = -lm 6 | setitimer-helper: setitimer-helper.o 7 | squish-pty: squish-pty.o 8 | squish-unix: squish-unix.o 9 | 10 | clean: 11 | rm -f *.o setitimer-helper squish-pty squish-unix 12 | -------------------------------------------------------------------------------- /proj1/src/vm/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | bochsrc.txt 3 | bochsout.txt 4 | -------------------------------------------------------------------------------- /proj1/src/vm/Make.vars: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | 3 | kernel.bin: DEFINES = -DUSERPROG -DFILESYS -DVM 4 | KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys vm 5 | TEST_SUBDIRS = tests/userprog tests/vm tests/filesys/base 6 | GRADING_FILE = $(SRCDIR)/tests/vm/Grading 7 | SIMULATOR = --qemu 8 | -------------------------------------------------------------------------------- /proj1/src/vm/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.kernel 2 | -------------------------------------------------------------------------------- /proj2/p1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/proj2/p1.png -------------------------------------------------------------------------------- /proj2/p2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/proj2/p2.png -------------------------------------------------------------------------------- /proj2/src/.gitignore: -------------------------------------------------------------------------------- 1 | cscope.files 2 | cscope.out 3 | TAGS 4 | tags 5 | -------------------------------------------------------------------------------- /proj2/src/devices/ide.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_IDE_H 2 | #define DEVICES_IDE_H 3 | 4 | void ide_init (void); 5 | 6 | #endif /* devices/ide.h */ 7 | -------------------------------------------------------------------------------- /proj2/src/devices/input.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_INPUT_H 2 | #define DEVICES_INPUT_H 3 | 4 | #include 5 | #include 6 | 7 | void input_init (void); 8 | void input_putc (uint8_t); 9 | uint8_t input_getc (void); 10 | bool input_full (void); 11 | 12 | #endif /* devices/input.h */ 13 | -------------------------------------------------------------------------------- /proj2/src/devices/kbd.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_KBD_H 2 | #define DEVICES_KBD_H 3 | 4 | #include 5 | 6 | void kbd_init (void); 7 | void kbd_print_stats (void); 8 | 9 | #endif /* devices/kbd.h */ 10 | -------------------------------------------------------------------------------- /proj2/src/devices/partition.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_PARTITION_H 2 | #define DEVICES_PARTITION_H 3 | 4 | struct block; 5 | 6 | void partition_scan (struct block *); 7 | 8 | #endif /* devices/partition.h */ 9 | -------------------------------------------------------------------------------- /proj2/src/devices/pit.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_PIT_H 2 | #define DEVICES_PIT_H 3 | 4 | #include 5 | 6 | void pit_configure_channel (int channel, int mode, int frequency); 7 | 8 | #endif /* devices/pit.h */ 9 | -------------------------------------------------------------------------------- /proj2/src/devices/rtc.h: -------------------------------------------------------------------------------- 1 | #ifndef RTC_H 2 | #define RTC_H 3 | 4 | typedef unsigned long time_t; 5 | 6 | time_t rtc_get_time (void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /proj2/src/devices/serial.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_SERIAL_H 2 | #define DEVICES_SERIAL_H 3 | 4 | #include 5 | 6 | void serial_init_queue (void); 7 | void serial_putc (uint8_t); 8 | void serial_flush (void); 9 | void serial_notify (void); 10 | 11 | #endif /* devices/serial.h */ 12 | -------------------------------------------------------------------------------- /proj2/src/devices/speaker.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_SPEAKER_H 2 | #define DEVICES_SPEAKER_H 3 | 4 | void speaker_on (int frequency); 5 | void speaker_off (void); 6 | void speaker_beep (void); 7 | 8 | #endif /* devices/speaker.h */ 9 | -------------------------------------------------------------------------------- /proj2/src/devices/vga.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICES_VGA_H 2 | #define DEVICES_VGA_H 3 | 4 | void vga_putc (int); 5 | 6 | #endif /* devices/vga.h */ 7 | -------------------------------------------------------------------------------- /proj2/src/examples/.gitignore: -------------------------------------------------------------------------------- 1 | cat 2 | cmp 3 | cp 4 | echo 5 | halt 6 | hex-dump 7 | ls 8 | mcat 9 | mcp 10 | mkdir 11 | pwd 12 | rm 13 | shell 14 | bubsort 15 | insult 16 | lineup 17 | matmult 18 | recursor 19 | *.d 20 | -------------------------------------------------------------------------------- /proj2/src/examples/echo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int 5 | main (int argc, char **argv) 6 | { 7 | int i; 8 | 9 | for (i = 0; i < argc; i++) 10 | printf ("%s ", argv[i]); 11 | printf ("\n"); 12 | 13 | return EXIT_SUCCESS; 14 | } 15 | -------------------------------------------------------------------------------- /proj2/src/examples/halt.c: -------------------------------------------------------------------------------- 1 | /* halt.c 2 | 3 | Simple program to test whether running a user program works. 4 | 5 | Just invokes a system call that shuts down the OS. */ 6 | 7 | #include 8 | 9 | int 10 | main (void) 11 | { 12 | halt (); 13 | /* not reached */ 14 | } 15 | -------------------------------------------------------------------------------- /proj2/src/examples/lib/.gitignore: -------------------------------------------------------------------------------- 1 | *.d 2 | -------------------------------------------------------------------------------- /proj2/src/examples/lib/user/.dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/proj2/src/examples/lib/user/.dummy -------------------------------------------------------------------------------- /proj2/src/examples/lib/user/.gitignore: -------------------------------------------------------------------------------- 1 | *.d 2 | -------------------------------------------------------------------------------- /proj2/src/filesys/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | bochsrc.txt 3 | bochsout.txt 4 | -------------------------------------------------------------------------------- /proj2/src/filesys/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.kernel 2 | -------------------------------------------------------------------------------- /proj2/src/filesys/fsutil.h: -------------------------------------------------------------------------------- 1 | #ifndef FILESYS_FSUTIL_H 2 | #define FILESYS_FSUTIL_H 3 | 4 | void fsutil_ls (char **argv); 5 | void fsutil_cat (char **argv); 6 | void fsutil_rm (char **argv); 7 | void fsutil_extract (char **argv); 8 | void fsutil_append (char **argv); 9 | 10 | #endif /* filesys/fsutil.h */ 11 | -------------------------------------------------------------------------------- /proj2/src/lib/kernel/console.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIB_KERNEL_CONSOLE_H 2 | #define __LIB_KERNEL_CONSOLE_H 3 | 4 | void console_init (void); 5 | void console_panic (void); 6 | void console_print_stats (void); 7 | 8 | #endif /* lib/kernel/console.h */ 9 | -------------------------------------------------------------------------------- /proj2/src/lib/kernel/stdio.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIB_KERNEL_STDIO_H 2 | #define __LIB_KERNEL_STDIO_H 3 | 4 | void putbuf (const char *, size_t); 5 | 6 | #endif /* lib/kernel/stdio.h */ 7 | -------------------------------------------------------------------------------- /proj2/src/lib/random.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIB_RANDOM_H 2 | #define __LIB_RANDOM_H 3 | 4 | #include 5 | 6 | void random_init (unsigned seed); 7 | void random_bytes (void *, size_t); 8 | unsigned long random_ulong (void); 9 | 10 | #endif /* lib/random.h */ 11 | -------------------------------------------------------------------------------- /proj2/src/lib/stdbool.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIB_STDBOOL_H 2 | #define __LIB_STDBOOL_H 3 | 4 | #define bool _Bool 5 | #define true 1 6 | #define false 0 7 | #define __bool_true_false_are_defined 1 8 | 9 | #endif /* lib/stdbool.h */ 10 | -------------------------------------------------------------------------------- /proj2/src/lib/user/entry.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (int, char *[]); 4 | void _start (int argc, char *argv[]); 5 | 6 | void 7 | _start (int argc, char *argv[]) 8 | { 9 | exit (main (argc, argv)); 10 | } 11 | -------------------------------------------------------------------------------- /proj2/src/lib/user/stdio.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIB_USER_STDIO_H 2 | #define __LIB_USER_STDIO_H 3 | 4 | int hprintf (int, const char *, ...) PRINTF_FORMAT (2, 3); 5 | int vhprintf (int, const char *, va_list) PRINTF_FORMAT (2, 0); 6 | 7 | #endif /* lib/user/stdio.h */ 8 | -------------------------------------------------------------------------------- /proj2/src/misc/bochs-2.2.6-namespace.patch: -------------------------------------------------------------------------------- 1 | --- bochs-2.2.6/bx_debug/symbols.cc 2011-08-19 11:04:11.760139836 -0600 2 | +++ bochs-2.2.6-patched/bx_debug/symbols.cc 2011-08-19 11:04:04.980139837 -0600 3 | @@ -92,6 +92,7 @@ 4 | #endif 5 | 6 | using namespace std; 7 | +namespace std { using namespace __gnu_cxx; } 8 | 9 | struct symbol_entry_t 10 | { 11 | -------------------------------------------------------------------------------- /proj2/src/tests/cksum.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_CKSUM_H 2 | #define TESTS_CKSUM_H 3 | 4 | #include 5 | 6 | unsigned long cksum(const void *, size_t); 7 | 8 | #endif /* tests/cksum.h */ 9 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/base/lg-create.c: -------------------------------------------------------------------------------- 1 | /* Tests that create properly zeros out the contents of a fairly 2 | large file. */ 3 | 4 | #define TEST_SIZE 75678 5 | #include "tests/filesys/create.inc" 6 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/base/lg-full.c: -------------------------------------------------------------------------------- 1 | /* Writes out the contents of a fairly large file all at once, 2 | and then reads it back to make sure that it was written 3 | properly. */ 4 | 5 | #define TEST_SIZE 75678 6 | #include "tests/filesys/base/full.inc" 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/base/lg-random.c: -------------------------------------------------------------------------------- 1 | /* Writes out the content of a fairly large file in random order, 2 | then reads it back in random order to verify that it was 3 | written properly. */ 4 | 5 | #define BLOCK_SIZE 512 6 | #define TEST_SIZE (512 * 150) 7 | #include "tests/filesys/base/random.inc" 8 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/base/lg-seq-block.c: -------------------------------------------------------------------------------- 1 | /* Writes out a fairly large file sequentially, one fixed-size 2 | block at a time, then reads it back to verify that it was 3 | written properly. */ 4 | 5 | #define TEST_SIZE 75678 6 | #define BLOCK_SIZE 513 7 | #include "tests/filesys/base/seq-block.inc" 8 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/base/lg-seq-random.c: -------------------------------------------------------------------------------- 1 | /* Writes out a fairly large file sequentially, one random-sized 2 | block at a time, then reads it back to verify that it was 3 | written properly. */ 4 | 5 | #define TEST_SIZE 75678 6 | #include "tests/filesys/base/seq-random.inc" 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/base/sm-create.c: -------------------------------------------------------------------------------- 1 | /* Tests that create properly zeros out the contents of a fairly 2 | small file. */ 3 | 4 | #define TEST_SIZE 5678 5 | #include "tests/filesys/create.inc" 6 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/base/sm-full.c: -------------------------------------------------------------------------------- 1 | /* Writes out the contents of a fairly small file all at once, 2 | and then reads it back to make sure that it was written 3 | properly. */ 4 | 5 | #define TEST_SIZE 5678 6 | #include "tests/filesys/base/full.inc" 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/base/sm-random.c: -------------------------------------------------------------------------------- 1 | /* Writes out the content of a fairly small file in random order, 2 | then reads it back in random order to verify that it was 3 | written properly. */ 4 | 5 | #define BLOCK_SIZE 13 6 | #define TEST_SIZE (13 * 123) 7 | #include "tests/filesys/base/random.inc" 8 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/base/sm-seq-block.c: -------------------------------------------------------------------------------- 1 | /* Writes out a fairly small file sequentially, one fixed-size 2 | block at a time, then reads it back to verify that it was 3 | written properly. */ 4 | 5 | #define TEST_SIZE 5678 6 | #define BLOCK_SIZE 513 7 | #include "tests/filesys/base/seq-block.inc" 8 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/base/sm-seq-random.c: -------------------------------------------------------------------------------- 1 | /* Writes out a fairly large file sequentially, one random-sized 2 | block at a time, then reads it back to verify that it was 3 | written properly. */ 4 | 5 | #define TEST_SIZE 5678 6 | #include "tests/filesys/base/seq-random.inc" 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/base/syn-read.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_FILESYS_BASE_SYN_READ_H 2 | #define TESTS_FILESYS_BASE_SYN_READ_H 3 | 4 | #define BUF_SIZE 1024 5 | static const char file_name[] = "data"; 6 | 7 | #endif /* tests/filesys/base/syn-read.h */ 8 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/base/syn-write.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_FILESYS_BASE_SYN_WRITE_H 2 | #define TESTS_FILESYS_BASE_SYN_WRITE_H 3 | 4 | #define CHILD_CNT 10 5 | #define CHUNK_SIZE 512 6 | #define BUF_SIZE (CHILD_CNT * CHUNK_SIZE) 7 | static const char file_name[] = "stuff"; 8 | 9 | #endif /* tests/filesys/base/syn-write.h */ 10 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/Rubric.robustness: -------------------------------------------------------------------------------- 1 | Robustness of file system: 2 | 1 dir-empty-name 3 | 1 dir-open 4 | 1 dir-over-file 5 | 1 dir-under-file 6 | 7 | 3 dir-rm-cwd 8 | 2 dir-rm-parent 9 | 1 dir-rm-root 10 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-empty-name-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-empty-name.c: -------------------------------------------------------------------------------- 1 | /* Tries to create a directory named as the empty string, 2 | which must return failure. */ 3 | 4 | #include 5 | #include "tests/lib.h" 6 | #include "tests/main.h" 7 | 8 | void 9 | test_main (void) 10 | { 11 | CHECK (!mkdir (""), "mkdir \"\" (must return false)"); 12 | } 13 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-empty-name.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-empty-name) begin 7 | (dir-empty-name) mkdir "" (must return false) 8 | (dir-empty-name) end 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-mk-tree-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | my ($tree); 6 | for my $a (0...3) { 7 | for my $b (0...2) { 8 | for my $c (0...2) { 9 | for my $d (0...3) { 10 | $tree->{$a}{$b}{$c}{$d} = ['']; 11 | } 12 | } 13 | } 14 | } 15 | check_archive ($tree); 16 | pass; 17 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-mk-tree.c: -------------------------------------------------------------------------------- 1 | /* Creates directories /0/0/0 through /3/2/2 and creates files in 2 | the leaf directories. */ 3 | 4 | #include "tests/filesys/extended/mk-tree.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | make_tree (4, 3, 3, 4); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-mk-tree.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-mk-tree) begin 7 | (dir-mk-tree) creating /0/0/0/0 through /3/2/2/3... 8 | (dir-mk-tree) open "/0/2/0/3" 9 | (dir-mk-tree) close "/0/2/0/3" 10 | (dir-mk-tree) end 11 | EOF 12 | pass; 13 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-mkdir-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({'a' => {'b' => ["\0" x 512]}}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-mkdir.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-mkdir) begin 7 | (dir-mkdir) mkdir "a" 8 | (dir-mkdir) create "a/b" 9 | (dir-mkdir) chdir "a" 10 | (dir-mkdir) open "b" 11 | (dir-mkdir) end 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-open-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({"xyzzy" => {}}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-over-file-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({"abc" => {}}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-over-file.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-over-file) begin 7 | (dir-over-file) mkdir "abc" 8 | (dir-over-file) create "abc" (must return false) 9 | (dir-over-file) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-rm-cwd-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | my ($cwd_removable) = read_text_file ("tests/filesys/extended/can-rmdir-cwd"); 6 | $cwd_removable eq 'YES' || $cwd_removable eq 'NO' or die; 7 | check_archive ($cwd_removable eq 'YES' ? {} : {"a" => {}}); 8 | pass; 9 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-rm-parent-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({"a" => {"b" => {}}}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-rm-root-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({"a" => ["\0" x 243]}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-rm-root.c: -------------------------------------------------------------------------------- 1 | /* Try to remove the root directory. 2 | This must fail. */ 3 | 4 | #include 5 | #include "tests/lib.h" 6 | #include "tests/main.h" 7 | 8 | void 9 | test_main (void) 10 | { 11 | CHECK (!remove ("/"), "remove \"/\" (must fail)"); 12 | CHECK (create ("/a", 243), "create \"/a\""); 13 | } 14 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-rm-root.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-rm-root) begin 7 | (dir-rm-root) remove "/" (must fail) 8 | (dir-rm-root) create "/a" 9 | (dir-rm-root) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-rm-tree-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-rmdir-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-rmdir.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-rmdir) begin 7 | (dir-rmdir) mkdir "a" 8 | (dir-rmdir) rmdir "a" 9 | (dir-rmdir) chdir "a" (must return false) 10 | (dir-rmdir) end 11 | EOF 12 | pass; 13 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-under-file-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({"abc" => ['']}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-under-file.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-under-file) begin 7 | (dir-under-file) create "abc" 8 | (dir-under-file) mkdir "abc" (must return false) 9 | (dir-under-file) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/dir-vine.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (dir-vine) begin 7 | (dir-vine) creating many levels of files and directories... 8 | (dir-vine) removing all but top 10 levels of files and directories... 9 | (dir-vine) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-create-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({"blargle" => ['']}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-create.c: -------------------------------------------------------------------------------- 1 | /* Create a file of size 0. */ 2 | 3 | #define TEST_SIZE 0 4 | #include "tests/filesys/create.inc" 5 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-dir-lg-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | my ($fs); 7 | $fs->{'x'}{"file$_"} = [random_bytes (512)] foreach 0...49; 8 | check_archive ($fs); 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-dir-lg.c: -------------------------------------------------------------------------------- 1 | /* Creates a directory, 2 | then creates 50 files in that directory. */ 3 | 4 | #define FILE_CNT 50 5 | #define DIRECTORY "/x" 6 | #include "tests/filesys/extended/grow-dir.inc" 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-file-size-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | check_archive ({"testfile" => [random_bytes (2134)]}); 7 | pass; 8 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-root-lg-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | my ($fs); 7 | $fs->{"file$_"} = [random_bytes (512)] foreach 0...49; 8 | check_archive ($fs); 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-root-lg.c: -------------------------------------------------------------------------------- 1 | /* Creates 50 files in the root directory. */ 2 | 3 | #define FILE_CNT 50 4 | #include "tests/filesys/extended/grow-dir.inc" 5 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-root-sm-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | my ($fs); 7 | $fs->{"file$_"} = [random_bytes (512)] foreach 0...19; 8 | check_archive ($fs); 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-root-sm.c: -------------------------------------------------------------------------------- 1 | /* Creates 20 files in the root directory. */ 2 | 3 | #define FILE_CNT 20 4 | #include "tests/filesys/extended/grow-dir.inc" 5 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-seq-lg-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | check_archive ({"testme" => [random_bytes (72943)]}); 7 | pass; 8 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-seq-lg.c: -------------------------------------------------------------------------------- 1 | /* Grows a file from 0 bytes to 72,943 bytes, 1,234 bytes at a 2 | time. */ 3 | 4 | #define TEST_SIZE 72943 5 | #include "tests/filesys/extended/grow-seq.inc" 6 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-seq-sm-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | check_archive ({"testme" => [random_bytes (5678)]}); 7 | pass; 8 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-seq-sm.c: -------------------------------------------------------------------------------- 1 | /* Grows a file from 0 bytes to 5,678 bytes, 1,234 bytes at a 2 | time. */ 3 | 4 | #define TEST_SIZE 5678 5 | #include "tests/filesys/extended/grow-seq.inc" 6 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-sparse-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_archive ({"testfile" => ["\0" x 76543]}); 6 | pass; 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-tell-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | check_archive ({"foobar" => [random_bytes (2134)]}); 7 | pass; 8 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/grow-two-files-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | my ($a) = random_bytes (8143); 7 | my ($b) = random_bytes (8143); 8 | check_archive ({"a" => [$a], "b" => [$b]}); 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/mk-tree.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_FILESYS_EXTENDED_MK_TREE_H 2 | #define TESTS_FILESYS_EXTENDED_MK_TREE_H 3 | 4 | void make_tree (int at, int bt, int ct, int dt); 5 | 6 | #endif /* tests/filesys/extended/mk-tree.h */ 7 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/syn-rw-persistence.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::random; 6 | check_archive ({"child-syn-rw" => "tests/filesys/extended/child-syn-rw", 7 | "logfile" => [random_bytes (8 * 512)]}); 8 | pass; 9 | -------------------------------------------------------------------------------- /proj2/src/tests/filesys/extended/syn-rw.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_FILESYS_EXTENDED_SYN_RW_H 2 | #define TESTS_FILESYS_EXTENDED_SYN_RW_H 3 | 4 | #define CHUNK_SIZE 8 5 | #define CHUNK_CNT 512 6 | #define BUF_SIZE (CHUNK_SIZE * CHUNK_CNT) 7 | static const char file_name[] = "logfile"; 8 | 9 | #endif /* tests/filesys/extended/syn-rw.h */ 10 | -------------------------------------------------------------------------------- /proj2/src/tests/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "tests/lib.h" 3 | #include "tests/main.h" 4 | 5 | int 6 | main (int argc UNUSED, char *argv[]) 7 | { 8 | test_name = argv[0]; 9 | 10 | msg ("begin"); 11 | random_init (0); 12 | test_main (); 13 | msg ("end"); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /proj2/src/tests/main.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_MAIN_H 2 | #define TESTS_MAIN_H 3 | 4 | void test_main (void); 5 | 6 | #endif /* tests/main.h */ 7 | -------------------------------------------------------------------------------- /proj2/src/tests/threads/Grading: -------------------------------------------------------------------------------- 1 | # Percentage of the testing point total designated for each set of 2 | # tests. 3 | 4 | 20.0% tests/threads/Rubric.alarm 5 | 40.0% tests/threads/Rubric.priority 6 | 40.0% tests/threads/Rubric.mlfqs 7 | -------------------------------------------------------------------------------- /proj2/src/tests/threads/Rubric.alarm: -------------------------------------------------------------------------------- 1 | Functionality and robustness of alarm clock: 2 | 4 alarm-single 3 | 4 alarm-multiple 4 | 4 alarm-simultaneous 5 | 4 alarm-priority 6 | 7 | 1 alarm-zero 8 | 1 alarm-negative 9 | -------------------------------------------------------------------------------- /proj2/src/tests/threads/Rubric.mlfqs: -------------------------------------------------------------------------------- 1 | Functionality of advanced scheduler: 2 | 5 mlfqs-load-1 3 | 5 mlfqs-load-60 4 | 3 mlfqs-load-avg 5 | 6 | 5 mlfqs-recent-1 7 | 8 | 5 mlfqs-fair-2 9 | 3 mlfqs-fair-20 10 | 11 | 4 mlfqs-nice-2 12 | 2 mlfqs-nice-10 13 | 14 | 5 mlfqs-block 15 | -------------------------------------------------------------------------------- /proj2/src/tests/threads/alarm-multiple.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use tests::tests; 3 | use tests::threads::alarm; 4 | check_alarm (7); 5 | -------------------------------------------------------------------------------- /proj2/src/tests/threads/alarm-negative.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (alarm-negative) begin 7 | (alarm-negative) PASS 8 | (alarm-negative) end 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj2/src/tests/threads/alarm-single.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use tests::tests; 3 | use tests::threads::alarm; 4 | check_alarm (1); 5 | -------------------------------------------------------------------------------- /proj2/src/tests/threads/alarm-zero.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (alarm-zero) begin 7 | (alarm-zero) PASS 8 | (alarm-zero) end 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj2/src/tests/threads/mlfqs-fair-2.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::threads::mlfqs; 6 | 7 | check_mlfqs_fair ([0, 0], 50); 8 | -------------------------------------------------------------------------------- /proj2/src/tests/threads/mlfqs-fair-20.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::threads::mlfqs; 6 | 7 | check_mlfqs_fair ([(0) x 20], 20); 8 | -------------------------------------------------------------------------------- /proj2/src/tests/threads/mlfqs-nice-10.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::threads::mlfqs; 6 | 7 | check_mlfqs_fair ([0...9], 25); 8 | -------------------------------------------------------------------------------- /proj2/src/tests/threads/mlfqs-nice-2.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::threads::mlfqs; 6 | 7 | check_mlfqs_fair ([0, 5], 50); 8 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/args-dbl-space.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (args) begin 7 | (args) argc = 3 8 | (args) argv[0] = 'args-dbl-space' 9 | (args) argv[1] = 'two' 10 | (args) argv[2] = 'spaces!' 11 | (args) argv[3] = null 12 | (args) end 13 | args-dbl-space: exit(0) 14 | EOF 15 | pass; 16 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/args-none.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (args) begin 7 | (args) argc = 1 8 | (args) argv[0] = 'args-none' 9 | (args) argv[1] = null 10 | (args) end 11 | args-none: exit(0) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/args-single.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (args) begin 7 | (args) argc = 2 8 | (args) argv[0] = 'args-single' 9 | (args) argv[1] = 'onearg' 10 | (args) argv[2] = null 11 | (args) end 12 | args-single: exit(0) 13 | EOF 14 | pass; 15 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/bad-jump.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (bad-jump) begin 7 | bad-jump: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/bad-jump2.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (bad-jump2) begin 7 | bad-jump2: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/bad-read.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (bad-read) begin 7 | bad-read: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/bad-read2.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (bad-read2) begin 7 | bad-read2: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/bad-write.c: -------------------------------------------------------------------------------- 1 | /* This program attempts to write to memory at an address that is not mapped. 2 | This should terminate the process with a -1 exit code. */ 3 | 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | *(int *)NULL = 42; 11 | fail ("should have exited with -1"); 12 | } 13 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/bad-write.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (bad-write) begin 7 | bad-write: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/bad-write2.c: -------------------------------------------------------------------------------- 1 | /* This program attempts to write to kernel memory. 2 | This should terminate the process with a -1 exit code. */ 3 | 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | *(int *)0xC0000000 = 42; 11 | fail ("should have exited with -1"); 12 | } 13 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/bad-write2.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (bad-write2) begin 7 | bad-write2: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/boundary.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_USERPROG_BOUNDARY_H 2 | #define TESTS_USERPROG_BOUNDARY_H 3 | 4 | void *get_boundary_area (void); 5 | char *copy_string_across_boundary (const char *); 6 | 7 | #endif /* tests/userprog/boundary.h */ 8 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/child-simple.c: -------------------------------------------------------------------------------- 1 | /* Child process run by exec-multiple, exec-one, wait-simple, and 2 | wait-twice tests. 3 | Just prints a single message and terminates. */ 4 | 5 | #include 6 | #include "tests/lib.h" 7 | 8 | const char *test_name = "child-simple"; 9 | 10 | int 11 | main (void) 12 | { 13 | msg ("run"); 14 | return 81; 15 | } 16 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/close-bad-fd.c: -------------------------------------------------------------------------------- 1 | /* Tries to close an invalid fd, which must either fail silently 2 | or terminate with exit code -1. */ 3 | 4 | #include 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | close (0x20101234); 11 | } 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/close-bad-fd.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (close-bad-fd) begin 7 | (close-bad-fd) end 8 | close-bad-fd: exit(0) 9 | EOF 10 | (close-bad-fd) begin 11 | close-bad-fd: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/close-normal.c: -------------------------------------------------------------------------------- 1 | /* Opens a file and then closes it. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | int handle; 11 | CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); 12 | msg ("close \"sample.txt\""); 13 | close (handle); 14 | } 15 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/close-normal.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (close-normal) begin 7 | (close-normal) open "sample.txt" 8 | (close-normal) close "sample.txt" 9 | (close-normal) end 10 | close-normal: exit(0) 11 | EOF 12 | pass; 13 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/close-stdin.c: -------------------------------------------------------------------------------- 1 | /* Tries to close the keyboard input stream, which must either 2 | fail silently or terminate with exit code -1. */ 3 | 4 | #include 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | close (0); 11 | } 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/close-stdin.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (close-stdin) begin 7 | (close-stdin) end 8 | close-stdin: exit(0) 9 | EOF 10 | (close-stdin) begin 11 | close-stdin: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/close-stdout.c: -------------------------------------------------------------------------------- 1 | /* Tries to close the console output stream, which must either 2 | fail silently or terminate with exit code -1. */ 3 | 4 | #include 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | close (1); 11 | } 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/close-stdout.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (close-stdout) begin 7 | (close-stdout) end 8 | close-stdout: exit(0) 9 | EOF 10 | (close-stdout) begin 11 | close-stdout: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/create-bad-ptr.c: -------------------------------------------------------------------------------- 1 | /* Passes a bad pointer to the create system call, 2 | which must cause the process to be terminated with exit code 3 | -1. */ 4 | 5 | #include "tests/lib.h" 6 | #include "tests/main.h" 7 | 8 | void 9 | test_main (void) 10 | { 11 | msg ("create(0x20101234): %d", create ((char *) 0x20101234, 0)); 12 | } 13 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/create-bad-ptr.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (create-bad-ptr) begin 7 | create-bad-ptr: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/create-bound.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (create-bound) begin 7 | (create-bound) create("quux.dat"): 1 8 | (create-bound) end 9 | create-bound: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/create-empty.c: -------------------------------------------------------------------------------- 1 | /* Tries to create a file with the empty string as its name. */ 2 | 3 | #include "tests/lib.h" 4 | #include "tests/main.h" 5 | 6 | void 7 | test_main (void) 8 | { 9 | msg ("create(\"\"): %d", create ("", 0)); 10 | } 11 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/create-empty.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (create-empty) begin 7 | (create-empty) create(""): 0 8 | (create-empty) end 9 | create-empty: exit(0) 10 | EOF 11 | (create-empty) begin 12 | create-empty: exit(-1) 13 | EOF 14 | pass; 15 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/create-long.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (create-long) begin 7 | (create-long) create("x..."): 0 8 | (create-long) end 9 | create-long: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/create-normal.c: -------------------------------------------------------------------------------- 1 | /* Creates an ordinary empty file. */ 2 | 3 | #include "tests/lib.h" 4 | #include "tests/main.h" 5 | 6 | void 7 | test_main (void) 8 | { 9 | CHECK (create ("quux.dat", 0), "create quux.dat"); 10 | } 11 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/create-normal.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (create-normal) begin 7 | (create-normal) create quux.dat 8 | (create-normal) end 9 | create-normal: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/create-null.c: -------------------------------------------------------------------------------- 1 | /* Tries to create a file with the null pointer as its name. 2 | The process must be terminated with exit code -1. */ 3 | 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | msg ("create(NULL): %d", create (NULL, 0)); 11 | } 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/create-null.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (create-null) begin 7 | create-null: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/exec-arg.c: -------------------------------------------------------------------------------- 1 | /* Tests argument passing to child processes. */ 2 | 3 | #include 4 | #include "tests/main.h" 5 | 6 | void 7 | test_main (void) 8 | { 9 | wait (exec ("child-args childarg")); 10 | } 11 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/exec-bad-ptr.c: -------------------------------------------------------------------------------- 1 | /* Passes an invalid pointer to the exec system call. 2 | The process must be terminated with -1 exit code. */ 3 | 4 | #include 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | exec ((char *) 0x20101234); 11 | } 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/exec-bad-ptr.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (exec-bad-ptr) begin 7 | (exec-bad-ptr) end 8 | exec-bad-ptr: exit(0) 9 | EOF 10 | (exec-bad-ptr) begin 11 | exec-bad-ptr: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/exec-missing.c: -------------------------------------------------------------------------------- 1 | /* Tries to execute a nonexistent process. 2 | The exec system call must return -1. */ 3 | 4 | #include 5 | #include "tests/lib.h" 6 | #include "tests/main.h" 7 | 8 | void 9 | test_main (void) 10 | { 11 | msg ("exec(\"no-such-file\"): %d", exec ("no-such-file")); 12 | } 13 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/exec-once.c: -------------------------------------------------------------------------------- 1 | /* Executes and waits for a single child process. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | wait (exec ("child-simple")); 11 | } 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/exec-once.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (exec-once) begin 7 | (child-simple) run 8 | child-simple: exit(81) 9 | (exec-once) end 10 | exec-once: exit(0) 11 | EOF 12 | pass; 13 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/exit.c: -------------------------------------------------------------------------------- 1 | /* Tests the exit system call. */ 2 | 3 | #include "tests/lib.h" 4 | #include "tests/main.h" 5 | 6 | void 7 | test_main (void) 8 | { 9 | exit (57); 10 | fail ("should have called exit(57)"); 11 | } 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/exit.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (exit) begin 7 | exit: exit(57) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/halt.c: -------------------------------------------------------------------------------- 1 | /* Tests the halt system call. */ 2 | 3 | #include "tests/lib.h" 4 | #include "tests/main.h" 5 | 6 | void 7 | test_main (void) 8 | { 9 | halt (); 10 | fail ("should have halted"); 11 | } 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/lib/.gitignore: -------------------------------------------------------------------------------- 1 | *.d 2 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/lib/user/.dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/proj2/src/tests/userprog/lib/user/.dummy -------------------------------------------------------------------------------- /proj2/src/tests/userprog/lib/user/.gitignore: -------------------------------------------------------------------------------- 1 | *.d 2 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/no-vm/Make.tests: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | 3 | tests/userprog/no-vm_TESTS = tests/userprog/no-vm/multi-oom 4 | tests/userprog/no-vm_PROGS = $(tests/userprog/no-vm_TESTS) 5 | tests/userprog/no-vm/multi-oom_SRC = tests/userprog/no-vm/multi-oom.c \ 6 | tests/lib.c 7 | 8 | tests/userprog/no-vm/multi-oom.output: TIMEOUT = 360 9 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/no-vm/Rubric: -------------------------------------------------------------------------------- 1 | Functionality of features that VM might break: 2 | 3 | 1 multi-oom 4 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/no-vm/multi-oom.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (multi-oom) begin 7 | (multi-oom) success. program forked 10 times. 8 | (multi-oom) end 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/null.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | system call! 7 | EOF 8 | pass; 9 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/open-bad-ptr.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (open-bad-ptr) begin 7 | (open-bad-ptr) end 8 | open-bad-ptr: exit(0) 9 | EOF 10 | (open-bad-ptr) begin 11 | open-bad-ptr: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/open-boundary.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (open-boundary) begin 7 | (open-boundary) open "sample.txt" 8 | (open-boundary) end 9 | open-boundary: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/open-empty.c: -------------------------------------------------------------------------------- 1 | /* Tries to open a file with the empty string as its name. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | int handle = open (""); 11 | if (handle != -1) 12 | fail ("open() returned %d instead of -1", handle); 13 | } 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/open-empty.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (open-empty) begin 7 | (open-empty) end 8 | open-empty: exit(0) 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/open-missing.c: -------------------------------------------------------------------------------- 1 | /* Tries to open a nonexistent file. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | int handle = open ("no-such-file"); 11 | if (handle != -1) 12 | fail ("open() returned %d", handle); 13 | } 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/open-missing.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (open-missing) begin 7 | (open-missing) end 8 | open-missing: exit(0) 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/open-normal.c: -------------------------------------------------------------------------------- 1 | /* Open a file. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | int handle = open ("sample.txt"); 11 | if (handle < 2) 12 | fail ("open() returned %d", handle); 13 | } 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/open-normal.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (open-normal) begin 7 | (open-normal) end 8 | open-normal: exit(0) 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/open-null.c: -------------------------------------------------------------------------------- 1 | /* Tries to open a file with the null pointer as its name. 2 | The process must be terminated with exit code -1. */ 3 | 4 | #include 5 | #include 6 | #include "tests/main.h" 7 | 8 | void 9 | test_main (void) 10 | { 11 | open (NULL); 12 | } 13 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/open-null.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (open-null) begin 7 | (open-null) end 8 | open-null: exit(0) 9 | EOF 10 | (open-null) begin 11 | open-null: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/open-twice.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (open-twice) begin 7 | (open-twice) open "sample.txt" once 8 | (open-twice) open "sample.txt" again 9 | (open-twice) end 10 | open-twice: exit(0) 11 | EOF 12 | pass; 13 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/read-bad-fd.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (read-bad-fd) begin 7 | (read-bad-fd) end 8 | read-bad-fd: exit(0) 9 | EOF 10 | (read-bad-fd) begin 11 | read-bad-fd: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/read-boundary.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (read-boundary) begin 7 | (read-boundary) open "sample.txt" 8 | (read-boundary) end 9 | read-boundary: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/read-normal.c: -------------------------------------------------------------------------------- 1 | /* Try reading a file in the most normal way. */ 2 | 3 | #include "tests/userprog/sample.inc" 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | check_file ("sample.txt", sample, sizeof sample - 1); 11 | } 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/read-stdout.c: -------------------------------------------------------------------------------- 1 | /* Try reading from fd 1 (stdout), 2 | which may just fail or terminate the process with -1 exit 3 | code. */ 4 | 5 | #include 6 | #include 7 | #include "tests/main.h" 8 | 9 | void 10 | test_main (void) 11 | { 12 | char buf; 13 | read (STDOUT_FILENO, &buf, 1); 14 | } 15 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/read-stdout.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (read-stdout) begin 7 | (read-stdout) end 8 | read-stdout: exit(0) 9 | EOF 10 | (read-stdout) begin 11 | read-stdout: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/read-zero.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (read-zero) begin 7 | (read-zero) open "sample.txt" 8 | (read-zero) end 9 | read-zero: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/rox-child.c: -------------------------------------------------------------------------------- 1 | /* Ensure that the executable of a running process cannot be 2 | modified, even by a child process. */ 3 | 4 | #define CHILD_CNT "1" 5 | #include "tests/userprog/rox-child.inc" 6 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/rox-maxchild.c: -------------------------------------------------------------------------------- 1 | /* Ensure that the executable of a running process cannot be 2 | modified, even in the presence of multiple children. */ 3 | 4 | #define CHILD_CNT "10" 5 | #include "tests/userprog/rox-child.inc" 6 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/rox-multichild.c: -------------------------------------------------------------------------------- 1 | /* Ensure that the executable of a running process cannot be 2 | modified, even in the presence of multiple children. */ 3 | 4 | #define CHILD_CNT "5" 5 | #include "tests/userprog/rox-child.inc" 6 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/rox-simple.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (rox-simple) begin 7 | (rox-simple) open "rox-simple" 8 | (rox-simple) read "rox-simple" 9 | (rox-simple) try to write "rox-simple" 10 | (rox-simple) end 11 | rox-simple: exit(0) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/sample.inc: -------------------------------------------------------------------------------- 1 | char sample[] = { 2 | "\"Amazing Electronic Fact: If you scuffed your feet long enough without\n" 3 | " touching anything, you would build up so many electrons that your\n" 4 | " finger would explode! But this is nothing to worry about unless you\n" 5 | " have carpeting.\" --Dave Barry\n" 6 | }; 7 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/sample.txt: -------------------------------------------------------------------------------- 1 | "Amazing Electronic Fact: If you scuffed your feet long enough without 2 | touching anything, you would build up so many electrons that your 3 | finger would explode! But this is nothing to worry about unless you 4 | have carpeting." --Dave Barry 5 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/sc-bad-arg.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (sc-bad-arg) begin 7 | sc-bad-arg: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/sc-bad-sp.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (sc-bad-sp) begin 7 | sc-bad-sp: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/sc-boundary-2.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (sc-boundary-2) begin 7 | sc-boundary-2: exit(67) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/sc-boundary.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (sc-boundary) begin 7 | sc-boundary: exit(42) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/wait-bad-pid.c: -------------------------------------------------------------------------------- 1 | /* Waits for an invalid pid. This may fail or terminate the 2 | process with -1 exit code. */ 3 | 4 | #include 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | wait ((pid_t) 0x0c020301); 11 | } 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/wait-bad-pid.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (wait-bad-pid) begin 7 | (wait-bad-pid) end 8 | wait-bad-pid: exit(0) 9 | EOF 10 | (wait-bad-pid) begin 11 | wait-bad-pid: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/wait-killed.c: -------------------------------------------------------------------------------- 1 | /* Wait for a process that will be killed for bad behavior. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | msg ("wait(exec()) = %d", wait (exec ("child-bad"))); 11 | } 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/wait-killed.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (wait-killed) begin 7 | (child-bad) begin 8 | child-bad: exit(-1) 9 | (wait-killed) wait(exec()) = -1 10 | (wait-killed) end 11 | wait-killed: exit(0) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/wait-simple.c: -------------------------------------------------------------------------------- 1 | /* Wait for a subprocess to finish. */ 2 | 3 | #include 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | msg ("wait(exec()) = %d", wait (exec ("child-simple"))); 11 | } 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/wait-simple.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (wait-simple) begin 7 | (child-simple) run 8 | child-simple: exit(81) 9 | (wait-simple) wait(exec()) = 81 10 | (wait-simple) end 11 | wait-simple: exit(0) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/wait-twice.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (wait-twice) begin 7 | (child-simple) run 8 | child-simple: exit(81) 9 | (wait-twice) wait(exec()) = 81 10 | (wait-twice) wait(exec()) = -1 11 | (wait-twice) end 12 | wait-twice: exit(0) 13 | EOF 14 | pass; 15 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/write-bad-fd.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (write-bad-fd) begin 7 | (write-bad-fd) end 8 | write-bad-fd: exit(0) 9 | EOF 10 | (write-bad-fd) begin 11 | write-bad-fd: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/write-boundary.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (write-boundary) begin 7 | (write-boundary) open "sample.txt" 8 | (write-boundary) end 9 | write-boundary: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/write-normal.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (write-normal) begin 7 | (write-normal) create "test.txt" 8 | (write-normal) open "test.txt" 9 | (write-normal) end 10 | write-normal: exit(0) 11 | EOF 12 | pass; 13 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/write-stdin.c: -------------------------------------------------------------------------------- 1 | /* Try writing to fd 0 (stdin), 2 | which may just fail or terminate the process with -1 exit 3 | code. */ 4 | 5 | #include 6 | #include "tests/lib.h" 7 | #include "tests/main.h" 8 | 9 | void 10 | test_main (void) 11 | { 12 | char buf = 123; 13 | write (0, &buf, 1); 14 | } 15 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/write-stdin.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF', <<'EOF']); 6 | (write-stdin) begin 7 | (write-stdin) end 8 | write-stdin: exit(0) 9 | EOF 10 | (write-stdin) begin 11 | write-stdin: exit(-1) 12 | EOF 13 | pass; 14 | -------------------------------------------------------------------------------- /proj2/src/tests/userprog/write-zero.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (write-zero) begin 7 | (write-zero) open "sample.txt" 8 | (write-zero) end 9 | write-zero: exit(0) 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/mmap-close.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (mmap-close) begin 7 | (mmap-close) open "sample.txt" 8 | (mmap-close) mmap "sample.txt" 9 | (mmap-close) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/mmap-misalign.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (mmap-misalign) begin 7 | (mmap-misalign) open "sample.txt" 8 | (mmap-misalign) try to mmap at misaligned address 9 | (mmap-misalign) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/mmap-null.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (mmap-null) begin 7 | (mmap-null) open "sample.txt" 8 | (mmap-null) try to mmap at address 0 9 | (mmap-null) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/mmap-over-code.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (mmap-over-code) begin 7 | (mmap-over-code) open "sample.txt" 8 | (mmap-over-code) try to mmap over code segment 9 | (mmap-over-code) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/mmap-over-data.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (mmap-over-data) begin 7 | (mmap-over-data) open "sample.txt" 8 | (mmap-over-data) try to mmap over data segment 9 | (mmap-over-data) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/mmap-over-stk.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (mmap-over-stk) begin 7 | (mmap-over-stk) open "sample.txt" 8 | (mmap-over-stk) try to mmap over stack segment 9 | (mmap-over-stk) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/mmap-read.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (mmap-read) begin 7 | (mmap-read) open "sample.txt" 8 | (mmap-read) mmap "sample.txt" 9 | (mmap-read) end 10 | EOF 11 | pass; 12 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/mmap-unmap.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::vm::process_death; 6 | 7 | check_process_death ('mmap-unmap'); 8 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/mmap-zero.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (mmap-zero) begin 7 | (mmap-zero) create empty file "empty" 8 | (mmap-zero) open "empty" 9 | (mmap-zero) mmap "empty" 10 | mmap-zero: exit(-1) 11 | EOF 12 | pass; 13 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/page-merge-mm.c: -------------------------------------------------------------------------------- 1 | #include "tests/main.h" 2 | #include "tests/vm/parallel-merge.h" 3 | 4 | void 5 | test_main (void) 6 | { 7 | parallel_merge ("child-qsort-mm", 80); 8 | } 9 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/page-merge-par.c: -------------------------------------------------------------------------------- 1 | #include "tests/main.h" 2 | #include "tests/vm/parallel-merge.h" 3 | 4 | void 5 | test_main (void) 6 | { 7 | parallel_merge ("child-sort", 123); 8 | } 9 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/page-merge-stk.c: -------------------------------------------------------------------------------- 1 | #include "tests/main.h" 2 | #include "tests/vm/parallel-merge.h" 3 | 4 | void 5 | test_main (void) 6 | { 7 | parallel_merge ("child-qsort", 72); 8 | } 9 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/parallel-merge.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_VM_PARALLEL_MERGE 2 | #define TESTS_VM_PARALLEL_MERGE 1 3 | 4 | void parallel_merge (const char *child_name, int exit_status); 5 | 6 | #endif /* tests/vm/parallel-merge.h */ 7 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/pt-bad-addr.c: -------------------------------------------------------------------------------- 1 | /* Accesses a bad address. 2 | The process must be terminated with -1 exit code. */ 3 | 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | fail ("bad addr read as %d", *(int *) 0x04000000); 11 | } 12 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/pt-bad-addr.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::vm::process_death; 6 | 7 | check_process_death ('pt-bad-addr'); 8 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/pt-bad-read.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (pt-bad-read) begin 7 | (pt-bad-read) open "sample.txt" 8 | pt-bad-read: exit(-1) 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/pt-big-stk-obj.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (pt-big-stk-obj) begin 7 | (pt-big-stk-obj) cksum: 3256410166 8 | (pt-big-stk-obj) end 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/pt-grow-bad.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); 6 | (pt-grow-bad) begin 7 | pt-grow-bad: exit(-1) 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/pt-grow-pusha.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (pt-grow-pusha) begin 7 | (pt-grow-pusha) end 8 | EOF 9 | pass; 10 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/pt-grow-stack.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); 6 | (pt-grow-stack) begin 7 | (pt-grow-stack) cksum: 3424492700 8 | (pt-grow-stack) end 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/pt-write-code.c: -------------------------------------------------------------------------------- 1 | /* Try to write to the code segment. 2 | The process must be terminated with -1 exit code. */ 3 | 4 | #include "tests/lib.h" 5 | #include "tests/main.h" 6 | 7 | void 8 | test_main (void) 9 | { 10 | *(int *) test_main = 0; 11 | fail ("writing the code segment succeeded"); 12 | } 13 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/pt-write-code.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | use tests::vm::process_death; 6 | 7 | check_process_death ('pt-write-code'); 8 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/pt-write-code2.ck: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | use strict; 3 | use warnings; 4 | use tests::tests; 5 | check_expected ([<<'EOF']); 6 | (pt-write-code2) begin 7 | (pt-write-code2) open "sample.txt" 8 | pt-write-code2: exit(-1) 9 | EOF 10 | pass; 11 | -------------------------------------------------------------------------------- /proj2/src/tests/vm/qsort.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTS_VM_QSORT_H 2 | #define TESTS_VM_QSORT_H 1 3 | 4 | #include 5 | 6 | void qsort_bytes (unsigned char *buf, size_t size); 7 | 8 | #endif /* tests/vm/qsort.h */ 9 | -------------------------------------------------------------------------------- /proj2/src/threads/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | bochsrc.txt 3 | bochsout.txt 4 | -------------------------------------------------------------------------------- /proj2/src/threads/Make.vars: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | 3 | kernel.bin: DEFINES = 4 | KERNEL_SUBDIRS = threads devices lib lib/kernel $(TEST_SUBDIRS) 5 | TEST_SUBDIRS = tests/threads 6 | GRADING_FILE = $(SRCDIR)/tests/threads/Grading 7 | SIMULATOR = --bochs 8 | -------------------------------------------------------------------------------- /proj2/src/threads/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.kernel 2 | -------------------------------------------------------------------------------- /proj2/src/threads/flags.h: -------------------------------------------------------------------------------- 1 | #ifndef THREADS_FLAGS_H 2 | #define THREADS_FLAGS_H 3 | 4 | /* EFLAGS Register. */ 5 | #define FLAG_MBS 0x00000002 /* Must be set. */ 6 | #define FLAG_IF 0x00000200 /* Interrupt Flag. */ 7 | 8 | #endif /* threads/flags.h */ 9 | -------------------------------------------------------------------------------- /proj2/src/threads/init.h: -------------------------------------------------------------------------------- 1 | #ifndef THREADS_INIT_H 2 | #define THREADS_INIT_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | /* Page directory with kernel mappings only. */ 10 | extern uint32_t *init_page_dir; 11 | 12 | #endif /* threads/init.h */ 13 | -------------------------------------------------------------------------------- /proj2/src/userprog/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | bochsrc.txt 3 | bochsout.txt 4 | -------------------------------------------------------------------------------- /proj2/src/userprog/Make.vars: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | 3 | kernel.bin: DEFINES = -DUSERPROG -DFILESYS 4 | KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys 5 | TEST_SUBDIRS = tests/userprog tests/userprog/no-vm tests/filesys/base 6 | GRADING_FILE = $(SRCDIR)/tests/userprog/Grading 7 | SIMULATOR = --bochs 8 | -------------------------------------------------------------------------------- /proj2/src/userprog/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.kernel 2 | -------------------------------------------------------------------------------- /proj2/src/userprog/tss.h: -------------------------------------------------------------------------------- 1 | #ifndef USERPROG_TSS_H 2 | #define USERPROG_TSS_H 3 | 4 | #include 5 | 6 | struct tss; 7 | void tss_init (void); 8 | struct tss *tss_get (void); 9 | void tss_update (void); 10 | 11 | #endif /* userprog/tss.h */ 12 | -------------------------------------------------------------------------------- /proj2/src/utils/.gitignore: -------------------------------------------------------------------------------- 1 | setitimer-helper 2 | squish-pty 3 | squish-unix 4 | -------------------------------------------------------------------------------- /proj2/src/utils/Makefile: -------------------------------------------------------------------------------- 1 | all: setitimer-helper squish-pty squish-unix 2 | 3 | CC = gcc 4 | CFLAGS = -Wall -W 5 | LOADLIBES = -lm 6 | setitimer-helper: setitimer-helper.o 7 | squish-pty: squish-pty.o 8 | squish-unix: squish-unix.o 9 | 10 | clean: 11 | rm -f *.o setitimer-helper squish-pty squish-unix 12 | -------------------------------------------------------------------------------- /proj2/src/utils/setitimer-helper.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/proj2/src/utils/setitimer-helper.o -------------------------------------------------------------------------------- /proj2/src/utils/squish-pty.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/proj2/src/utils/squish-pty.o -------------------------------------------------------------------------------- /proj2/src/utils/squish-unix.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/proj2/src/utils/squish-unix.o -------------------------------------------------------------------------------- /proj2/src/vm/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | bochsrc.txt 3 | bochsout.txt 4 | -------------------------------------------------------------------------------- /proj2/src/vm/Make.vars: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | 3 | kernel.bin: DEFINES = -DUSERPROG -DFILESYS -DVM 4 | KERNEL_SUBDIRS = threads devices lib lib/kernel userprog filesys vm 5 | TEST_SUBDIRS = tests/userprog tests/vm tests/filesys/base 6 | GRADING_FILE = $(SRCDIR)/tests/vm/Grading 7 | SIMULATOR = --qemu 8 | -------------------------------------------------------------------------------- /proj2/src/vm/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.kernel 2 | -------------------------------------------------------------------------------- /proj2/test1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/proj2/test1.jpg -------------------------------------------------------------------------------- /proj2/test2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/proj2/test2.jpg -------------------------------------------------------------------------------- /proj2/testall.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifesaver0129/CS302-Operating-System/97d31ce6196bc9c6c354ec04d1a215cc55b1918f/proj2/testall.jpg --------------------------------------------------------------------------------