Open J-dbd opened 11 months ago
thread
구조체에 추가해야 하는 항목들에 대한 고찰 process_wait(pid)
과 syscall_wait(pid)
의 차이는?1212 pass tests/userprog/args-none FAIL tests/userprog/args-single FAIL tests/userprog/args-multiple FAIL tests/userprog/args-many FAIL tests/userprog/args-dbl-space pass tests/userprog/halt pass tests/userprog/exit pass tests/userprog/create-normal pass tests/userprog/create-empty pass tests/userprog/create-null pass tests/userprog/create-bad-ptr pass tests/userprog/create-long pass tests/userprog/create-exists pass tests/userprog/create-bound pass tests/userprog/open-normal pass tests/userprog/open-missing pass tests/userprog/open-boundary pass tests/userprog/open-empty pass tests/userprog/open-null pass tests/userprog/open-bad-ptr pass tests/userprog/open-twice pass tests/userprog/close-normal pass tests/userprog/close-twice pass tests/userprog/close-bad-fd pass tests/userprog/read-normal pass tests/userprog/read-bad-ptr pass tests/userprog/read-boundary pass tests/userprog/read-zero pass tests/userprog/read-stdout pass tests/userprog/read-bad-fd pass tests/userprog/write-normal pass tests/userprog/write-bad-ptr pass tests/userprog/write-boundary pass tests/userprog/write-zero pass tests/userprog/write-stdin pass tests/userprog/write-bad-fd pass tests/userprog/fork-once pass tests/userprog/fork-multiple pass tests/userprog/fork-recursive pass tests/userprog/fork-read pass tests/userprog/fork-close pass tests/userprog/fork-boundary FAIL tests/userprog/exec-once FAIL tests/userprog/exec-arg FAIL tests/userprog/exec-boundary FAIL tests/userprog/exec-missing FAIL tests/userprog/exec-bad-ptr FAIL tests/userprog/exec-read FAIL tests/userprog/wait-simple FAIL tests/userprog/wait-twice FAIL tests/userprog/wait-killed pass tests/userprog/wait-bad-pid FAIL tests/userprog/multi-recurse FAIL tests/userprog/multi-child-fd FAIL tests/userprog/rox-simple FAIL tests/userprog/rox-child FAIL tests/userprog/rox-multichild pass tests/userprog/bad-read pass tests/userprog/bad-write pass tests/userprog/bad-read2 pass tests/userprog/bad-write2 pass tests/userprog/bad-jump pass tests/userprog/bad-jump2 pass tests/filesys/base/lg-create pass tests/filesys/base/lg-full FAIL tests/filesys/base/lg-random pass tests/filesys/base/lg-seq-block pass tests/filesys/base/lg-seq-random pass tests/filesys/base/sm-create pass tests/filesys/base/sm-full FAIL tests/filesys/base/sm-random pass tests/filesys/base/sm-seq-block pass tests/filesys/base/sm-seq-random FAIL tests/filesys/base/syn-read FAIL tests/filesys/base/syn-remove FAIL tests/filesys/base/syn-write FAIL tests/userprog/no-vm/multi-oom pass tests/threads/alarm-single pass tests/threads/alarm-multiple pass tests/threads/alarm-simultaneous pass tests/threads/alarm-priority pass tests/threads/alarm-zero pass tests/threads/alarm-negative pass tests/threads/priority-change pass tests/threads/priority-donate-one pass tests/threads/priority-donate-multiple pass tests/threads/priority-donate-multiple2 pass tests/threads/priority-donate-nest pass tests/threads/priority-donate-sema pass tests/threads/priority-donate-lower pass tests/threads/priority-fifo pass tests/threads/priority-preempt pass tests/threads/priority-sema pass tests/threads/priority-condvar pass tests/threads/priority-donate-chain 24 of 95 tests failed.
pass tests/userprog/args-none FAIL tests/userprog/args-single FAIL tests/userprog/args-multiple FAIL tests/userprog/args-many FAIL tests/userprog/args-dbl-space pass tests/userprog/halt pass tests/userprog/exit pass tests/userprog/create-normal pass tests/userprog/create-empty pass tests/userprog/create-null pass tests/userprog/create-bad-ptr pass tests/userprog/create-long pass tests/userprog/create-exists pass tests/userprog/create-bound pass tests/userprog/open-normal pass tests/userprog/open-missing pass tests/userprog/open-boundary pass tests/userprog/open-empty pass tests/userprog/open-null pass tests/userprog/open-bad-ptr pass tests/userprog/open-twice pass tests/userprog/close-normal pass tests/userprog/close-twice pass tests/userprog/close-bad-fd pass tests/userprog/read-normal pass tests/userprog/read-bad-ptr pass tests/userprog/read-boundary pass tests/userprog/read-zero pass tests/userprog/read-stdout pass tests/userprog/read-bad-fd pass tests/userprog/write-normal pass tests/userprog/write-bad-ptr pass tests/userprog/write-boundary pass tests/userprog/write-zero pass tests/userprog/write-stdin pass tests/userprog/write-bad-fd pass tests/userprog/fork-once pass tests/userprog/fork-multiple pass tests/userprog/fork-recursive pass tests/userprog/fork-read pass tests/userprog/fork-close pass tests/userprog/fork-boundary pass tests/userprog/exec-once pass tests/userprog/exec-arg pass tests/userprog/exec-boundary pass tests/userprog/exec-missing pass tests/userprog/exec-bad-ptr pass tests/userprog/exec-read pass tests/userprog/wait-simple pass tests/userprog/wait-twice pass tests/userprog/wait-killed pass tests/userprog/wait-bad-pid FAIL tests/userprog/multi-recurse pass tests/userprog/multi-child-fd FAIL tests/userprog/rox-simple FAIL tests/userprog/rox-child FAIL tests/userprog/rox-multichild pass tests/userprog/bad-read pass tests/userprog/bad-write pass tests/userprog/bad-read2 pass tests/userprog/bad-write2 pass tests/userprog/bad-jump pass tests/userprog/bad-jump2 pass tests/filesys/base/lg-create pass tests/filesys/base/lg-full FAIL tests/filesys/base/lg-random pass tests/filesys/base/lg-seq-block pass tests/filesys/base/lg-seq-random pass tests/filesys/base/sm-create pass tests/filesys/base/sm-full FAIL tests/filesys/base/sm-random pass tests/filesys/base/sm-seq-block pass tests/filesys/base/sm-seq-random FAIL tests/filesys/base/syn-read FAIL tests/filesys/base/syn-remove FAIL tests/filesys/base/syn-write FAIL tests/userprog/no-vm/multi-oom pass tests/threads/alarm-single pass tests/threads/alarm-multiple pass tests/threads/alarm-simultaneous pass tests/threads/alarm-priority pass tests/threads/alarm-zero pass tests/threads/alarm-negative pass tests/threads/priority-change pass tests/threads/priority-donate-one pass tests/threads/priority-donate-multiple pass tests/threads/priority-donate-multiple2 pass tests/threads/priority-donate-nest pass tests/threads/priority-donate-sema pass tests/threads/priority-donate-lower pass tests/threads/priority-fifo pass tests/threads/priority-preempt pass tests/threads/priority-sema pass tests/threads/priority-condvar pass tests/threads/priority-donate-chain 14 of 95 tests failed.
FAIL tests/userprog/multi-recurse
FAIL tests/userprog/rox-simple FAIL tests/userprog/rox-child FAIL tests/userprog/rox-multichild
FAIL tests/filesys/base/lg-random
FAIL tests/filesys/base/sm-random
FAIL tests/filesys/base/syn-read FAIL tests/filesys/base/syn-remove FAIL tests/filesys/base/syn-write FAIL tests/userprog/no-vm/multi-oom
해야 함 (12/13)
FAIL tests/userprog/write-bad-fd
Kernel panic in run: PANIC at ../../userprog/exception.c:99 in kill(): Kernel bug - unexpected interrupt in kernel
Call stack: 0x800421891d 0x800421d847 0x8004209690 0x8004209aae 0x800421fbd2 0x800421e1f7 0x800421e644 0x800421da51 0x400168 0x40021d 0x400cbe
Translation of call stack:
0x000000800421891d: debug_panic (lib/kernel/debug.c:32)
0x000000800421d847: kill (userprog/exception.c:105)
0x0000008004209690: intr_handler (threads/interrupt.c:352)
0x0000008004209aae: intr_entry (threads/intr-stubs.o:?)
0x000000800421fbd2: file_write (filesys/file.c:98)
0x000000800421e1f7: syscall_write (userprog/syscall.c:305)
0x000000800421e644: syscall_handler (userprog/syscall.c:468)
0x000000800421da51: no_sti (userprog/syscall-entry.o:?)
0x0000000000400168: (unknown)
0x000000000040021d: (unknown)
0x0000000000400cbe: (unknown)
FAIL tests/userprog/rox-child
Test output failed to match any acceptable form.
Acceptable output:
(rox-child) begin
(rox-child) open "child-rox"
(rox-child) read "child-rox"
(rox-child) write "child-rox"
(rox-child) exec "child-rox 1"
(child-rox) begin
(child-rox) try to write "child-rox"
(child-rox) try to write "child-rox"
(child-rox) end
child-rox: exit(12)
(rox-child) write "child-rox"
(rox-child) end
rox-child: exit(0)
Differences in `diff -u' format:
(rox-child) begin
(rox-child) open "child-rox"
(rox-child) read "child-rox"
- (rox-child) write "child-rox"
- (rox-child) exec "child-rox 1"
- (child-rox) begin
- (child-rox) try to write "child-rox"
- (child-rox) try to write "child-rox"
- (child-rox) end
- child-rox: exit(12)
- (rox-child) write "child-rox"
- (rox-child) end
- rox-child: exit(0)
+ rox-child: exit(-1)
FAIL tests/userprog/rox-multichild
Test output failed to match any acceptable form.
Acceptable output:
(rox-multichild) begin
(rox-multichild) open "child-rox"
(rox-multichild) read "child-rox"
(rox-multichild) write "child-rox"
(rox-multichild) exec "child-rox 5"
(child-rox) begin
(child-rox) try to write "child-rox"
(child-rox) exec "child-rox 4"
(child-rox) begin
(child-rox) try to write "child-rox"
(child-rox) exec "child-rox 3"
(child-rox) begin
(child-rox) try to write "child-rox"
(child-rox) exec "child-rox 2"
(child-rox) begin
(child-rox) try to write "child-rox"
(child-rox) exec "child-rox 1"
(child-rox) begin
(child-rox) try to write "child-rox"
(child-rox) try to write "child-rox"
(child-rox) end
child-rox: exit(12)
(child-rox) try to write "child-rox"
(child-rox) end
child-rox: exit(12)
(child-rox) try to write "child-rox"
(child-rox) end
child-rox: exit(12)
(child-rox) try to write "child-rox"
(child-rox) end
child-rox: exit(12)
(child-rox) try to write "child-rox"
(child-rox) end
child-rox: exit(12)
(rox-multichild) write "child-rox"
(rox-multichild) end
rox-multichild: exit(0)
Differences in `diff -u' format:
(rox-multichild) begin
(rox-multichild) open "child-rox"
(rox-multichild) read "child-rox"
- (rox-multichild) write "child-rox"
- (rox-multichild) exec "child-rox 5"
- (child-rox) begin
- (child-rox) try to write "child-rox"
- (child-rox) exec "child-rox 4"
- (child-rox) begin
- (child-rox) try to write "child-rox"
- (child-rox) exec "child-rox 3"
- (child-rox) begin
- (child-rox) try to write "child-rox"
- (child-rox) exec "child-rox 2"
- (child-rox) begin
- (child-rox) try to write "child-rox"
- (child-rox) exec "child-rox 1"
- (child-rox) begin
- (child-rox) try to write "child-rox"
- (child-rox) try to write "child-rox"
- (child-rox) end
- child-rox: exit(12)
- (child-rox) try to write "child-rox"
- (child-rox) end
- child-rox: exit(12)
- (child-rox) try to write "child-rox"
- (child-rox) end
- child-rox: exit(12)
- (child-rox) try to write "child-rox"
- (child-rox) end
- child-rox: exit(12)
- (child-rox) try to write "child-rox"
- (child-rox) end
- child-rox: exit(12)
- (rox-multichild) write "child-rox"
- (rox-multichild) end
- rox-multichild: exit(0)
+ rox-multichild: exit(-1)
FAIL tests/filesys/base/lg-random
Test output failed to match any acceptable form.
Acceptable output:
(lg-random) begin
(lg-random) create "bazzle"
(lg-random) open "bazzle"
(lg-random) write "bazzle" in random order
(lg-random) read "bazzle" in random order
(lg-random) close "bazzle"
(lg-random) end
Differences in `diff -u' format:
(lg-random) begin
(lg-random) create "bazzle"
(lg-random) open "bazzle"
(lg-random) write "bazzle" in random order
- (lg-random) read "bazzle" in random order
- (lg-random) close "bazzle"
- (lg-random) end
FAIL tests/filesys/base/syn-read
Kernel panic in run: PANIC at ../../userprog/exception.c:99 in kill(): Kernel bug - unexpected interrupt in kernel
Call stack: 0x800421891d 0x800421d847 0x8004209690 0x8004209aae 0x800421fa5d 0x800421c2e6 0x80042078d2
Translation of call stack:
0x000000800421891d: debug_panic (lib/kernel/debug.c:32)
0x000000800421d847: kill (userprog/exception.c:105)
0x0000008004209690: intr_handler (threads/interrupt.c:352)
0x0000008004209aae: intr_entry (threads/intr-stubs.o:?)
0x000000800421fa5d: file_duplicate (filesys/file.c:42)
0x000000800421c2e6: __do_fork (userprog/process.c:194)
0x00000080042078d2: kernel_thread (threads/thread.c:592)
FAIL tests/filesys/base/syn-remove
Test output failed to match any acceptable form.
Acceptable output:
(syn-remove) begin
(syn-remove) create "deleteme"
(syn-remove) open "deleteme"
(syn-remove) remove "deleteme"
(syn-remove) write "deleteme"
(syn-remove) seek "deleteme" to 0
(syn-remove) read "deleteme"
(syn-remove) close "deleteme"
(syn-remove) end
Differences in `diff -u' format:
(syn-remove) begin
(syn-remove) create "deleteme"
(syn-remove) open "deleteme"
(syn-remove) remove "deleteme"
(syn-remove) write "deleteme"
(syn-remove) seek "deleteme" to 0
- (syn-remove) read "deleteme"
- (syn-remove) close "deleteme"
- (syn-remove) end
FAIL tests/filesys/base/syn-write
Kernel panic in run: PANIC at ../../userprog/exception.c:99 in kill(): Kernel bug - unexpected interrupt in kernel
Call stack: 0x800421891d 0x800421d847 0x8004209690 0x8004209aae 0x800421fa5d 0x800421c2e6 0x80042078d2
Translation of call stack:
0x000000800421891d: debug_panic (lib/kernel/debug.c:32)
0x000000800421d847: kill (userprog/exception.c:105)
0x0000008004209690: intr_handler (threads/interrupt.c:352)
0x0000008004209aae: intr_entry (threads/intr-stubs.o:?)
0x000000800421fa5d: file_duplicate (filesys/file.c:42)
0x000000800421c2e6: __do_fork (userprog/process.c:194)
0x00000080042078d2: kernel_thread (threads/thread.c:592)
14 of 95 tests failed.
FAIL tests/userprog/write-bad-fd
Kernel panic in run: PANIC at ../../threads/synch.c:292 in lock_release(): assertion `lock_held_by_current_thread (lock)' failed.
Call stack: 0x800421891d 0x800420ae48 0x800421e1cf 0x800421e65b 0x800421da79 0x400111 0x40021d 0x400cbe
Translation of call stack:
0x000000800421891d: debug_panic (lib/kernel/debug.c:32)
0x000000800420ae48: lock_release (threads/synch.c:295)
0x000000800421e1cf: syscall_write (userprog/syscall.c:308)
0x000000800421e65b: syscall_handler (userprog/syscall.c:478)
0x000000800421da79: no_sti (userprog/syscall-entry.o:?)
0x0000000000400111: (unknown)
0x000000000040021d: (unknown)
0x0000000000400cbe: (unknown)
FAIL tests/filesys/base/syn-read
Kernel panic in run: PANIC at ../../userprog/exception.c:99 in kill(): Kernel bug - unexpected interrupt in kernel
Call stack: 0x800421891d 0x800421d86f 0x8004209690 0x8004209aae 0x800421fa74 0x800421c30e 0x80042078d2
Translation of call stack:
0x000000800421891d: debug_panic (lib/kernel/debug.c:32)
0x000000800421d86f: kill (userprog/exception.c:105)
0x0000008004209690: intr_handler (threads/interrupt.c:352)
0x0000008004209aae: intr_entry (threads/intr-stubs.o:?)
0x000000800421fa74: file_duplicate (filesys/file.c:42)
0x000000800421c30e: __do_fork (userprog/process.c:198)
0x00000080042078d2: kernel_thread (threads/thread.c:592)
FAIL tests/filesys/base/syn-write
Kernel panic in run: PANIC at ../../userprog/exception.c:99 in kill(): Kernel bug - unexpected interrupt in kernel
Call stack: 0x800421891d 0x800421d86f 0x8004209690 0x8004209aae 0x800421fa74 0x800421c30e 0x80042078d2
Translation of call stack:
0x000000800421891d: debug_panic (lib/kernel/debug.c:32)
0x000000800421d86f: kill (userprog/exception.c:105)
0x0000008004209690: intr_handler (threads/interrupt.c:352)
0x0000008004209aae: intr_entry (threads/intr-stubs.o:?)
0x000000800421fa74: file_duplicate (filesys/file.c:42)
0x000000800421c30e: __do_fork (userprog/process.c:198)
0x00000080042078d2: kernel_thread (threads/thread.c:592)
AIL tests/filesys/base/syn-write
Kernel panic in run: PANIC at ../../userprog/exception.c:99 in kill(): Kernel bug - unexpected interrupt in kernel
Call stack: 0x800421891d 0x800421d86f 0x8004209690 0x8004209aae 0x800421fa74 0x800421c30e 0x80042078d2
Translation of call stack:
0x000000800421891d: debug_panic (lib/kernel/debug.c:32)
0x000000800421d86f: kill (userprog/exception.c:105)
0x0000008004209690: intr_handler (threads/interrupt.c:352)
0x0000008004209aae: intr_entry (threads/intr-stubs.o:?)
0x000000800421fa74: file_duplicate (filesys/file.c:42)
0x000000800421c30e: __do_fork (userprog/process.c:198)
0x00000080042078d2: kernel_thread (threads/thread.c:592)
Executing 'syn-write':
syscall_num: 10
(syn-write) begin
syscall_num: 10
(syn-write) create "stuff"
syscall_num: 5
succ?: 1
syscall_num: 2
syscall_num: 3
syscall_num: 7
opened_file? : 0x800423e058
curr_fdt: 0x800423e058
syscall_num: 11
syscall_num: 10
syscall_num: 13
syscall_num: 1
child-syn-wrt: exit(0)
syscall_num: 10
(syn-write) exec child 1 of 10: "child-syn-wrt 0"
syscall_num: 2
syscall_num: 3
syscall_num: 7
opened_file? : 0x800423e068
syscall_num: 10
((null)) open "stuff": FAILED
syscall_num: 1
child-syn-wrt: exit(1)
syscall_num: 10
(syn-write) exec child 2 of 10: "child-syn-wrt 1"
syscall_num: 2
syscall_num: 3
syscall_num: 7
opened_file? : 0x800423e068
syscall_num: 10
((null)) open "stuff": FAILED
syscall_num: 1
child-syn-wrt: exit(1)
syscall_num: 10
(syn-write) exec child 3 of 10: "child-syn-wrt 2"
syscall_num: 2
syscall_num: 3
syscall_num: 7
opened_file? : 0x800423e068
syscall_num: 10
((null)) open "stuff": FAILED
syscall_num: 1
child-syn-wrt: exit(1)
syscall_num: 10
(syn-write) exec child 4 of 10: "child-syn-wrt 3"
syscall_num: 2
syscall_num: 3
syscall_num: 7
opened_file? : 0x800423e068
syscall_num: 10
((null)) open "stuff": FAILED
syscall_num: 1
child-syn-wrt: exit(1)
syscall_num: 10
(syn-write) exec child 5 of 10: "child-syn-wrt 4"
syscall_num: 2
syscall_num: 3
syscall_num: 7
opened_file? : 0x800423e068
syscall_num: 10
((null)) open "stuff": FAILED
syscall_num: 1
child-syn-wrt: exit(1)
syscall_num: 10
(syn-write) exec child 6 of 10: "child-syn-wrt 5"
syscall_num: 2
syscall_num: 3
syscall_num: 7
opened_file? : 0x800423e068
syscall_num: 10
((null)) open "stuff": FAILED
syscall_num: 1
child-syn-wrt: exit(1)
syscall_num: 10
(syn-write) exec child 7 of 10: "child-syn-wrt 6"
syscall_num: 2
syscall_num: 3
syscall_num: 7
opened_file? : 0x800423e068
syscall_num: 10
((null)) open "stuff": FAILED
syscall_num: 1
child-syn-wrt: exit(1)
syscall_num: 10
(syn-write) exec child 8 of 10: "child-syn-wrt 7"
syscall_num: 2
syscall_num: 3
syscall_num: 7
opened_file? : 0x800423e068
syscall_num: 10
((null)) open "stuff": FAILED
syscall_num: 1
child-syn-wrt: exit(1)
syscall_num: 10
(syn-write) exec child 9 of 10: "child-syn-wrt 8"
syscall_num: 2
syscall_num: 3
syscall_num: 7
opened_file? : 0x800423e068
syscall_num: 10
((null)) open "stuff": FAILED
syscall_num: 1
child-syn-wrt: exit(1)
syscall_num: 10
(syn-write) exec child 10 of 10: "child-syn-wrt 9"
syscall_num: 4
syscall_num: 10
(syn-write) wait for child 1 of 10 returned 0 (expected 0)
syscall_num: 4
syscall_num: 10
(syn-write) wait for child 2 of 10 returned 1 (expected 1)
syscall_num: 4
syscall_num: 10
(syn-write) wait for child 3 of 10 returned 1 (expected 2)
syscall_num: 10
(syn-write) wait for child 3 of 10 returned 1 (expected 2): FAILED
syscall_num: 1
syn-write: exit(1)
Execution of 'syn-write' complete.
Timer: 122 ticks
Thread: 32 idle ticks, 46 kernel ticks, 44 user ticks
hd0:0: 0 reads, 0 writes
hd0:1: 693 reads, 513 writes
hd1:0: 226 reads, 0 writes
Console: 3601 characters output
Keyboard: 0 keys pressed
Exception: 0 page faults
Powering off...
void halt (void);
Terminates Pintos by calling power_off() (declared in src/include/threads/init.h). This should be seldom used, because you lose some information about possible deadlock situations, etc.void exit (int status);
Terminates the current user program, returning status to the kernel. If the process's parent waits for it (see below), this is the status that will be returned. Conventionally, a status of 0 indicates success and nonzero values indicate errors.pid_t fork (const char *thread_name);
Create new process which is the clone of current process with the name THREAD_NAME. You don't need to clone the value of the registers except %RBX, %RSP, %RBP, and %R12 - %R15, which are callee-saved registers. Must return pid of the child process, otherwise shouldn't be a valid pid. In child process, the return value should be 0. The child should have DUPLICATED resources including file descriptor and virtual memory space. Parent process should never return from the fork until it knows whether the child process successfully cloned. That is, if the child process fail to duplicate the resource, the fork () call of parent should return the TID_ERROR.The template utilizes the pml4_for_each() in threads/mmu.c to copy entire user memory space, including corresponding pagetable structures, but you need to fill missing parts of passed pte_for_each_func (See virtual address).
int exec (const char *cmd_line);
Change current process to the executable whose name is given in cmd_line, passing any given arguments. This never returns if successful. Otherwise the process terminates with exit state -1, if the program cannot load or run for any reason. This function does not change the name of the thread that called exec. Please note that file descriptors remain open across an exec call.int wait (pid_t pid);
Waits for a child process pid and retrieves the child's exit status. If pid is still alive, waits until it terminates. Then, returns the status that pid passed to exit. If pid did not call exit(), but was terminated by the kernel (e.g. killed due to an exception), wait(pid) must return -1. It is perfectly legal for a parent process to wait for child processes that have already terminated by the time the parent calls wait, but the kernel must still allow the parent to retrieve its child’s exit status, or learn that the child was terminated by the kernel.wait must fail and return -1 immediately if any of the following conditions is true:
Processes may spawn any number of children, wait for them in any order, and may even exit without having waited for some or all of their children. Your design should consider all the ways in which waits can occur. All of a process's resources, including its struct thread, must be freed whether its parent ever waits for it or not, and regardless of whether the child exits before or after its parent.
You must ensure that Pintos does not terminate until the initial process exits. The supplied Pintos code tries to do this by calling process_wait() (in userprog/process.c) from main() (in threads/init.c). We suggest that you implement process_wait() according to the comment at the top of the function and then implement the wait system call in terms of process_wait().
Implementing this system call requires considerably more work than any of the rest.