diff --git a/README.md b/README.md index 68662e2..aba47c5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ # CS130 Project - pintos -ShanghaiTech University Spring 2024. \ No newline at end of file +ShanghaiTech University Spring 2024. + +## No plagiarism + +If you are enrolled in CS130, you may not copy source code from this repository. \ No newline at end of file diff --git a/pintos/src/examples/.gitignore b/pintos/src/examples/.gitignore index a9e09d7..d5a1a73 100644 --- a/pintos/src/examples/.gitignore +++ b/pintos/src/examples/.gitignore @@ -17,3 +17,5 @@ lineup matmult recursor *.d +*.o +*.a diff --git a/pintos/src/threads/thread.c b/pintos/src/threads/thread.c index fd4ce11..8f262d3 100644 --- a/pintos/src/threads/thread.c +++ b/pintos/src/threads/thread.c @@ -83,6 +83,7 @@ static long long user_ticks; /* # of timer ticks in user programs. */ /* Scheduling. */ #define TIME_SLICE 4 /* # of timer ticks to give each thread. */ static unsigned thread_ticks; /* # of timer ticks since last yield. */ +static bool scheduler_init; /* Denote whether the schedular should work. */ /* If false (default), use round-robin scheduler. If true, use multi-level feedback queue scheduler. @@ -148,6 +149,8 @@ thread_start (void) /* Wait for the idle thread to initialize idle_thread. */ sema_down (&idle_started); + + scheduler_init = true; } /* Called by the timer interrupt handler at each timer tick. @@ -364,6 +367,9 @@ thread_exit (void) void thread_yield (void) { + if (!scheduler_init) + return; + struct thread *cur = thread_current (); enum intr_level old_level; diff --git a/pintos/src/userprog/remake.sh b/pintos/src/userprog/remake.sh new file mode 100755 index 0000000..fae2d60 --- /dev/null +++ b/pintos/src/userprog/remake.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +make clean +make +cd build/ +pintos-mkdisk filesys.dsk --filesys-size=2 +cd .. + +echo "userprog/ clean & rebuild." \ No newline at end of file diff --git a/pintos/src/utils/Pintos.pm b/pintos/src/utils/Pintos.pm index 0139aba..70df40d 100644 --- a/pintos/src/utils/Pintos.pm +++ b/pintos/src/utils/Pintos.pm @@ -359,7 +359,7 @@ sub cyl_sectors { # Makes sure that the loader is a reasonable size. sub read_loader { my ($name) = @_; - $name = find_file ("/home/asta/ShanghaiTech/2024Spring/CS130-Project/pintos/src/threads/build/loader.bin") if !defined $name; + $name = find_file ("loader.bin") if !defined $name; die "Cannot find loader\n" if !defined $name; my ($handle); diff --git a/pintos/src/utils/pintos b/pintos/src/utils/pintos index 1690ff5..7374c6d 100755 --- a/pintos/src/utils/pintos +++ b/pintos/src/utils/pintos @@ -257,7 +257,7 @@ sub set_disk { sub find_disks { # Find kernel, if we don't already have one. if (!exists $parts{KERNEL}) { - my $name = find_file ('/home/asta/ShanghaiTech/2024Spring/CS130-Project/pintos/src/threads/build/kernel.bin'); + my $name = find_file ('kernel.bin'); die "Cannot find kernel\n" if !defined $name; do_set_part ('KERNEL', 'file', $name); } diff --git a/pintos/src/utils/setitimer-helper.o b/pintos/src/utils/setitimer-helper.o deleted file mode 100644 index c1f5edd..0000000 Binary files a/pintos/src/utils/setitimer-helper.o and /dev/null differ diff --git a/pintos/src/utils/squish-pty.o b/pintos/src/utils/squish-pty.o deleted file mode 100644 index 48b8d9c..0000000 Binary files a/pintos/src/utils/squish-pty.o and /dev/null differ diff --git a/pintos/src/utils/squish-unix.o b/pintos/src/utils/squish-unix.o deleted file mode 100644 index bc38ea6..0000000 Binary files a/pintos/src/utils/squish-unix.o and /dev/null differ