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 8342487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:47:23+00:00 2026-06-09T05:47:23+00:00

I am experimenting with Multithreading in java, basically I want to make two threads,

  • 0

I am experimenting with Multithreading in java, basically I want to make two threads, and have them count to a number.

But when they reach about half way they sleep for a set amount of time. So I was thinking to put an IF statement within the FOR loop to see when it reached halfway and then if it has, it will put itself to sleep.

I am running a single core cpu atm because I am on a school computer so in theroy, when I put the first thread to sleep, the second one should start?

Also, is it possible to put the first thread to sleep, from the second one and vice versa?

  • 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-06-09T05:47:25+00:00Added an answer on June 9, 2026 at 5:47 am

    You can use the Thread.sleep(int milliseconds):

    Causes the currently executing thread to sleep (temporarily cease
    execution) for the specified number of milliseconds, subject to the
    precision and accuracy of system timers and schedulers. The thread
    does not lose ownership of any monitors.

    As for making one thread pausing another, you could expose methods which the other threads can call to pause the execution of other threads.

    Just like any other multi-threaded program, keep an eye out for race conditions.

    As for your other question, single core processors should be able to run multiple threads, so the amount of cores (in this case) does not really matter.

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

Sidebar

Related Questions

I'm experimenting with some multithreading constructions, but somehow it seems that multithreading is not
I am experimenting with multithreading in Delphi (XE) and have run into a problem
I am experimenting with Dart. I have created an on click event like so:
I'm experimenting with Spring Mobile but I can't seem to get the basic example
I'm experimenting Java Multi-Threading using synchronization on method comparing with Atomic variables (java.util.concurrent.atomic package).
I experimenting with WebView in Android and I can't figure out how to make
While experimenting with iPhone app development, we have several AppIDs which should be deleted
I am currently experimenting with various input controls and have stumbled upon SneakyInput, which
I've been experimenting with Clojure's multithreading features lately and trying to implement a simple
Experimenting with Cocos2D collection detection and have some questions. First, some background: This is

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.