struct thread
instead of struct proc
, where each struct thread
has a pointer to a potentially shared struct proc
.
However, in the template there is a one-to-one mapping between threads and processes. Your job is to make that a many-to-one mapping by adding thread management facilities and enforcing correct thread semantics on existing system calls.
fork()
, a process is copied wholesale. A skeleton exists for the system call sys_clone()
. Complete the implementation, to make each of the thread test cases (programs thread1..threadN) work correctly.
As is usually the case, it'll be easier if you do things a step at a time. For thread creation, I would suggest:
thread3
crashes at the end of its run. When the created thread has finished running f() it tries to return to the calling function, but it doesn't exist.
exit()
system call to reflect this behavior.
Without this fix, thread3b
will crash after it has finished executing the function f()
, as the main thread calls exit() before f() is done. exit()
then frees the process memory, while f()
continues to execute. To fix this, exit()
should kill all threads before freeing memory.
exit()
, thread4
will finish before f() gets a chance to do its job. The thread4
code includes a call to thread_join(). Here, the main thread should wait for the other thread to finish before continuing.
Provide a real implementation of thread_join(), including a new system call sys_join()
to support this behavior.
Copyright 2016 The Board of Trustees of the University of Illinois.webmaster@cs.uic.edu |
WISEST Helping Women Faculty Advance Funded by NSF | ![]() | ![]() |