现在到docker的实施阶段,

其底层的namespace,cgroup应该深入了解了。

其调用的API也慢慢熟悉起来吧。

#include <unistd.h>
#include <stdio.h>

int main() {
    pid_t fpid;
    //int count = 0;
    fpid = fork();
    
    if (fpid < 0) printf("error in fork!");
    else if (fpid == 0) {
        printf("I am child. Process id is %d\n", getpid());
    }
    else {
        printf("I am parent. Process id is %d\n", getpid());
    }

    return 0;
}

Linux API的fork()测试

Linux API的fork()测试

相关文章:

  • 2021-08-05
  • 2022-01-03
  • 2022-12-23
  • 2021-12-20
  • 2021-08-27
  • 2021-06-29
猜你喜欢
  • 2021-08-15
  • 2021-05-10
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
  • 2021-07-27
相关资源
相似解决方案