Sponsored Content
Top Forums Programming pipe read and write with many forked children Post 61796 by steveneliuk on Tuesday 8th of February 2005 06:24:26 PM
Old 02-08-2005
pipe read and write with many forked children

I know how to read and write if i have a forked process with only one child. However what is involved with reading and writing with many forked processes. Say one parent that forks 5 children, and needs to communicate with all 5 in half duplex.

int temp[2], counter=0;

do{
pipe(temp);

if(fork()>0){
//store values of temp in a 2 dimensional array then re-index the array @ counter.
}
counter++
}while(counter<5);


Then if i access each the 2 dimensional array at location array[0][1] i cold write to child 1, and read child 1 at array[0][0];

Is there an easier way?

Im gong to implement this shortly, please let me know if im on the right track.

thanks for your time,

New to unix and c/
 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Wall, Write, select users, pipe a text file, HELP Before I'm Bald!

OK... I'm fairly new to unix having the admin handed to me on a platter w/almost no training. However, being a programmer, I do pick up things fairly easily, but this one is getting the best of me. I have a unix server that runs multiple versions of the same ERP system, hand crafted for our... (1 Reply)
Discussion started by: chimodel
1 Replies

2. Shell Programming and Scripting

Find all files with group read OR group write OR user write permission

I need to find all the files that have group Read or Write permission or files that have user write permission. This is what I have so far: find . -exec ls -l {} \; | awk '/-...rw..w./ {print $1 " " $3 " " $4 " " $9}' It shows me all files where group read = true, group write = true... (5 Replies)
Discussion started by: shunter63
5 Replies

3. Shell Programming and Scripting

Write in a file with pipe also in same line

hi, i want to write in a file the output of one command and pile also the same output like ls -lrt > some_file | wc -l (9 Replies)
Discussion started by: narang.mohit
9 Replies

4. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

5. UNIX for Dummies Questions & Answers

echo: write error: Broken pipe ??

I want to try the unix pipe, the command is like this: echo new | find . the standard output of the echo should be "new", then I guess find command will use this output as input to find the file named "new". But the output is all the file names in my current dir, the last line is "echo: write... (5 Replies)
Discussion started by: andrewust
5 Replies

6. UNIX for Dummies Questions & Answers

Write to file using tail -f through a pipe to grep

Hi -- I'm looking to write to a file after piping output from tail -f through to grep: #write to a file for all lines with "searchtext" within in error_log: Expand|Select|Wrap|Line Numbers tail -f /var/error_log | grep searchtext > output.txt The above command... (2 Replies)
Discussion started by: ndedhia1
2 Replies

7. Programming

Multiple children and single pipe

Greetings everyone, I need a bit of help in solving the following problem: I'm given an array of numbers and I have to compute the sum of the array elements using n processes, and the inter process communication has to be done with pipes(one pipe, to be exact). I managed to solve the problem... (14 Replies)
Discussion started by: ephesos
14 Replies

8. UNIX for Advanced & Expert Users

write failed: Broken pipe

The "write failed: Broken pipe" message is reported by the file sending PC which run my writed network device driver while 500MB or 900MB is sended! What does the message mean? Does this mean there is a bug in my driver? li,kunlun (11 Replies)
Discussion started by: liklstar
11 Replies

9. Shell Programming and Scripting

How to avoid ssh :Write failed: Broken pipe?

Hello, I am trying to run some code on Matlab over ssh . The code takes around 5-6 hours to complete. so after giving the command to run it , I locked my machine and then went off to sleep at night, only to discover in the morning that I get this message : ...Code running, partial results... (1 Reply)
Discussion started by: ajayram
1 Replies

10. UNIX for Beginners Questions & Answers

One parent, multiple children pipe with fork()

The task I have to do is something along the lines "I receive some input and based on the first character I send it through pipe to one of the children to print". The scheme it is based on is 1->2; 1->3; 1->4; 2 will print all the input that starts with a letter, 3 will print all the input that... (2 Replies)
Discussion started by: Ildiko
2 Replies
GLGETACTIVEATOMICCOU(3G)					  [FIXME: manual]					  GLGETACTIVEATOMICCOU(3G)

NAME
glGetActiveAtomicCounterBufferiv - retrieve information about the set of active atomic counter buffers for a program C SPECIFICATION
void glGetActiveAtomicCounterBufferiv(Gluint program, GLuint bufferIndex, GLenum pname, GLint *params); PARAMETERS
program The name of a program object from which to retrieve information. bufferIndex Specifies index of an active atomic counter buffer. pname Specifies which parameter of the atomic counter buffer to retrieve. params Specifies the address of a variable into which to write the retrieved information. DESCRIPTION
glGetActiveAtomicCounterBufferiv retrieves information about the set of active atomic counter buffers for a program object. program is the name of a program object for which the command glLinkProgram() has been issued in the past. It is not necessary for program to have been linked successfully. The link may have failed because the number of active atomic counters exceeded the limits. bufferIndex specifies the index of an active atomic counter buffer and must be in the range zero to the value of GL_ACTIVE_ATOMIC_COUNTER_BUFFERS minus one. The value of GL_ACTIVE_ATOMIC_COUNTER_BUFFERS for program indicates the number of active atomic counter buffer and can be queried with glGetProgram(). If no error occurs, the parameter(s) specified by pname are returned in params. If an error is generated, the contents of params are not modified. If pname is GL_ATOMIC_COUNTER_BUFFER_BINDING, then the index of the counter buffer binding point associated with the active atomic counter buffer bufferIndex for program is returned. If pname is GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE, then the implementation-dependent minimum total buffer object size, in baseic machine units, required to hold all active atomic counters in the atomic counter binding point identified by bufferIndex is returned. If pname is GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS, then the number of active atomic counters for the atomic counter buffer identified by bufferIndex is returned. If pname is GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES, then a list of the active atomic counter indices for the atomic counter buffer identified by bufferIndex is returned. The number of elements that will be written into params is the value of GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS for bufferIndex. If pname is GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER, GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER, GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER, GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER, or GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER, then a boolean value indicating whether the atomic counter buffer identified by bufferIndex is referenced by the vertex, tessellation control, tessellation evaluation, geometry or fragment processing stages of program, respectively, is returned. NOTES
glGetActiveAtomicCounterBufferiv is available only if the GL version is 4.2 or higher. ERRORS
GL_INVALID_VALUE is generated if program is not the name of a program object for which glLinkProgram() has been called in the past. GL_INVALID_VALUE is generated if bufferIndex is greater than or equal to the value of GL_ACTIVE_ATOMIC_COUNTER_BUFFERS for program. GL_INVALID_ENUM is generated if pname is not one of the accepted tokens. SEE ALSO
glGetProgram(), glGetActiveSubroutineUniform(), glGetActiveSubroutineUniformName(), glGetUniformLocation() COPYRIGHT
Copyright (C) 2011 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/. [FIXME: source] 05/30/2012 GLGETACTIVEATOMICCOU(3G)
All times are GMT -4. The time now is 05:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy