Class 2 |
Intermediate Java 30-IT-397 |
|
Two Ways To Thread
-
There are two ways to thread, depending upon the operating system.
-
Preemptive multitasking: the operating system interrupts the task without
asking it first. (Unix and variants, modern Windows).
-
Cooperative, or non-preemptive: the operating system is only interrupted
when it yeilds control. (Win 3.1x and Mac OS, (even though you can't run
Java on Win 3.1x (who really uses that anymore anyway? (Do I have enough
close quotes here? (It's getting late in the Jones household, if you can't
tell.))))
-
An important side note:
-
Though Java is known as the write once, run anywhere language, this is
one time where you might see different results on different operating systems.
-
Why? Different operating systems implement native threading different
ways. The way threads are handled, the way they get priority, the
way they are selected for execution, etc.
-
Thus, as always, it is a good idea to test on every platform upon
which users might use your system.
What Are Threads?


Created by: Brandan
Jones December 17, 2001