We can use the fork system call to handle the task created by the process. For process creation, you can Sys_clone, Sys_vfork, and Sys_fork. Do_fork. Functions are used internally for these system calls. For the Do_fork function, copy tast_struct, set the kernel stack, and modify some specific data structures. There are also copy_thread functions, which will set the CS and IP for this process. This is maintained in the thread_info of the process. The IP here is set to the Ret_from_fork function (there is a jmp system_exit in Ret_from_frok). Later, the fork system call itself can go into the part of the system_exit part of the previous system call. So the fork system call here will have a process scheduling time. Schedule Compared to their own written multi-channel time slice of the problem, the process of scheduling the approximate process is to find stask_struct linked list, find the process can be used inside, find later, find the inside to keep the IP, here is just set the Ret_from_fork, from here, jmp to System_ Exit, you can ret Restore_all, revert to the parent process that location code, start execution. |