Translation

(itstool) path: sect1/para
A process may terminate by executing an <emphasis>exit</emphasis> system call, sending 8 bits of exit status to its parent. If a process wants to communicate more than a single byte of information with its parent, it must either set up an interprocess-communication channel using pipes or sockets, or use an intermediate file. Interprocess communication is discussed extensively in Chapter 11.
0/3930
Context English Portuguese (Brazil) State
_
external ref='fig1' md5='__failed__'
 
+----------------+ wait +----------------+
| parent process |---------------------------------&gt;| parent process |---&gt;
+----------------+ +----------------+
| ^
| fork |
V |
+----------------+ execve +----------------+ wait +----------------+
| child process |-------&gt;| child process |-------&gt;| zombie process |
+----------------+ +----------------+ +----------------+
 
<imageobject> <imagedata fileref="fig1"/> </imageobject> <textobject> <_:literallayout-1/> </textobject> <textobject> <phrase>Process-management system calls</phrase> </textobject>
 
The process lifecycle is depicted in <xref linkend="fig-process-lifecycle"/>. A process may create a new process that is a copy of the original by using the <emphasis>fork</emphasis> system call. The <emphasis>fork</emphasis> call returns twice: once in the parent process, where the return value is the process identifier of the child, and once in the child process, where the return value is 0. The parent-child relationship induces a hierarchical structure on the set of processes in the system. The new process shares all its parent's resources, such as file descriptors, signal-handling status, and memory layout.
 
Although there are occasions when the new process is intended to be a copy of the parent, the loading and execution of a different program is a more useful and typical action. A process can overlay itself with the memory image of another program, passing to the newly created image a set of parameters, using the system call <emphasis>execve</emphasis>. One parameter is the name of a file whose contents are in a format recognized by the system -- either a binary-executable file or a file that causes the execution of a specified interpreter program to process its contents.
 
A process may terminate by executing an <emphasis>exit</emphasis> system call, sending 8 bits of exit status to its parent. If a process wants to communicate more than a single byte of information with its parent, it must either set up an interprocess-communication channel using pipes or sockets, or use an intermediate file. Interprocess communication is discussed extensively in Chapter 11.
 
A process can suspend execution until any of its child processes terminate using the <emphasis>wait</emphasis> system call, which returns the PID and exit status of the terminated child process. A parent process can arrange to be notified by a signal when a child process exits or terminates abnormally. Using the <emphasis>wait4</emphasis> system call, the parent can retrieve information about the event that caused termination of the child process and about resources consumed by the process during its lifetime. If a process is orphaned because its parent exits before it is finished, then the kernel arranges for the child's exit status to be passed back to a special system process <emphasis>init</emphasis>: see Sections 3.1 and 14.6).
 
The details of how the kernel creates and destroys processes are given in Chapter 5.
 
Processes are scheduled for execution according to a <emphasis>process-priority</emphasis> parameter. This priority is managed by a kernel-based scheduling algorithm. Users can influence the scheduling of a process by specifying a parameter (<emphasis>nice</emphasis>) that weights the overall scheduling priority, but are still obligated to share the underlying CPU resources according to the kernel's scheduling policy.
 
Signals
Sinais
The system defines a set of <emphasis>signals</emphasis> that may be delivered to a process. Signals in 4.4BSD are modeled after hardware interrupts. A process may specify a user-level subroutine to be a <emphasis>handler</emphasis> to which a signal should be delivered. When a signal is generated, it is blocked from further occurrence while it is being <emphasis>caught</emphasis> by the handler. Catching a signal involves saving the current process context and building a new one in which to run the handler. The signal is then delivered to the handler, which can either abort the process or return to the executing process (perhaps after setting a global variable). If the handler returns, the signal is unblocked and can be generated (and caught) again.
 

Loading…

None

New source string

FreeBSD Doc / books_design-44bsdPortuguese (Brazil)

New source string 9 months ago
Browse all component changes

Glossary

English Portuguese (Brazil)
No related strings found in the glossary.

Source information

Source string comment
(itstool) path: sect1/para
Labels
No labels currently set.
Source string location
book.translate.xml:710
Source string age
9 months ago
Translation file
books/pt_BR/design-44bsd.po, string 146