有些时候,由于程序需要,我们会创建相同的进程实例运行在一台服务器上,通常,Windows使用CreateProcess创建子进程,Linux使用fork创建子进程。
创建子进程的函数定义
注:需要关注的参数,如下所示。
lpApplicationName:
The name of the module to be executed(可执行文件名,全路径)
lpCommandLine:
The command line to be executed.(命令行参数)
dwCreationFlags:
The flags that control the priority class and the creation of the process.(控制子进程的窗口存在形式)
lpProcessInformation:
A pointer to a PROCESS_INFORMATION structure that receives identification information about the new process.(存储子进程的进程句柄和线程句柄)
实例1:
/**********************