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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:59:02+00:00 2026-05-25T11:59:02+00:00

I am a bit confused about the need and usage of the yield method.

  • 0

I am a bit confused about the need and usage of the yield method. First of all, if we have two threads of different priority in a runnable state, does JVM give the equal opportunity to both threads to execute in a round-robin fashion.OR a high-priority thread will be given priority? Edit:- Assume OS is windows XP.

Now let’s come to the yield method of thread class.
The yield method Causes the currently executing thread object to temporarily pause and allow other threads(of higher priority or same priority) to execute.

At one of the articles is given at http://oreilly.com/catalog/expjava/excerpt/index.html, it is given at If at any time, a thread of a higher priority than the current thread becomes runnable, it preempts the lower priority thread and begins executing which is what yield is also doing/

So looks like from the above statements yield is automatically taken care of by JVM. Not sure what yield method is providing extra here?

  • 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-25T11:59:03+00:00Added an answer on May 25, 2026 at 11:59 am

    Thread.yield() is essential if you have green threads, however almost every JDK since version 1.1 has used native threads.

    Thread priority rarely matters in most applications.

    If you have plenty free CPU, every thread which can run will run. The OS has no reason not to run a low priority thread or process when it has free resources.

    If your system is close to 100% of CPU on every core, the OS has to make a choice as to how much time each thread or process gets on the CPU and it might give favour to high priority threads over lower priority threads, (many OSes ignore the hint) however other factors are likely to matter as well.

    However this priority only extends to raw CPU. It doesn’t mean a higher priority thread get more CPU cache, main memory, memory bandwidth, file cache, disk IO or network IO. If any of these resource are in competition, they are all equal.

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

Sidebar

Related Questions

I'm a little bit confused about the two different versions of Eclipse - 32/64bit.
i'm a little bit confused about all the different nokia SDK, what do i
I'm a bit confused about how many controllers I need, and when I can
I'm a bit confused about the use of all the IEnumerable<T> extension methods, intellisense
I'm a bit confused about the usage of Abstract classes in C#. In C++,
Im a bit confused about inherited instance variables in ABCs. I have written an
I am a bit confused about the usage of cudaEvent_t . Currently, I am
I am a bit confused about this. I have an R package that has
I am a bit confused about what the Initialize method is typically used for
I am little bit confuse about log4j in grails. I need to log info

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.