The execution process and debugging of the fork system call

Source: Internet
Author: User

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.

The following shows the basics of debugging

The execution process and debugging of the fork system call

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.