LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   CPU Usage goes to 100% when pthread_cond_wait is being used (https://www.linuxquestions.org/questions/programming-9/cpu-usage-goes-to-100-when-pthread_cond_wait-is-being-used-372544/)

zen_buddha 10-13-2005 03:48 AM

CPU Usage goes to 100% when pthread_cond_wait is being used
 
Hi All,

The CPU Usage of my process goes to 100% when I am trying to use the
pthread_cond_wait() in my threads. The same is not occuring at my
SuSE Linux 9.1. But, I am getting this problem only at Redhat Enterprise 3.2

The Kernel I am using in Redhat is : 2.4.21-15.ELsmp
The compiler Version I am using is : gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-34)

The SuSE Linux Kernel Version is : 2.6.4-52-default
The compiler version in SuSE Linux is : gcc version 3.3.3 (SuSE Linux)

gdb capture for this application is
----------------------------------------------

(gdb) attach 14464
Attaching to process 14464
Reading symbols from /home/xchgusr/bin/xchadapter...done.
Using host libthread_db library "/lib/tls/libthread_db.so.1".
Reading symbols from /lib/tls/libpthread.so.0...done.
[Thread debugging using libthread_db enabled]
[New Thread -1235520704 (LWP 14464)]
[New Thread -1383351376 (LWP 14480)]
[New Thread -1372861520 (LWP 14479)]
[New Thread -1351881808 (LWP 14477)]
[New Thread -1341391952 (LWP 14476)]
[New Thread -1330902096 (LWP 14475)]
[New Thread -1320412240 (LWP 14474)]
[New Thread -1309922384 (LWP 14473)]
[New Thread -1299432528 (LWP 14472)]
[New Thread -1288942672 (LWP 14471)]
[New Thread -1278452816 (LWP 14470)]
[New Thread -1267962960 (LWP 14469)]
[New Thread -1257473104 (LWP 14468)]
[New Thread -1246983248 (LWP 14467)]
[New Thread -1236493392 (LWP 14466)]
Loaded symbols for /lib/tls/libpthread.so.0
Reading symbols from /u01/app/oracle/OraHome_1/lib/libclntsh.so.10.1...done.
Loaded symbols for /u01/app/oracle/OraHome_1/lib/libclntsh.so.10.1
Reading symbols from /home/xchgusr/lib/libbse.so.1.0...done.
Loaded symbols for /home/xchgusr/lib/libbse.so.1.0
Reading symbols from /home/xchgusr/lib/libnse.so.1.0...done.
Loaded symbols for /home/xchgusr/lib/libnse.so.1.0
Reading symbols from /home/xchgusr/lib/libnsefno.so.1.0...done.
Loaded symbols for /home/xchgusr/lib/libnsefno.so.1.0
Reading symbols from /usr/lib/libstdc++.so.5...done.
Loaded symbols for /usr/lib/libstdc++.so.5
Reading symbols from /lib/tls/libm.so.6...done.
Loaded symbols for /lib/tls/libm.so.6
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/tls/libc.so.6...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /u01/app/oracle/OraHome_1/lib/libnnz10.so...done.
Loaded symbols for /u01/app/oracle/OraHome_1/lib/libnnz10.so
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
0xb75c9c18 in pthread_join () from /lib/tls/libpthread.so.0
(gdb) info threads
15 Thread -1236493392 (LWP 14466) 0xb75cb1fb in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
14 Thread -1246983248 (LWP 14467) 0xb75cb1fb in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
13 Thread -1257473104 (LWP 14468) 0xb75cb1fb in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
12 Thread -1267962960 (LWP 14469) 0xb75cb1fb in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
11 Thread -1278452816 (LWP 14470) 0xb75cb1fb in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
10 Thread -1288942672 (LWP 14471) 0xb75cb1fb in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
9 Thread -1299432528 (LWP 14472) 0xb75cb1fb in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
8 Thread -1309922384 (LWP 14473) 0xb75cb1fb in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
7 Thread -1320412240 (LWP 14474) 0xb75cb1fb in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
6 Thread -1330902096 (LWP 14475) 0xb75cd6b4 in __pthread_disable_asynccancel () from /lib/tls/libpthread.so.0
5 Thread -1341391952 (LWP 14476) 0xb75cd6b4 in __pthread_disable_asynccancel () from /lib/tls/libpthread.so.0
4 Thread -1351881808 (LWP 14477) 0xb75cd6b4 in __pthread_disable_asynccancel () from /lib/tls/libpthread.so.0
3 Thread -1372861520 (LWP 14479) 0xb75cdb3e in accept () from /lib/tls/libpthread.so.0
2 Thread -1383351376 (LWP 14480) 0xb68da337 in ___newselect_nocancel () from /lib/tls/libc.so.6
1 Thread -1235520704 (LWP 14464) 0xb75c9c18 in pthread_join () from /lib/tls/libpthread.so.0
(gdb)

Sample program using pthread_cond_wait() is not using CPU Usage.
Note: I measured CPU Usage through top utility.

If anybody overcome this kind of problem, please help me to solve
this problem.

Thank you....


All times are GMT -5. The time now is 11:27 AM.