How can i use fork,sleep,wait and write in a process with father and son..??


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How can i use fork,sleep,wait and write in a process with father and son..??
# 1  
Old 10-25-2008
Bug How can i use fork,sleep,wait and write in a process with father and son..??

Hi..
I was unable to do (gcc code) which refers to the fork,wait,sleep and write..

what i want to do:
A process of father create (fork) a son and will sleep 90 seconds..After this, son process create a grandchild and will sleep 60 seconds..Grandchild process will sleep for 30 seconds..After sleep,each process must write a message about which process is and what is the PID..

Please i want you to help me..thanks for all..
i will wait the answers..
# 2  
Old 10-28-2008
Can you tell me more about your application? What's the purpose of just forking and sleeping?
# 3  
Old 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..
# 4  
Old 10-29-2008
This smells like homework... Google for ipc unix for tutorials.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Process remians in Running state causing other similar process to sleep and results to system hang

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

2. BSD

Process remians in Running state causing other similar process to sleep and results to system hang

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

3. Shell Programming and Scripting

Sleep 600 or fork/spawn a process or daemon?

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

4. Programming

Linux fork, execv, wait question

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

5. Programming

Newbie question on exec,fork, wait,pipe C

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

6. Red Hat

Fork wait in background process - large delay

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

7. Red Hat

Fork wait in background process - large delay

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

8. Shell Programming and Scripting

help in wait or sleep command

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

9. Shell Programming and Scripting

wait command - cat it wait for not-chile process?

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

10. UNIX for Dummies Questions & Answers

wait / sleep what to use???

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
Login or Register to Ask a Question