Linux Application Development-process Managementa process
One component is the kernel object that the operating system uses to manage the process, and the kernel object is the place where the system uses the statistical information to hold the process.
1 each process has a parent process
2 The child process terminates, the parent process is notified and can go to the exit state of the process
3 namespaces are similar to C + + namespace
4 process Groups
Each process has a process group that has a process group number = leader PID
Process Group leader-groupleader
5 sessions Session is a collection of one or more process groups
Setsid can create session periods
6 Related conversions
2^10 = 1K
2^20 = 1M
2^30 = 1G
2^32 = 2^30 * 2^2 = 4G
Two virtual memory
The program uses only part of the physical memory and the program itself is loaded in virtual memory
Three-process features
Linux features: Multi-tasking, multi-process, high concurrency, ticks
Independent of each other, memory isolated, dependent on virtual memory
Four-process scheduling
Fragmentation of process run time (very short interval, microseconds)
Five Process life cycle
Android: Foreground visible service background empty
Linux: Run hangs extinct
Five corresponding concepts
The zombie process is reclaimed by init (System largest process 0 boot 1 init 2 kernel thread daemon This 3 is the core process) process
process tree: init->
Process Management Calls
Process table
Process creation and destruction
Process switching
Seven creating a process
Copy parent Process
Create a new process
Eight corresponding functions
Getpid ()
Getppid ()
System ()
Fork creates the contents of the parent process copy of the child process, but the address differs from the process
Exit () clears the cache when exiting
_exit () does not clear the cache
Wait
Waitpid
Sleep
Linux application Development-process management