title: Terminating a linux kernel thread from userspace
body: <p>I am designing a system which is divided between Linux user-space and kernel-space. Both of these components should communicate with each other so I have provided two ways 1) few systemcalls and 2) proc filesystem entry. </p>
  
  <p>To make a long story short I want to provide a way from usersapce to terminate kernel threads and spawn new threads in kernel. I am able to spawn new threads but I am not sure how to terminate threads in kernel space without a disaster. </p>
  
  <p>Has anyone done this? How can I go about it without corrupting structures?</p>
  
  <p>Please if you can share code to terminate kernel threads gracefully that would be great.</p>
  
  <p>Thanks.
  Have a great day.</p>