Comments on: Learn and use fork(), vfork(), wait() and exec() system calls across Linux Systems https://www.linuxtechi.com/learn-use-fork-vfork-wait-exec-system-calls-linux/ Sat, 06 Apr 2019 20:03:34 +0000 hourly 1 By: Prashant Nandkar https://www.linuxtechi.com/learn-use-fork-vfork-wait-exec-system-calls-linux/#comment-8913 Sat, 06 Apr 2019 20:03:34 +0000 https://www.linuxtechi.com/?p=8247#comment-8913 Fork() creates a child process that is why it prints two times, one for the parent and other for the child.
As you can see there is fork() call before the “after fork” print statement.

]]>
By: Bogus Honcho https://www.linuxtechi.com/learn-use-fork-vfork-wait-exec-system-calls-linux/#comment-7928 Wed, 06 Mar 2019 21:25:16 +0000 https://www.linuxtechi.com/?p=8247#comment-7928 I tried your first example in a virtual terminal in Linux Mint 19 XFCE, and it produced an error:

l_fork.c:3:1: error: unknown type name ‘Int’; did you mean ‘int’?
Int main(void)
^~~
int

I corrected the ‘Int’ to ‘int’ and ran it again, and this time it produced a slightly different output to yours:

Before fork
after fork
after fork

Why does it produce two ‘after fork’ lines?

]]>