Skip to content

Basic UNIX process


In C, use fork() to fork the program into two process (i.e. copy the whole stack, heap, memory, etc.), one is parent and the other is child.

For parent, fork() will return the pid of the child.

For child, fork() will return 0.

Return type: pid_t


wait until the process with a specific pid ends


run an external program other than c

UNIX access

For example:


index 0: file type index 1-3: owner index 4-6: group index 7-9: other

read write execute (rwx)