Hey SCJP's I have question . 1)Do the questions asked in SCJP r platfrom dependent??? What i mean to say that if they ask a)A low priority thread never gets to execute if a higher priority thread is been excuted T/F According to me if the os is using time slicing to manage proccessor than it will get some time eventually .if it's using pre-emptive scheduling to manage proccessor it will not be excuted till higher priority thread is through. Am i right ??
They are very careful to word the questions so that there is no possibility of 2 interpretations of the question. If there is something that is OS dependant, then the answers reflect that in the wording.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Java specification goes to great lengths in avoiding saying things that could be potentially platform dependent. Threading is an area which is hingly platform dependent. As 'CPU allocation' to threads is platform dependent, the specification does not guatantee which thread should get scheduled when. By not commiting to such behaviour, the specification itself remains fairly platform independent. The point is, answers to questions like this are NOT platform dependent. The statement, "A low priority thread never gets to execute if a higher priority thread is been executed." is false not because Win32 doesn't do so but because the language specification doesn't guarantee it. Similarly an exactly opposite statement, "A low priority thread will get to execute even if a higher priority thread is been excuted." is also false. Not because solaris doesn't do so but because the spec. doesn't guarantee it. Another classic example is about Garbage collection. In all the JVMs (at least that I know of!), the GC thread runs in low memory conditions. But still the statement, "GC thread runs in low memory conditions" is false. Simply because the spec. doesn't guarantee it. So, whenever you get such question do not panic. Either, as Cindy said, it will be very clear that the question is asking about a particular platform (ex. On Solaris a low priority thread never gets to execute if a higher priority thread is been executed.) or the answer can really by given in platform independent way if you understand the concepts well. HTH, Paul. ------------------ Get Certified, Guaranteed! (Now Revised for the new Pattern) www.enthuware.com/jqplus