Sponsored Content
Special Forums IP Networking Message passing from child to parent using pipes Post 302858007 by Don Cragun on Saturday 28th of September 2013 02:16:38 AM
Old 09-28-2013
Presumably your process' environment includes definitions for all of the variables and non-standard functions you're using in this while loop. Without seeing some of that, we don't have enough context to know what this code would do. But, there is absolutely nothing in this loop that would create a half duplex pipe between two processes.

If I'm reading your code correctly, however, one thing this loop will do is create a large number of processes that will bring your system to a crawl, hit a limit on the number of processes allowed per userID, or both.

Without knowing what the doprocessing() function does, there is no way we can evaluate what this loop will do. I would guess that it is either writing data to the parent that the parent does not read, or it is reading data from its parent that the parent never writes.

Check your local man pages for pipe and for accept.

Consider why you think you want to use while(1) to fork a bunch of children. From the description of your problem it sounds like you only need one parent and one child.
 

10 More Discussions You Might Find Interesting

1. Programming

how to passing message along pipes??

Dear All, Would you tell me how I can passing a message along pipes? I have built a token ring connected with pipes, but I don't know how to pass the message along it through the command line... Thx. Yours, i- (1 Reply)
Discussion started by: iminus
1 Replies

2. Filesystems, Disks and Memory

How hard can it be? ps child/parent

:( Since I'm fairly new to the scene and don't have much experience in shell programming, I decided to check out the net for a useful script or two. What I'm looking for is a script that would let me enter a PID and then show the process tree associated with it. So it would display the (grand-)... (2 Replies)
Discussion started by: velde046
2 Replies

3. Programming

Implementing 2 pipes between a parent and child process

Hi all, I'm trying to write a program that has some data it wants to send through a filter program(in this case tr), and then recieve the output from that filter program. The way I'm trying to do it is by setting up two pipes between the programs and piping the data in through one pipe and back... (2 Replies)
Discussion started by: bwgoudey
2 Replies

4. Shell Programming and Scripting

Parent/Child Processes

Hello. I have a global function name func1() that I am sourcing in from script A. I call the function from script B. Is there a way to find out which script called func1() dynamically so that the func1() can report it in the event there are errors? Thanks (2 Replies)
Discussion started by: yoi2hot4ya
2 Replies

5. Shell Programming and Scripting

Passing a variable from a child script back to the parent

Hi I have written a script using ftp to get files from one server and copy them to 2 dirrerent servers. I wish to call this script from a parent script that will check the number of files copied and run a check sum for each file. As the filenames for the files in the get portion of the script... (3 Replies)
Discussion started by: Andy82
3 Replies

6. Programming

IPC - pipes between parent and child process

Hi guys, I'm having some problem here, I'm studying pipes, and i want to create a shell in C and at this point a don't want to use semaphores, instead I want to use tricks. Straight to the doubt: I've a parent and a child process, and both of them has some code to execute, and the child process... (5 Replies)
Discussion started by: pharaoh
5 Replies

7. Homework & Coursework Questions

Need help with deleting childīs parent and child subprocess

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

8. Shell Programming and Scripting

forking a child process and kill its parent to show that child process has init() as its parent

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

9. Programming

Child threads communicating with main thread via pipes

I have a simple client/server program I am using for learning purposes. I have it setup so that after server is setup and listening it than goes into a loop where it accepts incoming client connections. After each connection, the client socket is than passed to a thread routine where it can be... (3 Replies)
Discussion started by: Majortom71
3 Replies

10. Shell Programming and Scripting

Passing key column from parent to child records

Hi Forum. I have this challenging issue that I'm hoping someone can help me. I have a file that contains 3 different types of segments (AM00, AM01, AM32) in a hierarchy structure and I want to be able to pass the column key from the parent record to the children records. AM00 - parent key:... (13 Replies)
Discussion started by: pchang
13 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)
All times are GMT -4. The time now is 06:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy