← BYTES
Unix IPC·Starter·Ref: 15.1.6

What two syscalls are typically used together to create a new process and then have it run a different program?

Have a question about this video? Mention reference 15.1.6 when you contact us.

a.open() and close()
b.read() and write()
c.fork() to create a child process, then exec() (one of the execve-family calls) to replace that child's memory image with a new program
d.malloc() and free()
fork() duplicates the calling process into a new child (initially running the exact same code), and exec() then replaces that child's entire memory image with a different program -- this fork-then-exec pattern is the standard Unix way to launch a new program, and it's also the natural place to set up IPC: file descriptors created before fork() (a pipe end, for example) are inherited by the child automatically.

Find this on YouTube & Instagram

Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:

#BYTES#BYTES1516#UnixIPC