Sunday, November 16, 2014

Multithreading in JAVA


States of thread





 What is a context switch :each thread is assigned a priority
a thread with higher priority dosent mewan it will run any faster.
Priority is used ro decide when to switch from one thread to another
This is called Context switch.


A thread can voluntarily relinquish control. This is done by explicitly yielding, sleeping,or blocking on pending I/O. In this scenario, all other threads are examined, and the highest-priority thread that is ready to run is given the CPU.

• A thread can be preempted by a higher-priority thread. In this case, a lower-priority thread that does not yield the processor is simply preempted—no matter what it is doing— by a higher-priority thread. Basically, as soon as a higher-priority thread wants to run, it does. This is called preemptive multitasking.


No comments:

Post a Comment