4

请教一个操作系统进程 fork 相关的问题

 3 years ago
source link: https://www.v2ex.com/t/797564
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  程序员

请教一个操作系统进程 fork 相关的问题

  paranoiddemon · 1 天前 · 1048 次点击

非科班出身,操作系统小白。在看 Operating Systems: Three Easy Pieces 这本书。

里面有一段代码如下:

programresult

看书里的结果以及 fork()系统调用的概念,应该只会输出一遍 hello world,而我自己跑的却运行了两次

我是在 win10 的 wsl debain 上跑的。不知道是否和运行在 windows 上的 wsl 有关?还是什么其他原因?

第 1 条附言  ·  1 天前

wslcentos

有点神奇,上图是 WSL,下图是在另一台服务器上跑的 怀疑是 WSL 的问题。

使用的编辑器是VScode


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK