Road C ++ learning --8

1. What is the procedure?
Compiled binary file
2, what is the process?
Running programs
3, the difference between:
the program consumes disk, not take up system resources, memory, system resources, a program corresponding to a plurality of processes, a process corresponds to a program, process life cycle, there is no program life cycle
4, and single channel program multi-channel program
microscopic serial, parallel macro
5, the process of switching
pending, running, ready, stop
6, MMU role
of virtual and physical memory mapping modify memory access level 0 the most advanced, user space is mapped to the physical independent memory
7, PCB control block binary
state of the process ID, process, information of the virtual address space, the umask mask file descriptor table, the user ID and group ID, the group will draw and process.
8, the environment variable
Key = value
. 9, the environment variable getenv function
10, fork process
pid_t fork () to create a process Return Value: returns a failure -1 twice successfully returned child process parent ID, the child returns 0
getpid () to obtain pid, process id, get the current process
getppid () to get the current process of the parent process the above mentioned id
11, view the process information
PS
- PS the AUX view all processes
- ps ajx can be traced kinship between processes
the kill
- send a signal to the process
- kill -9 pid stop signal SIGKILL
- the -l to see all the kill signal that can be transmitted
12, the process of sharing
the shared reading, copy-on-write
13 family of functions
int execl
int execlp
14, orphaned and zombie
orphans: a parent process hangs , child adoption process is INIT
zombie: hang the child process, the parent process is not recovered
15 sub-process recycling pid_t wait (int * status) block waiting to recover the child resource, came to see the cause of death status parameters, to know why the child died return value returns successful termination ID, else return -1.
16, pid_t waitpid (PID pit_t, Status int *, int Options)

  • pid
    • <Group id -1
    • -1 recovering any
    • 0 recovery and the calling process child process group id within the same group
    • Recovering the specified id 0

  • options
  • return value
    • Set WNOHANG, no child process exits returns 0, have the child returned successfully PID, failure to return -1.
      17,

Guess you like

Origin blog.csdn.net/weixin_43615373/article/details/90576444