10-29-2008
it must be a program which has written in C (gcc)..This program will use the fork,sleep,wait and write to do the process which i refer up..it must be only about what i refer up,i dont want a big program with many details..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi
I have a script, where i need to execute the follwoing scripts/commands in my script. but those should be executed one by one
cd /aa/205/jams
.cmd/mass_all.sh - -> execution of this will take atleast 20-30mins
cd $HOME/precompile
ant-Ddir.location=$HOME/tomcat/webapps - -> execution of... (1 Reply)
Discussion started by: gkrishnag
1 Replies
2. Shell Programming and Scripting
Did not use 'wait' yet.
How I understand by now the wait works only for child processes, started background.
Is there any other way to watch completion of any, not related process (at least, a process, owned by the same user?)
I need to start a background process, witch will be waiting... (2 Replies)
Discussion started by: alex_5161
2 Replies
3. Shell Programming and Scripting
Hi All,
I have a script which runs 3 scripts. The first script creates two files. The other two scripts should run only when the files are created.
I tried the following for loop , but it is not working. Can someone please help me.
while ; do
# Sleep until file does exists/is created... (4 Replies)
Discussion started by: nua7
4 Replies
4. Red Hat
hi all,
We are trying to run a process in the background and in the process we call fork ;and wait for the child process to finish .We find that the died = wait(&status); happens after 10 seconds randomly and sometimes completes in time (within 1 sec)
This behavior is seen only when the... (0 Replies)
Discussion started by: vishnu.priya
0 Replies
5. Red Hat
hi all,
We are trying to run a process in the background and in the process we call fork ;and wait for the child process to finish .We find that the died = wait(&status); happens after 10 seconds randomly and sometimes completes in time (within 1 sec)
This behavior is seen only when the... (1 Reply)
Discussion started by: vishnu.priya
1 Replies
6. Programming
Hello everybody.I want to make clear that i am not going to ask from anybody to build my asignement but i have a big problem. I can't seem to find anywhere ONE good example on C about what i am trying to do:wall:.I think it is simple. All i ask is one example, even a link is fine.
So, i want to... (1 Reply)
Discussion started by: Cuervo
1 Replies
7. Programming
Hi All,
I have a program for class that needs to do the following:
1. Print the directory entries from the current directory using ncurses
2. Provide a prompt next to each directory entry and allow the user to enter commands that may or may not be about the file
3. Execute those commands in... (1 Reply)
Discussion started by: afulldevnull
1 Replies
8. Shell Programming and Scripting
Hi,
I have a script that run every 10 minutes, from a specific timeframe of the day, for example 0500 - 1900.
The script is some sort of checker script for an application log file and check for errors and email us if there is error/s reported in the log.
At the moment, I schedule it... (1 Reply)
Discussion started by: newbie_01
1 Replies
9. BSD
Hi Experts,
I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state.
On doing cat /proc/<pid>wchan showing the "__init_begin" in the output.
Can you please help me here... (0 Replies)
Discussion started by: naveeng
0 Replies
10. UNIX for Advanced & Expert Users
Hi Experts,
I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state.
On doing cat /proc/<pid>wchan showing the "__init_begin" in the output.
Can you please help me here... (1 Reply)
Discussion started by: naveeng
1 Replies
FORK(2) System Calls Manual FORK(2)
NAME
fork - create a new process
SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
pid_t fork(void)
DESCRIPTION
Fork causes creation of a new process. The new process (child process) is an exact copy of the calling process except for the following:
The child process has a unique process ID.
The child process has a different parent process ID (i.e., the process ID of the parent process).
The child process has its own copy of the parent's descriptors. These descriptors reference the same underlying objects, so that,
for instance, file pointers in file objects are shared between the child and the parent, so that an lseek(2) on a descriptor in the
child process can affect a subsequent read or write by the parent. This descriptor copying is also used by the shell to establish
standard input and output for newly created processes as well as to set up pipes.
The child starts with no pending signals and an inactive alarm timer.
RETURN VALUE
Upon successful completion, fork 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 process, no child process is created, and the global variable errno is set to
indicate the error.
ERRORS
Fork will fail and no child process will be created if one or more of the following are true:
[EAGAIN] The system-imposed limit on the total number of processes under execution would be exceeded. This limit is configuration-
dependent. (The kernel variable NR_PROCS in <minix/config.h> (Minix), or <minix/const.h> (Minix-vmd).)
[ENOMEM] There is insufficient (virtual) memory for the new process.
SEE ALSO
execve(2), wait(2).
3rd Berkeley Distribution May 22, 1986 FORK(2)