Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I tell what a Linux process is waiting for?

Tags:

I'm trying to track down the cause of performance bottlenecks in an application I'm debugging under Linux. The various processes involved seem to spend a lot of their time blocking on I/O requests, and I was wondering if anybody knew any Linux tricks that let you see why a particular process is blocked/what resource it's waiting for? Is there anything useful in /proc for instance?

like image 356
andygeers Avatar asked Apr 29 '09 09:04

andygeers


2 Answers

Whatever process it is, you use top to check the state. Then you could run it through truss or strace. That should detail what is going on. If that is not possible, hook it up to gdb. Tools like iostat might show you in general what is going on (e.g. if disk is bottleneck).

like image 132
Till Avatar answered Oct 25 '22 05:10

Till


You could use the strace command to see what your process is up to. You might also find it useful to run lsof on your process to see what files and sockets it is using.

like image 42
sigjuice Avatar answered Oct 25 '22 04:10

sigjuice