There are many way to manage each process's pid. Here is the way I do it.
I decided to make minimal modification to
in case anything is ruined. So I only add two things to the thread module. One
is I add a
t_pid field to
struct thread so that
getpid system call is
trivial. Another is I add a call of
thread_alloc to initialize
t_pid. That's it. No more touch on the thread module.