• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

K&B Thread chapter: A couple of questions

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) Thread contructors are shown to use ThreadGroups. Do I need to know about thread groups for the exam?
2) In the Two-Minute Drill, it is stated that: "Only one thread can be running at a time, although many threads may be in the runnable state." That doesn't sound right. Most JVM implement java threads as native threads causing the OS scheduler to run multiple threads concurrently if the JVM is hosted on a multi CPU box.

Thanks for your help.
 
Johnny Hunter
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This code:
class A implements Runnable {

public void run() { System.out.println("run Lola run"); }

public static void main(String args[]) {
Thread t = new Thread(new A());
t.start();
t.start(); // should throw a runtime exception
}
}


doesn't throw a runtime exception (at least on OS X) as it is stipulated it would do on page 536 of K&B.
[ July 16, 2004: Message edited by: Next Stepguy ]
 
Johnny Hunter
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dissecting the Thread chapter:
The code at the bottom of page 513 for the Join example is partially wrong; it should include a try/catch (InterruptedException) around the join (or at least mention that join() needs it...)
 
reply
    Bookmark Topic Watch Topic
  • New Topic