Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Disadvantage of background processes Post 302340014 by Perderabo on Saturday 1st of August 2009 07:25:57 PM
Old 08-01-2009
Normally, to run a command, the shell will fork, that is, it makes a copy of itself. Both copies start to run they both know which is the parent and which is the child. The parent simply waits for the child to finish. The child overlays irself (via the exec() feature) with the disired program. It runs and (we hope) eventually finishes by calling exit. The parent then starts running again and it issues another prompt.

The main difference with a background process it that the parent does not wait. If you need to use that file you are unzipping as input for your next command, then putting the unzip in the background would be inconvienent. You would have to keep checking to see if its done. But if you have another task then there is no problem.

Once you have one program in the background, you could overdo it. Put 25 unzips in the background and the system will slow down. So don't do that.

Some programs want to ask you questions and have you type in answers. Don't put those in the background, they're not suitable background tasks.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Background processes

How do you capture the return code from a background process? I am dumping data to a fifo and then processing it in a c program. I need to know that the sql finished successfully to ensure no missing data. Thanks. ex. sqlplus user/password < get_data.sql > data_fifo.txt & bin/process_data... (2 Replies)
Discussion started by: korndog
2 Replies

2. Shell Programming and Scripting

Running two processes in background

hi there, here's what i need in my korn-shell: ... begin korn-shell script ... nohup process_A.ksh ; nohup process_B.ksh & ... "other stuff" ... end lorn-shell script in plain english i want process A and process B to run in the background so that the script can continue doing... (6 Replies)
Discussion started by: jacob_gs
6 Replies

3. Programming

Background processes in a dummy shell...

Hey guys, I am writing a very simple dummy shell in C++ and I am having trouble getting a process to run in the background. First of all, the shell has to recognize when I input a "&" at the end of the command, then it has to stick it in the background of the shell. I understand that if I want... (6 Replies)
Discussion started by: icer
6 Replies

4. Linux

Question about background processes

Hi! First of all, let me warn you I'm quite new to the world of LINUX and Operating Systems understanding, so that's why I pose these newbie and stupid qustions... Anyway, I'm trying to build my own simple shell in C and I'm getting some problems in implementing the background process ('&')... (10 Replies)
Discussion started by: neimaD
10 Replies

5. SuSE

oracle background processes

I have installed oracle 10g on suse sles9. I do not see oracle background processes. ps -ef|grep ora_ gives me environment variables junk. ps -ef|grep smon does not show anything however database is up and running. Any idea how to tweak that? (1 Reply)
Discussion started by: vijayasawant
1 Replies

6. Shell Programming and Scripting

Keep a certain number of background processes running

I've got a bit of code I'm trying to work on... What i want to happen is ... at all times have four parallel mysql dump and imports running. I found the follow code snippet on the forum and modified it to work by starting four concurrent processes but it waits until all four are done before... (7 Replies)
Discussion started by: dgob123
7 Replies

7. Solaris

About running processes in background

Hi, I need to establish a procedure that will start an application in background each time my remote Solaris server is (re)started. This would be a kind of daemon. I am no sysadmin expert, so I am looking for pointers. How should I proceed? What are the main steps? Thanks, JVerstry (9 Replies)
Discussion started by: JVerstry
9 Replies

8. Shell Programming and Scripting

Background Processes

Ok guys so I have my first dummy shell almost done except for one tiny part: I do not know how to run a process in the background, from the code! I already know how to do that in a normal shell: $ program & However, no clue when it comes to how to program that thing. :eek: A very... (2 Replies)
Discussion started by: Across
2 Replies

9. Shell Programming and Scripting

Need help on background processes

Hi, I have a schell script parent.ksh from which I am calling three background processes a.ksh,b.ksh and c.ksh. Once these three processes completes the next step in parent.ksh should execute. How to achieve this? Please help me.... Thanks... (1 Reply)
Discussion started by: ravinunna
1 Replies

10. UNIX for Advanced & Expert Users

List all background processes

How do I list the process in a Unix based system which are running in background? The following are options that I'm aware of, but they may not be appropiate. a. using ps -ef , and getting records of processes for which STATUS='S'(uninterruptible sleep) b. using jobs -l, and filtering... (5 Replies)
Discussion started by: kumarjt
5 Replies
killall(8)						      System Manager's Manual							killall(8)

NAME
killall - Terminates all processes started by the user, except the calling process SYNOPSIS
/usr/sbin/killall [- | [-]signal_name | -signal_number] /usr/sbin/killall -l FLAGS
The hyphen character (without an argument) sends a SIGTERM signal initially and then sends a SIGKILL signal to all processes that survive for 30 seconds after receipt of the first signal. This gives processes that catch the SIGTERM signal an opportunity to clean up. A signal name, optionally preceded by a hyphen, sends the specified signal to processes. The hyphen character (with a signal number argument) sends the specified signal, either a name, stripped of the SIG prefix (such as KILL), or a number (such as 9). For information about signal names and numbers, see the signal() system call. In the System V habitat, the optional signal number does not have to be preceded with a hyphen (-). Lists signal names in numerical order (as given in the /usr/include/signal.h file), stripped of the common SIG prefix. DESCRIPTION
This command provides a convenient means of killing all processes created by the shell that you control. When started by the superuser, the killall command kills all processes that can be terminated, except those processes that started it, the kernel processes, and processes 0 and 1 (init). Security Configuration This command is modified in all security configurations of the system. EXAMPLES
To stop all background processes that have started, enter: killall This sends all background processes signal 9 (the kill signal, also called SIGKILL). To stop all background processes, giving them a chance to clean up, enter: killall - This sends signal 15 (SIGTERM), waits 30 seconds, and then sends signal 9 (SIGKILL). To send a specific signal to the background processes, enter: killall -2 This sends signal 2 (SIGINT) to the background processes. To list the signal names in numerical order, stripped of the SIG prefix, enter: killall -l This displays a list of signals, which may vary from system to system. FILES
Specifies the command path RELATED INFORMATION
Calls: kill(2), sigaction(2), signal(2) delim off killall(8)
All times are GMT -4. The time now is 03:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy