your code would be more easily readable with tabs , to get them use the
[code]
code here
[/code]
this will look like this:
Code:
code here
Anyway, it seems as though you are entering an infinite while loop "polling" the shared memory for a change in the child. Then you are writing back to the shared memory in said child for another to pick it up. This is all being done without any semaphore protection and therefore it is possible that things could go awry.
At any rate, this polling makes inefficient use of the CPU cycles, IMO. While it gets your assignment done...I just wanted to point out that its probably not an effective way of doing it.
However, it looks like you got it done...congrats.
edit: looks like the child does the shared memory write...this is worse yet.
Last edited by DreamWarrior; 04-19-2004 at 03:35 PM..
Dear all,
suppose that I start a process (named "father"). "father" starts in turns a process called "child" with an execv call (after a fork). In this way "father" will be notified if "chlid" crashes (SIGCHILD mechanism). The problem is:
if "father" crashes, how can I do to be recreate a... (1 Reply)
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)
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)
Hello,
How many child processes are actually created when running this code ?
#include <signal.h>
#include <stdio.h>
int main () {
int i ;
setpgrp () ;
for (i = 0; i < 10; i++) {
if (fork () == 0) {
if ( i & 1 ) setpgrp () ;
printf ("Child id: %2d, group: %2d\n", getpid(),... (0 Replies)
Hello,
How many child processes are actually created when running this code ?
#include <signal.h>
#include <stdio.h>
int main () {
int i ;
setpgrp () ;
for (i = 0; i < 10; i++) {
if (fork () == 0) {
if ( i & 1 ) setpgrp () ;
printf ("Child id: %2d, group: %2d\n",... (1 Reply)
All,
Ok...so I know I *should* be able to control a process's stdin and stdout from the parent by creating pipes and then dup'ing them in the child. And, this works with all "normal" programs that I've tried. Unfortunately, I want to intercept the stdin/out of the scp application and it seems... (9 Replies)
I have a .NET application that remotely starts, stops, and gets status of Windows services and scheduled tasks. I would like to add the capability of starting, stopping, and getting status of remote AIX applications also. Based on some preliminary research, one option may be to use 3rd party .NET... (0 Replies)
I am trying to implement the below using Ksh script on a Lx machine.
There is a file(input_file) with 100K records. For each of these records, certain script(process_rec) needs to be called with the record as input. Sequential processing is time-consuming and parallel processing would eat up... (2 Replies)
is there a universal way of getting the children of a particular process? i'm looking for a solution that works across different OSes...linux, aix, sunos, hpux.
i did a search online and i kept finding answers that were specific to Linux..i.e. pstree.
i want to be able to specify a process... (2 Replies)
Discussion started by: SkySmart
2 Replies
LEARN ABOUT HPUX
getrusage
getrusage(2) System Calls Manual getrusage(2)NAME
getrusage - get information about resource utilization
SYNOPSIS DESCRIPTION
The function provides measures of the resources used by the current process or its terminated and waited-for child processes. If the
value of the who argument is information is returned about resources used by the current process. If the value of the who argument is
information is returned about resources used by the terminated and waited-for children of the current process. If the child is never waited
for (for instance, if the parent has set or sets to the resource information for the child process is discarded and not included in the
resource information provided by The r_usage argument is a pointer to an object of type in which the returned information is stored.
If the current process is multi-threaded, returns the information about the resources used by all the active and the reaped threads/light-
weight processes in the current process if the value of the who argument is If the value of the who argument is in a multi-threaded
process, information returned is the same as it would be for a single-threaded process.
RETURN VALUE
Upon successful completion, returns Otherwise, is returned, and is set to indicate the error.
ERRORS
The function will fail if:
[EINVAL] The value of the who argument is not valid.
SEE ALSO exit(2), sigaction(2), time(1), times(2), wait(1), <sys/resource.h>.
getrusage(2)