How can I kill a particular thread of a process?

Threads are an integral part of the process and cannot be killed outside it. There is the pthread_kill function but it only applies in the context of the thread itself. From the docs at the link:

Note that pthread_kill() only causes the signal to be handled in the context of the given thread; the signal action (termination or stopping) affects the process as a whole.


The canonical answer to this question is: With the cooperation of the process, by whatever mechanism it provides. Without the cooperation of the process, it is impossible. That the process consists of threads is an internal detail of the process that is, by intentional design, not exposed outside of the process.