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

  • SEARCH
  • Home
  • 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 548517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:05:14+00:00 2026-05-13T11:05:14+00:00

Exposition: I think the Java VM is awesome. It’s guarantee of the safety of

  • 0

Exposition:

I think the Java VM is awesome. It’s guarantee of the safety of bytecode, the the standard libraries, … are amazing, especially the ability to load a Java class on the fly, and know that it can’t crash the VM (good luck with *.so files or kernel modules).

One thing I don’t understand, is how Java treats Thread.stop

I’ve read http://java.sun.com/j2se/1.5.0/docs/guide/misc/threadPrimitiveDeprecation.html
but it seems weird for the following reasons:

1) Resource Management

On Unix OS, if a process is hogging up resources, I can kill -9 it.

2) Breaking of Abstraction:

If I start a computationally expensive job, and I no longer need the computation, I can kill -9 it. Under this Java threading model, my computation thread has to periodically check for some boolean flag to see whether it should quit [this seems like breaking abstraction layers — when I’m writing computation code, I should focus on computation code, not where to spread out checks for whether it should terminate.

3) Safety of Lock/Monitors

So the official reason is “what is a thread is holding a Lock/Monitor and it gets Thread.stopped ? The objects will be left in damaged states” — yet, in OSes this is not a problem, we have interrupt handlers. Why can’t Java threads have interrupt handlers that work like OS interrupt handlers?

Question:

Clearly, I am thinking about Java Threads with the wrong mental model. How should I be thinking about Java threads?

Thanks!

  • 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-13T11:05:14+00:00Added an answer on May 13, 2026 at 11:05 am

    I think the key thing to remember is that threads are not processes. The only thing that threads “own” is the execution thread, since everything else can potentially be shared with other threads within the same process (memory space). Stopping a thread can’t clean anything up because things may still be completely valid for other threads to handle.

    In an operating system process, the OS keeps track of everything that the process owns (memory, files, locks, etc) and cleans things up properly when you SIGKILL a process.

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

Sidebar

Related Questions

Exposition: I'm writting an OpenGL app in Java via JOGL. The built in fonts
I have a small class that allows me to load shaders and use them
A java class does something like the following public class Foo { private final
Exposition: I am on Linux / Mac. Part of my code is in Java,
Can you spot the error, please? Why does the compiler think my function is
Exposition: In general, Reference Counting has the weakness of "it can't detect loops." However,
Exposition: I'm familiar with C/C++/Scheme & OpenGL. I have this client/server program written in
I'm not so experienced but i worked on some big Java EE projects (using
I have two classes: namespace Something { [Serializable] public class Spec { public string
Exposition: I do not git commit all that often; only after a lot of

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.