What wight cause the current thread to stop excutings? A.thread of higher priority become ready. B.method sleep() be called. C.method stop() be called D.method suspend() be called. E.method wait() be called
c,b,d,e seem's to be the right answer's.Option A depend's on the platform.Do let me know whether the selected answer's are right or wrong.
According to me a,b,c,d,e all are correct. Just now I'm done with marcuss green exam and i got almost similar question. So if thread with highest priority is ready then currect thread will stop executing
hi ashv, I go with fraternity on this because if the scheduler is time slice then a thread with higher priority will have no effect,if the scheduler is prepmptive then it will preempt the lower priority thread.
"What wight cause the current thread to stop excutings?" That "wight" is a very crucial misprint. The question has different answers if that should be "will" versus if it is "might" - which is it supposed to be? Bill
I have seen similar questions all around. My questions is: How about the thread create a intreputed exception during the execution. Will this stop the thread? I think it will, But seems nobody agree with me. Can somebody tell me why?
suspend() is also deprecated. The question was probably "might" in which case it looks as though all options are valid. As far as the Java code is concerned you cannot predict whether a higher priority thread will cause the current thread to move to the ready-to-run state. This behaviour is dependant on the thread scheduler, which in turn depends on the underlying platform. Java is platform independent and so the language itself does not enforce how the scheduler should operate.
Hi folks, Let me sum it up , on the discussion in this thread. This question is from marcus green's test. The correct in the test is (A), (B) and (E). The reason as pointed out is on account of the fact that suspend() , stop() methods are deprecated in Java 2. In the SCJP context we must be very careful on the wording of the question. The question here cleverly asks that What wight cause the current thread to stop excutings? The catch is "might" and NOT "will". I guess this will end the discussion regarding this issue. Cheers, Ravindra Mohan