Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6834221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:05:05+00:00 2026-05-26T23:05:05+00:00

It is possible to kill a thread that is in state RUNNING in a

  • 0

It is possible to kill a thread that is in state RUNNING in a non programatically way?

I know that top command in *nix can show threads. Can I kill the thread in the OS?

I’d like to know if there is a way to link a thread to a process so I can kill only that specific thread and not the application.

We had a bug in our code that kept a thread in state RUNNING in a synchronized method. The thread kept the lock on the object “hanging” the application.

The bug is fixed. But I wonder if is possible.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:05:05+00:00Added an answer on May 26, 2026 at 11:05 pm

    The short answer is “maybe, but you should not and most of the time it won’t work either”.

    The long answer is:

    “Maybe…”
    Some JVM implementation map java threads to OS threads and some do not. If the JVM does a mapping to a native OS thread, you might be able to kill that thread with some process tool that the OS provides (like kill on *nix). If the JVM does green threads, meaning it doesn’t map a Java thread to an OS level thread, then you are basically out of luck using OS level tools. Luckily only very few JVM implementations do this. An approach that can be used regardless in which way the JVM organizes it’s threads, is using the java debugger. This article describes the procedure of doing it: http://www.rhcedan.com/2010/06/22/killing-a-java-thread/.

    “but you should not do it”
    Killing a thread on the OS level will almost certainly leave the JVM in an undefined state (read “jvm might crash or delete all files on your disk or do whatever it fricking pleases to do”). Even when going the debugger way, only a very small amount of java applications (read “no application made on this planet”) will properly handle the event that an outside application is killing one of it’s threads. As a result these applications will be put in an undefined state (read “application might crash or delete all files on your disk or do whatever it fricking pleases to do”).

    “and most of the time it won’t work either”
    If the thread is really stuck with some blocked IO etc, then killing the thread won’t work, it will just not respond. If a program is stuck it’s probably better to kill the whole program, find the issue with the program and fix it instead of killing a single thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Is there any way to kill a Thread in Python? So this
I know you cannot kill a boost thread, but can you change it's task?
Is it possible kill the thread of a BackgroundWorker ? In my DoWork event,
Is it possible to kill a Java thread without raising an exception in it?
I'm running an application (firefox) and I would like to know if it's possible
I'm searching for code in c# that can kill computer performance (CPU performance, maybe
Is there a way to have the parent that spawned a new thread catch
Is it possible that a program which does not kill its threads properly before
Is it possible to kill all non-original extensions from prototype, such as array.each, array.map,
Possible Duplicate: .NET - What’s the best way to implement a catch all exceptions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.