Which two CANNOT directly cause a thread to stop executing?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Woo_Hwang
Posted On:   Saturday, August 11, 2001 11:32 AM

a. Exiting from a synchronized block b. Callling the main method on an object c. Calling the notify method on an object d . Calling a read method on an InputStream object e. Calling the setPriority method on a Thread object I found this questionary from a SJCP studying site. I think answer is can be all. a. Exiting sychronized block means that the thread releases its lock, not stop executing. c. Wait () can stop thread executing not notify() or notifyAll() d. when a thread tries to read or write from or to stream and those activities were delayed because of ,in example, sluggish stream rate , the thread stop executing(actually it is bl   More>>

a. Exiting from a synchronized block


b. Callling the main method on an object


c. Calling the notify method on an object


d . Calling a read method on an InputStream object


e. Calling the setPriority method on a Thread object



I found this questionary from a SJCP studying site. I think answer is can be all.



a. Exiting sychronized block means that the thread releases its lock, not stop executing.


c. Wait () can stop thread executing not notify() or notifyAll()


d. when a thread tries to read or write from or to stream and those activities were delayed because of ,in example, sluggish stream rate , the thread stop executing(actually it is blocked) until the delay goes away. So, if stream is not delayed, thread process doesn't stop.

e. I heard that setPriority can change the thread's status and might stop the current thread. However, I heard that this process is platform-dependant. OS which use pre-emptive process such as Solaris follows this rule but OS which has a time-slicing architecture does not.




Can someone check if I'm right for all of these explanations?

In addtion, I don't know what it means to call main method on an object. Can you expain me what it is calling main method? Because I've never seen this before. And effect on thread running.



Thank you in advance.

   <<Less

Can you expain me what it is calling main method?

Posted By:   Stevens_Gestin  
Posted On:   Tuesday, August 21, 2001 06:24 AM

hum may be :

public static void main(String[] xArguments) {...}

Re: Which two CANNOT directly cause a thread to stop executing?

Posted By:   Alex_Chaffee  
Posted On:   Saturday, August 18, 2001 09:50 AM

a. If you release a lock, and a higher-priority thread is waiting for that lock, then it will resume immediately.
About | Sitemap | Contact