05-15-2008
# define MAXLINE 1024
char line[MAXLINE];
while( (rv = read(fd2[0], line, MAXLINE)) != 0)
{
// do whatever
}
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I don't follow what these are...
this is what my text says...
"When a process is started, a duplicate of that process is created. This new process is called the child and the process that created it is called the parent. The child process then replaces the copy for the code the parent... (1 Reply)
Discussion started by: xyyz
1 Replies
2. Programming
Hi,
Am new to Linux internals.
I want to use shared memory segment between the parent and the child processess.
if i create a shared memory before fork,the child inherits the attached
shared memory segments but once i call exec in the child process, all attached shared memory segments... (1 Reply)
Discussion started by: rvan
1 Replies
3. Shell Programming and Scripting
Hi,
I haev to devlop a script which when executed will take in a sudo privelege and run a set of commands then will go back to parent shell and execute the rest of the command
But the problem I am facing is that when the script is executed it takes the sudo privelege but it waits for the... (0 Replies)
Discussion started by: ruchirmayank
0 Replies
4. Solaris
Received the Timed out message consistently when I tried to jumpstart an M5000 with:
boot jsnet:speed=1000,duplex=full - install
Made the error go away by adding link-clock parameter:
boot jsnet:speed=1000,duplex=full,link-clock=master - install
"link-clock=master" disables... (1 Reply)
Discussion started by: markoakley
1 Replies
5. Homework & Coursework Questions
1. The problem statement, all variables and given/known data:
I need to make an program that in a loop creates one parent and five children with fork(). The problem i'm trying to solve is how to delete the parent and child of the childīs process.
2. Relevant commands, code, scripts,... (0 Replies)
Discussion started by: WhiteFace
0 Replies
6. Shell Programming and Scripting
Hi everyone
i am very new to linux , working on bash shell.
I am trying to solve the given problem
1. Create a process and then create children using fork
2. Check the Status of the application for successful running.
3. Kill all the process(threads) except parent and first child... (2 Replies)
Discussion started by: vizz_k
2 Replies
7. Windows & DOS: Issues & Discussions
I'm not sure if this is the right place to post this issue...but here goes...
I am converting a set of windows jobs from Control-M to AutoSys r11.3. The same command line is being executed in both systems. The Control-M job runs to compltion in about 1.5 hours, waiting for the entire batch... (3 Replies)
Discussion started by: ajomarquez
3 Replies
8. Shell Programming and Scripting
Hi,
I need to initiate a process script which will start and do some processing and then shuts down. Then i need to other verifications. But the the process takes around 25 to 3o minutes.
One thing i can monitor the nohup.out file for this process where i can wait for shutting down statement to... (3 Replies)
Discussion started by: Prashanth19
3 Replies
9. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
"Your a7.c program should use printf to print a nice message. (You can decide what to say.) Then the process... (9 Replies)
Discussion started by: miniviking10
9 Replies
10. Shell Programming and Scripting
Here is my test code
process = sp.Popen( + ,
bufsize=1,
universal_newlines=True,
stdout=sp.PIPE, stderr=sp.STDOUT,
cwd=src_home)
output, _ =... (2 Replies)
Discussion started by: ezee
2 Replies
vfork(2) System Calls Manual vfork(2)
NAME
vfork - spawn new process; share virtual memory
SYNOPSIS
REMARKS
is a higher performance version of that is provided on some systems where a performance advantage can be attained.
If the calling process is multi-threaded, the newly created child process will only contain one thread. This one thread will be a copy of
the thread calling
differs from only in that the child process can share code and data with the calling process (parent process). This speeds cloning activ-
ity significantly at a risk to the integrity of the parent process if is misused.
The use of for any purpose except as a prelude to an immediate or is not supported. Any program that relies upon the differences between
and is not portable across HP-UX systems.
All HP-UX implementations must provide the entry but it is permissible for them to treat it identically to On some implementations the two
are not distinguished because the implementation is as efficient as possible. Other versions may do the same to avoid the overhead of sup-
porting two similar calls.
DESCRIPTION
can be used to create new processes without fully copying the address space of the old process. If a forked process is simply going to do
an (see exec(2)), the data space copied from the parent to the child by is not used. This is particularly inefficient in a paged environ-
ment, making particularly useful. Depending upon the size of the parent's data space, can give a significant performance improvement over
differs from in that the child borrows the parent's memory and thread of control until a call to or an exit (either by a call to or abnor-
mally (see exec(2) and exit(2)). The parent process is suspended while the child is using its resources.
returns 0 in the child's context and (later) the pid of the child in the parent's context.
can normally be used just like It does not work, however, to return while running in the child's context from the procedure which called
since the eventual return from would then return to a no longer existent stack frame.
The window begins at the call and ends when the child completes its call.
RETURN VALUE
Upon successful completion, returns a value of 0 to the child process and returns the process ID of the child process to the parent
process. Otherwise, a value of -1 is returned to the parent, no child process is created, and is set to indicate the error.
ERRORS
fails and no child process is created if any of the following conditions are encountered:
The system-wide limit on the total number of processes under execution
would be exceeded.
The system-imposed limit on the total number of processes under execution
by a single user would be exceeded.
DEPENDENCIES
Servers
Process times for the parent and child processes within the window may be inaccurate.
Parent and child processes share the same stack space within the window. If the size of the stack has been changed within this win-
dow by the child process (return from or call to a function, for example), it is likely that the parent and child processes will be
killed with signal or
In the window, a call to (see signal(2) that installs a catching function can affect handling of the signal by the parent. The par-
ent is not affected if the handling is being set to or or if is used (see sigaction(2)).
AUTHOR
was developed by the University of California, Berkeley.
SEE ALSO
exec(2), exit(2), fork(2), sigaction(2), wait(2).
vfork(2)