Created
December 18, 2021 03:29
-
-
Save cho0h5/6d35e4d55cccfe58a966a7158d9b9b92 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
int main() { | |
printf("PID: %d\n", getpid()); | |
pid_t pid = fork(); | |
printf("fork ret: %d\n", pid); | |
return 0; | |
} | |
// PID: 189265 | |
// fork ret: 189266 | |
// fork ret: 0 | |
// fork() | |
// 부모 프로세스에서는 자식 프로세스의 pid를 반환하고 | |
// 자식 프로세스에서는 0을 반환 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment