03-25-2004
Thank you for all your suggestions and resources, just some insight into the problem I am trying to solve, I have to create n process and print the process number to a file m times; this is a sample:
% a.out 5 3 temp
should result in temp having the following contents:
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
Can you think of another solution other than the possibilities discussed.
Thank you,
FG
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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)
Discussion started by: npalmentieri
1 Replies
2. 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
3. Shell Programming and Scripting
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
4. Programming
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)
Discussion started by: green_dot
0 Replies
5. Shell Programming and Scripting
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)
Discussion started by: green_dot
1 Replies
6. UNIX for Advanced & Expert Users
Hi,
Is there a way I can kill all the child processes of a process, given its process id.
Many thanks in advance.
J. (1 Reply)
Discussion started by: superuser84
1 Replies
7. Programming
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)
Discussion started by: DreamWarrior
9 Replies
8. Windows & DOS: Issues & Discussions
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)
Discussion started by: auser1
0 Replies
9. Shell Programming and Scripting
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)
Discussion started by: APT_3009
2 Replies
10. Shell Programming and Scripting
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 SUSE
io::atomicfile
IO::AtomicFile(3) User Contributed Perl Documentation IO::AtomicFile(3)
NAME
IO::AtomicFile - write a file which is updated atomically
SYNOPSIS
use IO::AtomicFile;
### Write a temp file, and have it install itself when closed:
my $FH = IO::AtomicFile->open("bar.dat", "w");
print $FH "Hello!
";
$FH->close || die "couldn't install atomic file: $!";
### Write a temp file, but delete it before it gets installed:
my $FH = IO::AtomicFile->open("bar.dat", "w");
print $FH "Hello!
";
$FH->delete;
### Write a temp file, but neither install it nor delete it:
my $FH = IO::AtomicFile->open("bar.dat", "w");
print $FH "Hello!
";
$FH->detach;
DESCRIPTION
This module is intended for people who need to update files reliably in the face of unexpected program termination.
For example, you generally don't want to be halfway in the middle of writing /etc/passwd and have your program terminate! Even the act of
writing a single scalar to a filehandle is not atomic.
But this module gives you true atomic updates, via rename(). When you open a file /foo/bar.dat via this module, you are actually opening a
temporary file /foo/bar.dat..TMP, and writing your output there. The act of closing this file (either explicitly via close(), or
implicitly via the destruction of the object) will cause rename() to be called... therefore, from the point of view of the outside world,
the file's contents are updated in a single time quantum.
To ensure that problems do not go undetected, the "close" method done by the destructor will raise a fatal exception if the rename() fails.
The explicit close() just returns undef.
You can also decide at any point to trash the file you've been building.
AUTHOR
Primary Maintainer
David F. Skoll (dfs@roaringpenguin.com).
Original Author
Eryq (eryq@zeegee.com). President, ZeeGee Software Inc (http://www.zeegee.com).
REVISION
$Revision: 1.2 $
perl v5.12.1 2005-02-10 IO::AtomicFile(3)