2019-2020-1 20199328 "Linux kernel principle and Analysis" in the seventh week of work

Analysis of Linux kernel process create a new process

2019/10/28 18:34:58

Notes section

  • The first is to view the process descriptor (used to describe the process, its code is relatively large) some content

  • System call Review

    fork, vfork, clone three system calls can create a new process, but also through do_fork to implement the process. Linux creates a new process by copying the parent process and set up pid, set eip in the thread, esp.

  • Browsing the process of creating the relevant code

Experimental part

- Tracking kernel fork function processing procedure

  1. First delete the menu, and clone a new one, and then overwrite test.c file to test the impact from the front, then compiled.
  2. Use help command to view and found more than a fork function creates a child process after execution, you can see both the parent and child processes the information output.
  3. Start debugging, the kernel is loaded, load the kernel symbol table and connect.
  4. Set breakpoints, followed by stops in do_fork, copy_process, dup_task_struct, copy_thread, ret_from_fork, until it can no longer track sys_call

Guess you like

Origin www.cnblogs.com/llj76720197/p/11754253.html