Create a process:/* ******************* * Function: Create a new process by copying the current process (as with the parent process) and performing the same position *pid_t: generally 16-bit signed integer number, not enough to typedef * Return
Pthread_create is a thread function created in a Unix environment.
Specific format:
# Include
Int pthread_create (pthread_t * restrict TIDP, const pthread_attr_t * restrict ATTR, void * (* start_rtn) (void *), void * restrict Arg );
Return Value:
Function Description:
Getpid returns the current process ID, and getppid returns the parent process ID.
Usage:# Include # Include
Pid_t getpid (void );Pid_t getppid (void );
Example:
# Include # Include # Include
int main (void) {
Pthread_create is a thread function created in a UNIX environment.Specific format: # Include Int pthread_create (pthread_t * restrict tidp, const pthread_attr_t * restrict attr, void * (* start_rtn) (void *), void * restrict arg );Return Value: If
(1) Basic Process Environment
A process is an execution of a program. It is a program that runs in its own virtual address space and has independent functions. Processes are the basic unit for allocating and releasing resources. When a program is
Zookeeper
1 fork () function
The sub-process copies the 0-3g space of the parent process and the PCB in the parent process kernel, but the ID number is different. A fork call returns two times at a time, which has the following features:
A: The
I. Introduction to fork
A process, including code, data, and resources allocated to the process. The fork () function creates a process that is almost identical to the original process through system calls, that is, the two processes can do
31. Communication between mutex lock and process, 31 mutex lock Process
We have done multi-process concurrency before, so have you found any problems. If multiple processes share the same data, for example, what will happen if you want to view and
EXEC1#include #include int main (){CHAR*ARGLIST[3];ARGLIST[0] = "ls";ARGLIST[1] = "-L";ARGLIST[2] = 0;//nullprintf ("* * * ~ to exec ls-l\n");EXECVP ("ls", arglist);printf ("* * * * ls is done. Bye ");return 0;}The EXEC system call clears the
exec1.c#include #include int main (){Char *arglist[3];ARGLIST[0] = "ls";ARGLIST[1] = "-L";ARGLIST[2] = 0;//nullprintf ("* * * ~ to exec ls-l\n");EXECVP ("ls", arglist);//The name of the file that matches the parameter is found in the directory
MPs queue
The following is the pipeline implementation file pipe_imp.c, which contains the client and server functions.
Test-pipe implementation header file
1 first is # include:
# Include "cd_data.h"# Include "cliserv. H"
2. We define some values
I. Learning ObjectivesMastering Process ControlMastering the method of signal processingMastering the methods of Pipeline and FIFO for interprocess communicationIi. Learning TasksCompile, run, read, and understand the code in the process.tar.gz
http://blog.csdn.net/jason314/article/details/5640969The fork () call will copy a new process that is almost identical to the current process (except for the fork's return value), each of which has its own space, each with its own local variables,
Transferred from: http://blog.csdn.net/jason314/article/details/5640969First, Fork Introduction knowledgeA process, including code, data, and resources assigned to the process. The fork () function creates a process that is almost identical to the
In the morning I heard people say that part of a program is a kernel state, the other part is User state, how it needs to be. Suddenly wanted to know, the user's program can call the kernel function directly. (now suddenly found that the problem is
In Unix systems, the only way to create a new process is to call the fork system. The process called fork is called the parent process, and the newly created process is called the child process. Syntax format of system call:
PID = fork ();
When
Environment variable Operation function
Char*getenv (const char* name); Get environment variable value
Intputenv (cahr* str); A string of name=value, put it in the environment table, and delete its original definition if name already
Fork function learning:
# Include # Include # Include # Include
Main ()
{
Pid_t PID; pid = fork ();
If (PID
Printf ("error in fork! ");
Else if (pid = 0)
Printf ("I am the child process, my process ID is % DN", getpid ());
Else
Printf ("I am the
Fork,vfork,cloneUNIX standard replication process system calls fork (that is, fork), but Linux,bsd and other operating systems do not only implement this one, specifically, the Linux implementation of three, Fork,vfork,clone (specifically Vfork
Transfer from:: http://blog.csdn.net/jason314/article/details/5640969First, Fork Introduction knowledgeA process, including code, data, and resources assigned to the process. The fork () function creates a process that is almost identical to the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.