复制进程镜像
来源:互联网 发布:mysql设置唯一约束 编辑:程序博客网 时间:2024/06/11 16:26
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
int main()
{
pid_t pid;
char *message;
int n;
printf("fork program starting\n");
pid=fork();
switch(pid)
{
case -1:
perror("fork failed");
exit(1);
case 0:
message="this is the child";
n=5;
break;
default:
message="this is the parent";
n=3;
break;
}
for(;n>0;n--)
{
puts(message);
sleep(1);
}
exit(0);
#include <unistd.h>
#include <stdio.h>
int main()
{
pid_t pid;
char *message;
int n;
printf("fork program starting\n");
pid=fork();
switch(pid)
{
case -1:
perror("fork failed");
exit(1);
case 0:
message="this is the child";
n=5;
break;
default:
message="this is the parent";
n=3;
break;
}
for(;n>0;n--)
{
puts(message);
sleep(1);
}
exit(0);
}
首先介绍一下,对于我们这种菜鸟学习linux来说,使用ubuntu是一个不错的选择,而且在ubuntu的软件中心有一个编译器codeblock,可以计算出程序运行的时间,很适合搞ACM的学者使用,同时,这种方式和在windows下面很相似,很适合初学者使用,经过前面一系列的准备,现在算是正式的一个开始吧,用fork来复制一个进程,这两个进程分别运行,在codeblock下面运行这个程序,会看到程序结束之后子进程还在执行,具体的运行结果可以自己讲程序复制自己去运行看看.
- 复制进程镜像
- Oracle_镜像复制
- 快照 镜像 复制
- 镜像复制+copy命令+镜像复制案例
- 复制VirtualBox镜像文件
- VirtualBox镜像复制载入
- virtualbox 复制硬盘镜像的方法
- {{Shell}}复制或镜像整个网站
- VirtualBox中VDI镜像的复制
- solaris挂载iso镜像\制作\复制
- SQLServer 数据库镜像+复制切换方案
- ArcGISEngine实现要素镜像复制
- 镜像&AlwaysOn复制的工作原理
- SQLServer 数据库镜像+复制切换方案
- SQLServer 数据库镜像+复制切换方案
- VirtualBox镜像(.vdi)复制备份
- lftp复制文件及镜像
- KVM镜像静态复制实践总结
- Linker and Libraries Guide Chapter 3 Runtime Linker
- Linker and Libraries Guide Chapter 4 Shared Objects
- Linker and Libraries Guide Chapter 5 Application Binary Interfaces and Versioning
- Android Message机制的灵活应用
- Linker and Libraries Guide Chapter 6 Support Interfaces
- 复制进程镜像
- 友元
- Linker and Libraries Guide Chapter 7 Object File Format
- activity的四种加载模式
- Linker and Libraries Guide Chapter 8 Thread-Local Storage
- Linker and Libraries Guide Chapter 9 Mapfile Option
- Linker and Libraries Guide Appendix A Link-Editor Quick Reference
- Linker and Libraries Guide Appendix B Versioning Quick Reference
- Visual Studio的调试技巧【部分】