Linux – How to kill an individual thread under a process in linux

killlinuxthread

enter image description here

These are the individual threads of Packet Receiver process. Is there any way to kill any individual thread? Does Linux provide any specific command which can kill or send stop signal to any particular thread under a process?

Best Answer

It generally is pretty dangerous to kill an individual thread from a larger process. That thread might:

  • Be modifying some shared state with other threads that could become corrupted
  • Be holding some lock which never gets freed, causing the lock to become indefinitely unavailable
  • ...or any number of other things which might cause other threads to go wrong.

In general, outside of management and synchronisation by the application itself, killing individual threads is not something that makes sense to do.

Related Question