-
-
Save binh12A3/6e27bdc1494be7b51d80573db2ddc778 to your computer and use it in GitHub Desktop.
This file contains 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
<< Thread >> | |
- Consume less resource. | |
- In multi-thread, when a thread calls exit() then all the threads will be exited. | |
<< Process >> | |
- The resource is duplicated. | |
- If Parent or Child calls exit(), then it doesn’t affect to the other as Parent and Child process is independent. If one dies, the other still alive. | |
- In case we have a code that can easily cause errors (i.e : open/close file, access to pointer, system call…) And we don’t want our program to be crashed because of that code, then we could separate the process by using fork(). | |
- The parent process will run the main code. | |
- The child process will run the “risky” code. | |
- If the crash happens, the child will die, and the parent process will be still alive. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment