ps -L [pid] is what shows threads. I am not sure this is counting what you think it does. My shell process has about a hundred threads, and I can't imagine why one would have thousands unless your app spawned them.

On Mon, Oct 31, 2016 at 10:20 AM kant kodali <kanth909@gmail.com> wrote:

when I do 

ps -elfT | grep "spark-driver-program.jar" | wc -l 

The result is around 32K. why does it create so many threads how can I limit this?