Process fork

[1] What is the process?

  Process is a running program.

[2] What pcb that? what's the effect?

  pcb is a process control block, it contains a variety of information process, is a type of data structure. The system can be implemented to control and manage the process according to the PCB, PCB is the only sign of progress.

[3] What paged memory management, page tables are? In the process, we are using the logical address or physical address? After the introduction of virtual memory have any effect on the execution of the program?

  Page address mapping table in order to achieve achieved, to find the physical block corresponding to each page in memory. Logical address. More secure, you can speed up computer speed

[4] in the program malloc apply 1G memory can not succeed? What judgment based on?

  Energy, because the space in the memory heap malloc application of upward open, the user space up to 3G, 2G also like to remove the stack space, memory size malloc1G complete enough.

Test it on Linux, malloc1.9G == "success malloc2.0G ==" failed malloc1.5G + malloc1.0G == success. When two continuous application fails G, can successfully apply twice.

Features [5] time-sharing system, know what time slice? Concurrency and parallelism of the difference between what?

  Time-sharing system has a multi-channel, interactive, exclusivity and timeliness of features.

Multiple sex: the macro level is more than one person simultaneously use a CPU, is more than one person take turns using the CPU at different times on the microscopic

Interactivity: The user further new demands on system response based on the results (direct user intervention at each step)

Exclusive: users do not feel computer services for others, can only be felt in the whole system is used

Time: the system proposed by the requesting user timely response

Concurrent: each program in turn occupied cpu to run. Parallel: while

[6] state program: ready, running, blocking

[7] What is a zombie? Conditions zombie processes generated? How to avoid zombie processes?

  Son end of the process, the parent process is not over, the parent process can not be the child process exit code, file descriptors, the child process will always exist, but can not kill the process kill -9, so the child process becomes a zombie processes

1. The parent ignores SIGCLD signal; 2. the parent process to capture SIGCLD signal to obtain the exit status of the child in the signal handler.

[8] describe replication processes fork and describes the technology and how to implement copy-on-write?

  fork -> 1. Copy the pcb. 2. Copy the entity. (Collective process in the future to say)

Copy-on-write technology:

  After the fork before exec two processes use the same physical space (memory area), sub-process code segment, data segment and stack are pointing to the physical space of the parent process, that is to say, two different virtual space, However, the physical space corresponding to the same. When the parent and child have to change the behavior of the corresponding segment, and then for the child process corresponding period allocation of physical space, if not for the exec, the kernel data segment will give the child process, the stack segment is allocated corresponding physical space (two have so far each process space, independently of each other), and code segments to continue shared physical space of the parent process (both codes are identical). Exec if because, since two different codes executed code segment will be assigned a separate sub-process of the physical space.   

[9] What is a system call, the difference between what he is and library functions? How to switch the system call from user space to kernel space?

  When the user state to system call number into the register by interrupt, to switch to a kernel state, the operating system the system call number in the first register is read out, and then (the sys_call_table) to find the corresponding function by the system call table achieved, then writes the results back to the user registers.

  To break through the system call to execute kernel-related functions, while the library function is to direct the user to use, does not require core processing.

  User mode and kernel mode switching is realized by the interrupt (interrupt 80).

[10] What signal? How to represent and signal the kernel to achieve?

  In response to the mode signal: signal () transmission mode (corresponding to the mode change signal) signal: kill ()

          1.SIG_DFL default SIGCHLD send the child to the parent process ends

          2.SIG_IGN ignore SIGINT 2 Ctrl + c                                                              

          3.fun custom 15: kill kill -9 not allowed to change the default response mode

          Implementation signals: a long long integer type 32

                            00100000  00000000  00000000  00000000

Structure: signals used to point to specific

32 elements

      0               SIG_DFL  
      15             
     16            SIG_IGN
   
      32           SIG_DFL

 

  

 

 

 

Programming process [13] daemon?

  

 

   

 

Guess you like

Origin www.cnblogs.com/xcb-1024day/p/11220619.html