Hang a Process


 
Thread Tools Search this Thread
Operating Systems Linux SuSE Hang a Process
# 1  
Old 06-29-2004
Hang a Process

this may be something trivial to many of you, but is there a way to purposely cause a process to hang?
# 2  
Old 06-29-2004
Depends on how you define "hang".... how about
kill -STOP $pid
# 3  
Old 06-29-2004
"hanging" is a process that is still running, but wouldn't accept any signal and still consuming resources. I know this may be caused by the parent process not waiting for the child process to send its info before the parent is shutting down. But that is usually is caused by accident. I want to write a program/script that would intentionally cause a specified process to hang.

thank you much for your reply!
# 4  
Old 06-30-2004
Quote:
Originally posted by Driver
You can attach to it using a debugger.

Code:
/home/stdnrw [0]> cat new.c
int
main(void) {
        sleep(10);
        puts("hello");
}
/home/stdnrw [0]> cc new.c -o new
/home/stdnrw [0]> ./new &
[1] 2468
/home/stdnrw [0]> gdb new 2468
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-suse-linux"...
Attaching to program: /home/stdnrw/new, process 2468
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
0x400d6145 in nanosleep () from /lib/libc.so.6
(gdb) detach
Detaching from program: /home/stdnrw/new, process 2468
(gdb) hello

[1]    Exit 6                        ./new

(gdb)

I'm not sure I understand what you mean. Could you please further explain? Thanks.
# 5  
Old 06-30-2004
I sincerely apologize for my confusion in regard to children processes. I'm new to this and is still learning...I tried to read too many resources and then ended up getting confused. Smilie

Thank you so much for your suggestion and explanation, it makes more sense to me now. Smilie
# 6  
Old 06-30-2004
Quote:
Originally posted by Driver

int
main(void) {
sleep(10);
puts("hello");
}
Driver, i compiled this code and got "error 1705: Function prototypes are an ANSI feature." what is this mean?

Thanks.
# 7  
Old 06-30-2004
Quote:
Originally posted by laila63
Driver, i compiled this code and got "error 1705: Function prototypes are an ANSI feature." what is this mean?

Thanks.
i got it, was confused with the syntax of C & C++. Fixed it and it works like a charm Smilie Again, thank you so much for your help.
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... (6 Replies)
Discussion started by: naveeng
6 Replies

2. 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

3. 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

4. Red Hat

Boot process hang

Hello, Sometime i see that the boot process hangs. I am using rhel 6.2. At that time in the console i see Probing EDD (edd=off to disable)... SSH service seems to be started but i can't login... ssh logs (last lines) in verbose mode level 3: debug2: we did not send a packet,... (3 Replies)
Discussion started by: @dagio
3 Replies

5. IP Networking

netstat -a hang

Hi, on our Solaris 10 servers, one day 'netstat -a' command return very slow after TCP output, wait 5 minute on this line - SCTP: Local Address Remote Address Swind Send-Q Rwind Recv-Q StrsI/O State ------------------------------- ------------------------------- ------ ------ ------ ------... (6 Replies)
Discussion started by: ora_dba
6 Replies

6. Shell Programming and Scripting

Script to Kill process which is in hang state

Hi, Can anyone help to create a script that will kill the process which is in hang state. (1 Reply)
Discussion started by: A.Santhosh
1 Replies

7. Solaris

Bind hang up when process is reaching to 500 Mb, Solaris 10u8, Sun T5140

Hi all, I use latest bind 9.6.1, brand-new T5140 Sun Server, 10u8 Solaris OS, Mar-2010 OS patch to configure a caching dns server. But bind always hang up when process/cache is reaching to 500 Mb ( Though 'prstat -a' check ) Can anyone help me a solution for this problem, i will greatly... (0 Replies)
Discussion started by: tien86
0 Replies

8. UNIX for Advanced & Expert Users

make a foreground running process to run background without hang up

I've tried this a long time ago and was successful but could not remember how i did it. Tried ctrl+Z and then used bg % could not figure what i did after to keep it no hangup - not sure if used nohup -p pid, can u plz help me out if this can be done. Any help will be appreciated. (12 Replies)
Discussion started by: pharos467
12 Replies

9. Shell Programming and Scripting

Ftp hang

Im making a script that goes out to about 200 servers and grabs log files daily and need to make sure the script gets all the servers it can even if one is out. I am ftp'ing the files over but if i cant connect to the server the process looks like it dies and the script is finished. (4 Replies)
Discussion started by: rcunn87
4 Replies

10. Programming

child process hang up, help!!!

Hi all, There is a pearent process with 3 child processes, they work perfect. Pearent process read from file and separate data by blocks and send it to child processes, after that pearent read the result of work and just print it out to standart output. All interprocess communication maded through... (2 Replies)
Discussion started by: prodigal
2 Replies
Login or Register to Ask a Question