0

I am unable to list the locks associated with a process and information about the locks i.e How many threads share this lock etc.

Kindly tell my how to extract this information from a process ID.

My case:

I have run sysbench command

sysbench --test=threads --thread-locks=100 --max-time=20s run

I want to list locks that sysbench just created and information about the locks i.e which threads the sharing this lock etc?

0

you can get lock process list using below command

lslocks
  • lslocks does not list the locks associated with a process in my case I am running sysbench command sysbench --test=threads --thread-locks=100 --max-time=20s run Locks associated with sysbench are not listing in lslocks – Muhammad Umer Saeed May 9 '18 at 11:17
0

If you're talking about file locks,

lsof -p PID

will list all files opened by process with PID.

lsof -c processname

will list all files opened by processname.

Note that lsof lists also files opened only for read i.e. without file locks. The mode under which a file is open is specified as the fourth character in the FD (File Descriptor) column in the output:

                   r for read access;
                   w for write access;
                   u for read and write access;
                   space if mode unknown and no lock
                        character follows;
                   `-' if mode unknown and lock
                        character follows.
  • I have run sysbench command sysbench --test=threads --thread-locks=100 --max-time=20s run – Muhammad Umer Saeed May 9 '18 at 11:15
  • now i want to list the locks that sysbench just created and find information about the locks i.e which threads are sharing these locks – Muhammad Umer Saeed May 9 '18 at 11:16
  • Then please edit your question and add this information there. – dr01 May 9 '18 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.