开发者社区> 问答> 正文

linux vfork 进程的结果出现奇怪的问题

screenshot
screenshot

结果

[root@localhost labtwo]# ./diffork 
fork is different with vfork
 child process is running!
child process is running!
child process is running!
8,      4
parent process is running
parent process is running
parent process is running
parent process is running
parent process is running
13,     11345274

最后的父进程var的值不应该是9吗怎么会是11345274 谁能帮忙解一下疑惑?谢谢了
同问0 |浏览269| 收藏0 |分享

展开
收起
杨冬芳 2016-07-13 17:20:26 2076 0
1 条回答
写回答
取消 提交回答
  • IT从业

    首先失败应该返回-1, 然后父进程的var应该是没有初始化

    2019-07-17 19:55:53
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Alibaba Cloud Linux 3 技术揭秘 立即下载
Alibaba Cloud Linux 3 发布 立即下载
ECS系统指南之Linux系统诊断 立即下载