More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. In preemptive scheduling, highest priority task continues execution till it enters a not running state or a higher priority task comes into existence. In time slicing, the task continues its execution for a predefined period of time and reenters the pool of ready tasks.
Help us improve. Please let us know the company, where you were asked this question :
Q7. What is an object's lock and which object's have locks?
Ans. An object's lock is a mechanism that is used by multiple threads to obtain synchronized access to the object. A thread may execute a synchronized method of an object only after it has acquired the object's lock. All objects and classes have locks. A class's lock is acquired on the class's Class object.
Help us improve. Please let us know the company, where you were asked this question :
What is the initial state of a thread when it is created and started ?
Wait
Running
Ready
Sleep
What state does a thread enter when it terminates its processing?
Wait
Ready
Dead
Running
Q9. Difference between yield() and sleeping()?
Ans. When a task invokes yield(), it changes from running state to runnable state. When a task invokes sleep(), it changes from running state to waiting/sleeping state.
Help us improve. Please let us know the company, where you were asked this question :
LikeDiscussCorrect / Improve  java   threads   multi threading   scheduling   thread states   yield   sleeping