How do i know the total no.of applications( threads ) Can be connected to the database?

And how do i know which thread is currently running or doing some work.?

If a thread is waiting on lock on other thread how do i know about that
What are the commands that i have to use and where do i spcifically look at?