Top "Fork" questions

The `fork()` function is the Unix/Linux/POSIX way of creating a new process by duplicating the calling process.

Specifically, how does fork() handle dynamically allocated memory from malloc() in Linux?

I have a program with a parent and a child process. Before the fork(), the parent process called malloc() and …

c linux malloc heap fork
Substitute for forking in windows

I've been following Beej Networking guide and in the server section there is portion of code where it has called …

c++ winapi gcc winsock fork
How does pcntl_fork work in PHP?

I'm confused about pcntl_fork in PHP. I think it does multi-threading, but how does it work and how would …

php fork pcntl
Handling errors from execvp()

I am a little confused about how to handle errors from execvp(). My code so far looks like this: int …

c unix fork wait execvp
Is it safe to fork from within a thread?

Let me explain: I have already been developing an application on Linux which forks and execs an external binary and …

c++ linux multithreading process fork
Prevent file descriptors inheritance during Linux fork

How do you prevent a file descriptor from being copy-inherited across fork() system calls (without closing it, of course)? I …

linux fork
In C, how do I redirect STDOUT_FILENO to /dev/null using dup2 and then redirect back to its original value later?

I have an assignment I'm working on and I'm having difficulty finishing it. The idea is to write a program …

c fork stdout dup2 dup
How do I tell valgrind to memcheck forked processes?

I have a process x that I want to check for leaks with valgrind. The problem is that x is …

c++ c linux fork valgrind
Create zombie process

I am interested in creating a zombie process. To my understanding, zombie process happens when the parent process exits before …

c linux operating-system fork zombie-process
Bitbucket: Update a fork to merge changes of master repo?

I am working with a bitbucket git repo I have read-only access to, so I created a fork to work …

git fork dvcs bitbucket