• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Thread Question

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
TRUE or FALSE
A thread will stop running if another thread with higher priority enters the runnable state.
I think it's false because time sharing system don't allow this.
Anyone give his opinion?
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would think the currently running thread would have to be moved to the ready state first. Then when the next thread is chosen from the runnable thread the one with the highest priority will be moved from ready to running.
But in any good OS this would happen pretty fast.
By the way not all OS using time sharing as the scheduling system.
rob moreland
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If another thread of highier priority is started, java makes the lower priority(currently running) thread to wait.
If more than one thread exists with the same priority, Java quickly switches between them in round-robin fashion BUT only if the operating system uses time-slicing.
In preemptive scheduling the highest priority thread continues to run until it dies, waits, or is preempted by a thread of higher priorit.
 
We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic