Adding yield syscall doesn't help significantly,
[pintos-anon] / solutions / p2.patch
index 9022ac98b9eebaced38d2e77e4dfa40a1efcf8dd..83d91fe22d7c2776869a1e268b21fdc1d454b988 100644 (file)
@@ -122,10 +122,10 @@ diff -u src/userprog/process.c~ src/userprog/process.c
 @@ -14,11 +14,23 @@
  #include "threads/init.h"
  #include "threads/interrupt.h"
- #include "threads/mmu.h"
 +#include "threads/malloc.h"
  #include "threads/palloc.h"
  #include "threads/thread.h"
+ #include "threads/vaddr.h"
  
  static thread_func execute_thread NO_RETURN;
 -static bool load (const char *cmdline, void (**eip) (void), void **esp);
@@ -491,7 +491,7 @@ diff -u src/userprog/process.c~ src/userprog/process.c
 diff -u src/userprog/syscall.c~ src/userprog/syscall.c
 --- src/userprog/syscall.c~ 2004-09-26 14:15:17.000000000 -0700
 +++ src/userprog/syscall.c 2005-06-08 13:45:28.000000000 -0700
-@@ -1,20 +1,480 @@
+@@ -1,20 +1,482 @@
  #include "userprog/syscall.h"
  #include <stdio.h>
 +#include <string.h>
@@ -504,9 +504,9 @@ diff -u src/userprog/syscall.c~ src/userprog/syscall.c
 +#include "threads/init.h"
  #include "threads/interrupt.h"
 +#include "threads/malloc.h"
-+#include "threads/mmu.h"
 +#include "threads/palloc.h"
  #include "threads/thread.h"
++#include "threads/vaddr.h"
 -
 + 
 + 
@@ -972,7 +972,9 @@ diff -u src/userprog/syscall.c~ src/userprog/syscall.c
 +      struct file_descriptor *fd;
 +      fd = list_entry (e, struct file_descriptor, elem);
 +      next = list_next (e);
++      lock_acquire (&fs_lock);
 +      file_close (fd->file);
++      lock_release (&fs_lock);
 +      free (fd);
 +    }
 +}