The tag has no usage guidance.

learn more… | top users | synonyms

31
votes
4answers
7k views

What's the difference between running a program as a daemon and forking it into background with '&'?

What are the practical differences from a sysadmin point of view when deploying services on a unix based system?
35
votes
4answers
5k views

Is there any UNIX variant on which a child process dies with its parent?

I have been studying the Linux kernel behaviour for quite some time now, and it's always been clear to me that: When a process dies, all its children are given back to the init process (PID 1) ...
10
votes
5answers
4k views

Process descendants

I'm trying to build a process container. The container will trigger other programs. For example - a bash script that launches running background tasks with '&' usage. The important feature I'm ...
1
vote
1answer
87 views

How to understand the output of tracing running an external command in bash?

In Ubuntu, I run date directly in an interactive bash shell whose pid is 6913. $ date Wed Mar 2 23:57:44 EST 2016 At the same time, I trace the bash shell 6913 from another interactive bash shell ...
63
votes
4answers
15k views

Why do we need to fork to create new processes?

In Unix whenever we want to create a new process, we fork the current process, creating a new child process which is exactly the same as the parent process; then we do an exec system call to replace ...
2
votes
4answers
424 views

What is an open file description?

When you fork a process, the child inherits its parent's file descriptors. I understand that when this happens, the child receives a copy of the parent's file descriptor table with the pointers in ...
1
vote
0answers
59 views

How to understand the output of tracing running an external command in background via strace

In Ubuntu, I run date & in an interactive bash shell whose pid is 6913, and at the same time, trace the bash shell from another interactive bash shell by strace. The output of tracing the first ...
33
votes
2answers
4k views

Why is the default process creation mechanism fork?

The UNIX system call for process creation, fork(), creates a child process by copying the parent process. My understanding is that this is almost always followed by a call to exec() to replace the ...
14
votes
3answers
10k views

When do you need 'nohup' if you're already forking using '&'?

First this question is related but definitely not the same as this very nice question: Difference between nohup, disown and & I want to understand something: when I do '&', I'm forking ...
13
votes
1answer
2k views

How does a fork bomb work?

WARNING DO NOT ATTEMPT TO RUN THIS ON A PRODUCTION MACHINE In reading the Wikipedia page on the topic I generally follow what's going on with the following code: :(){ :|:& };: excerpt of ...
10
votes
4answers
5k views

How do fork and exec work?

I don't have much experience, just trying to get involved into the processes how do they interpret to hardware from user level. So when a command is fired from a shell, fork() inherits a child ...
11
votes
2answers
6k views

What's the difference between fork() and vfork()?

I would like to understand in detail the difference between fork() and vfork(). I was not able to digest the man page completely. I would also like to clarify one of my colleagues comment "In ...
5
votes
4answers
331 views

Coloring output of forked processes

I have a runscript that starts some processes and sends them to the background mongod & pid_mongo=$! redis-server & pid_redis=$! # etc. All these processes then output concurrently to ...
5
votes
2answers
3k views

Fork call and recursion

#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { fork(); fork(); fork(); puts("hi"); return 0; } This program ...
5
votes
1answer
242 views

Why is the following command killing a system?

Anyone understand the following code , running in bash ? :(){ :|:& };: It seems to be a "fork" bomb on Linux.
1
vote
1answer
128 views

fork() and exec() confusion

As when we do fork on current process, our process as parent process generates child process with same characteristics but different process IDs. So after that, when we do exec() in our child process, ...
3
votes
2answers
724 views

When vfork is called is parent process really suspended?

As much as I know when vfork is called child process uses the same address space as that of the parent and any changes made by the child process in parents variables are reflected onto parents ...