• 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

Statements regarding to the Thread

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What CAN directly cause a thread to stop executing?
A. Existing from a synchronized block
B. Calling the wait method on an object
C. Calling notify method on an object
D. Calling read method on an InputStream object
E. Calling the SetPriority method on a Thread object
Can somebody help me with this one? Thank you.
An other question, while a thread is running (already got the CUP), it that possible that other tread with higher priority (in Ready-to-Run state) takes over?

 
Ranch Hand
Posts: 5399
1
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A. Existing from a synchronized block:
No it does not gaurantee that thread will stop executing.
B. Calling the wait method on an object
Yes thread will stop executing, leave the monitor
C. Calling notify method on an object
No it does not gaurantee that thread will stop executing.
D. Calling read method on an InputStream object
Thread will not stop executing but will be in blocked state(I do not know whether it will come under not executing state.)
E. Calling the SetPriority method on a Thread object
will depend on OS.
CMIW
------------------
Regards
Ravish
 
Ranch Hand
Posts: 782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A:FALSE
B:TRUE
C:FALSE
D:One cant say that does the i/p task is completed as it is required by thread or it has to wait.In 2nd condition it goes to wait state & it's execution stops.
E:FALSE
------------------
Count the flowers of ur garden,NOT the leafs which falls away!
 
reply
    Bookmark Topic Watch Topic
  • New Topic