The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
1answer
13 views

steam: fork: retry: No child processes

I use the following script to launch steam: #!/bin/bash # Export so all child processes are affected as well export LD_PRELOAD='/usr/$LIB/libstdc++.so.6' export DISPLAY=:0 export LIBGL_DEBUG=verbose ...
13
votes
4answers
708 views

How to pass a password to a child process?

Passing a password on command line (to a child process started from my program) is known to be insecure (because it can be seen even by other users with ps command). Is it OK to pass it as an ...
18
votes
3answers
4k views

Fork vs Clone on 2.6 Kernel Linux

I have some confusion regarding fork and clone. I have seen that: fork is for processes and clone is for threads fork just calls clone, clone is used for all processes and threads Are either of ...
65
votes
6answers
17k 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 ...
5
votes
2answers
12k views

fork: retry: Resource temporarily unavailable

While I am connecting to my server I get, -bash: fork: retry: Resource temporarily unavailable -bash: fork: retry: Resource temporarily unavailable -bash: fork: retry: Resource temporarily ...
2
votes
1answer
4k views

Apache cannot fork: cannot allocate memory

I am running apache on Fedora with mod_perl. The server forks a process to send an email frequently - and the fork exits. Suddenly, I got: Cannot fork: Cannot allocate memory. There was plenty of ...
1
vote
0answers
33 views

Theoric: How to kill a forever forking process?

Let's say you have a process that forks every time it has the chance. It launches itself in niceness -20, so it forks faster than you can kill it. Also, it remembers its childrens and it parents, so ...
10
votes
1answer
290 views

How does ksh93 avoid forks in command substitution

Given cmd='fun(){ echo "$@"; }; fun $(fun $(fun hi))' shells tend to need to make 2 forks to make it happen strace-f(){ strace -f "$@" 2>&1; }; for sh in dash bash zsh ksh; do ...
2
votes
1answer
55 views

Putting subshell in background vs putting command in background

I have two bash scripts that try to check hosts that are up: Script 1: #!/bin/bash for ip in {1..254}; do ping -c 1 192.168.1.$ip | grep "bytes from" | cut -d" " -f 4 | cut -d ":" -f 1 & ...
-1
votes
2answers
77 views

Does the Ubuntu Linux 16.04 daemon function execute a double fork? [closed]

Does the Ubuntu Linux 16.04 daemon function execute a double fork? If so, why is a double fork necessary?
11
votes
1answer
210 views

Why do these bash fork bombs work differently and what is the significance of & in it?

I get how a normal fork bomb works, but I don't really understand why the & at the end of the common bash fork bomb is required and why these scripts behave differently: :(){ (:) | (:) }; : and ...
1
vote
1answer
92 views

(SOS) -bash: fork: Not enough space on every command

I'm running SmartOS in a SmartOS Zone, and now any bash command return me -bash: fork: Not enough space Works only ulimit How to fix it?
0
votes
2answers
64 views

Daemon to: receive messages -> run background command -> manage number of tasks running simulatenously?

Looking for a unix program that runs in the background (daemon), that: can receive arbitrary (JSON) messages. On receiving a message, run a specified command. Has option for limiting number of ...
11
votes
3answers
913 views

When a process forks is its virtual or resident memory copied?

The standard way of making new processes in Linux is that the memory footprint of the parent process is copied and that becomes the environment of the child process until execv is called. What memory ...
0
votes
1answer
53 views

What will happen if I run a “fork bomb” on my machine?

What will happen after using the fork bomb command?
1
vote
0answers
78 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 ...
1
vote
1answer
110 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 ...
0
votes
2answers
48 views

Parent process always printing output after child

Consider the following code running under Solaris 11.3: int main(void) { pid_t pid = fork(); if (pid > 0) { printf("[%ld]: Writing from parent process\n", getpid()); } if (...
0
votes
0answers
66 views

Compare running a command directly and in background

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. By using tracing, I would like to ...
0
votes
0answers
76 views

What differences are between running a command in shell with and without `bash -c`?

What is the difference of running a command directly in a bash shell, and run it as bash -c <command> in a bash shell? The purpose of my question is that I would like to know how a command is ...
0
votes
2answers
95 views

Why doesn't strace report that the parent shell fork() a child process before execve() a command?

strace runs a specified command until it exits. It intercepts and records the system calls which are called by a process and the signals which are received by a process. When running an external ...
7
votes
2answers
11k views

How does copy-on-write in fork() handle multiple fork?

According to Wikipedia (which could be wrong) When a fork() system call is issued, a copy of all the pages corresponding to the parent process is created, loaded into a separate memory location by ...
1
vote
1answer
48 views

Process Flag 1: Forked but didn't exec (use case?)

In the man page for ps, it lists process flag 1 as "process forked but didn't exec". What would be a common use case/situation for a process to be in this state?
1
vote
3answers
102 views

On `fork`, children processes, and “subshells”

This post is basically a follow-up to an earlier question of mine. From the answer to that question I realized that not only I don't quite understand the whole concept of a "subshell", but more ...
0
votes
1answer
395 views

Process tree using fork() [closed]

I am given the task of creating this process tree in C using fork, if and else: |_____1___ |___2__ | |_4_ | |_3_ | | | | | Or as a pstree like drawing: p(0)─┬─p(1)───p(3) ├─p(2) ...
3
votes
1answer
344 views

Get output of `posix_spawn`

So I can run a process in Unix / Linux using POSIX, but is there some way I can store / redirect both the STDOUT and STDERR of the process to a file? The spawn.h header contains a deceleration of ...
11
votes
2answers
7k 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 ...
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 ...
11
votes
5answers
17k views

How to totally fork a shell command that is using redirection

I've written quite a few shell scripts over the years (but I'm certainly not a sysadmin) and there's something that always caused me troubles: how can I fork a shell command immune to hangups in the ...
3
votes
1answer
74 views

GDB hangs forever on Solaris

GDB seems to hang everytime when I try run command from gdb prompt. When I ran ps, there are two gdb processes that have been spawned and pstack reveals the following - 15:47:02:/home/stufs1/...
3
votes
4answers
76 views

Who forks the processes of piped commands in the shell?

Consider this command in the shell : ls|less Now we know that ls and less are run as two different processes. We know that the shell forks and creates a child process which load the ls program using ...
2
votes
1answer
313 views

How can two identical virtual addresses point to different physical addresses?

Following a fork() call in Linux, two processes (one being a child of the other) will share allocated heap memory. These allocated pages are marked COW (copy-on-write) and will remain shared until ...
2
votes
1answer
329 views

Why does a “child” process finish before its parent?

This is the code example given: # include <stdio.h> # include <unistd.h> void main() { static char *mesg[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}; int display(char *)...
5
votes
4answers
347 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 ...
1
vote
1answer
139 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, ...
2
votes
3answers
248 views

How to find out the process(es) that forks a lot?

Recently I got an load-too-high issue on our server. I watched top for like half an hour to find out that it was Nagios that forked a lot of short-lived processes. After bouncing Nagios, everything ...
1
vote
1answer
464 views

Launch Spark in Foreground via Supervisor

We have a spark cluster that launches via supervisor. Excerpts: /etc/supervisor/conf.d/spark_master.conf: command=./sbin/start-master.sh directory=/opt/spark-1.4.1 /etc/supervisor/conf.d/...
0
votes
1answer
200 views

Why signal function is not able to call my signal Handler? [closed]

Here I have written a signal handler function named as handler Correspondingly this handler is registered to kernel using the signal function that will be invoked when SIGCHLD signal is generated by ...
-5
votes
1answer
79 views

How fork() is executed in logical operator? How many times “Hi” is printed ? How? [closed]

#include <stdio.h> #include <unistd.h> int main() { (fork() && fork()) || (fork() && fork()); printf("Hi...\n"); return 0; }
1
vote
1answer
144 views

Why does this bash fork bomb not work on my RHEL VM?

I'm running a RHEL 6.5 VM in a VMware ESXi environment and accessing it through the vSphere Web Client virtual console (in my browser). I wanted to crash this machine on purpose and executed :(){ :|...
4
votes
1answer
599 views

what does it mean 'fork()' will copy address space of original process

I'm studying 'operation system concepts' on my own and I'm studying the chp3. process part. There is an example where the 'fork()' function is called and depending of the returned pid value like the ...
2
votes
4answers
487 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 ...
16
votes
3answers
11k 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 right?...
11
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 ...
2
votes
1answer
429 views

SSH fork kills connection

I am using a linux script which has the task of forwarding control of the system to remote support. In this script one of the commands is a ssh port forward command that will forward the port of the ...
3
votes
1answer
3k views

Program stall under user but runs under root

I am running R job under a normal user john and root. Interestingly, the program stalls under john user but runs quickly under root. Using strace, I found that when john runs the R, the process stalls ...
3
votes
1answer
3k views

fork() and how signals are delivered to processes

I program that I wrote in C fork()'s off a child process. Neither process will terminate. If I launch the program from the command line and press control-c which process(es) will receive the interrupt ...
4
votes
3answers
9k views

Fork bomb on a Mac?

I just learned about a fork bomb, an interesting type of a denial of service attack. Wikipedia (and a few other places) suggest using :(){ :|:& };: on UNIX machines to fork the process an infine ...
16
votes
3answers
4k views

Does fork() immediately copy the entire process heap in Linux?

A fork() system call clones a child process from the running process. The two processes are identical except for their PID. Naturally, if the processes are just reading from their heaps rather than ...
1
vote
1answer
181 views

When parent, child and grandchild processes share a page how does copy-on-write work?

If the child tries to write, it gets a new copy of the page (which is no longer write protected), does the grandchild point to that new page or the old one (which the parent holds)?