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 starts with a digit and 4 will print everything else. (Example: 12, Anne, **, *a will be printed by 3, 2, 4, 4)
I have quite understood how pipes work between one parent process and one child, but can't figure it out how to make this work, but I have tried, so I'mma attach the code down below. Any tip would be much appreciated.
hi there, im trying to produce this program that would run at first, and when it runs it will fork one child process to a program and then another forking to run this other program, and then another one .
i cant seem to get it right can someone help me please here is what is got so far:
int... (1 Reply)
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, counter=0;
do{
pipe(temp);
... (5 Replies)
Hello, I'm trying to implement a version of a bucketSort (kinda) server/client, but I'm having a VERY hard time on making the server behave correctly, when talking to the children, after it forks.
The server is kinda big (300+ lines), so I won't post it here, but here's what I'm doing.
1)create a... (8 Replies)
Hi, as I understand fork(), it makes a copy of the parent which becomes a child. But is there anyway to make three children for that one parent. So in other words, if I look up the getppid() of the children, I want them to have the same value??
Thanks in advance to any help! (1 Reply)
Hi everyone , after a pipe() system call i've forked and entred into the child process to execve a shell script .the problem here is that when the execve sys call fail , i want to send the error code (eg errno) to the parent process using the pipe writer side p , there is nothing received in the... (4 Replies)
Hello,
I am trying to create a pipe that will direct stdout to in side of the pipe, and stdin to the out side of the pipe - I created two child processes to handle this. However, my pipe doesn't seem to be working correctly. Did I use execv() correctly? Command1 and command2 represent the two... (3 Replies)
Hi gurus can you explain following lines of code ?
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(void)
{
pid_t pid;
int rv;
switch(pid = fork()) {
case -1:
... (7 Replies)
Assume you have such a piece of (more or less pseudo-)code:
if(fork() == 0) {// childprocess
chmod(someProgram, 00777);
exec(someProgram);
} else { // assume it never fails and this is the parent
chmod(someProgram, 00000); // should be executed as soon as possible after the... (5 Replies)
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)
Hi friends,
I have a small question regarding unix system call fork, I hope you will solve my problem. Here is the small program
$ cat fork1.c
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main()
{
int pid;
int x = 0;
x = x + 1;
pid = fork();
if(pid < 0)
{... (2 Replies)
Discussion started by: gabam
2 Replies
LEARN ABOUT HPUX
xtmanagechb
XtManageChildren() XtManageChildren()
Name
XtManageChildren - bring an array of widgets under their parent's geometry management.
Synopsis
void XtManageChildren(children, num_children)
WidgetList children;
Cardinal num_children;
Inputs
children Specifies an array of child widgets. The widgets must all be siblings and must be of class RectObj or any subclass thereof.
num_children
Specifies the number of children in the array.
Description
XtManageChildren() brings a list of widgets created with XtCreateWidget() under the geometry management of their parent. All widgets
(except shell widgets) must be managed in order to be visible. Managing a widget will generally make it visible, unless its
XtNmappedWhenManaged resource is False.
The "Algorithm" section below details the procedure followed by XtManageChildren().
Usage
To manage a single widget, you can use XtManageChild(). To unmanage widgets, use XtUnmanageChild() and XtUnmanageChildren().
If you are going to manage multiple children of the same managed and realized parent, it is more efficient to place those children widget
into an array and call XtManageChildren() just once than it is to manage them individually. The former technique results in only a single
call to the parent's change_managed() method. If you are creating widgets before the widget tree has been realized, however, managing them
one at a time is fine.
Algorithm
XtManageChildren() performs the following:
o Issues an error if the children do not all have the same parent or if the parent is not a subclass of compositeWidgetClass.
o Returns immediately if the common parent is being destroyed; otherwise, for each unique child on the list, XtManageChildren() ignores
the child if it already is managed or is being destroyed, and marks it otherwise.
o If the parent is realized XtManageChildren() does the following:
- Calls the change_managed() method of the widgets' parent.
- Calls XtRealizeWidget() on each marked child that is unrealized.
- Maps each marked child that has its XtNmappedWhenManaged resource True.
The management of children is independent of the creation and ordering of the children. There is no special list of managed children; the
layout routine of the parent should loop through the list of all children and simply ignore those that are not managed (see XtIsManaged()).
Structures
typedef Widget *WidgetList;
See AlsoXtCreateManagedWidget(1), XtIsManaged(1), XtManageChild(1), XtMoveWidget(1), XtRealizeWidget(1), XtSetMappedWhenManaged(1), XtUnman-
ageChild(1), XtUnmanageChildren(1).
Xt - Widget Lifecycle XtManageChildren()