Primary Thread Methods

There are a number of important Thread methods, some of which you've already seen:

  • start()—Moves a thread from the initialized state to the runnable state. This does not make the thread execute. It makes the thread eligible for execution whenever it is scheduled.

Caution

Operating systems differ in the way they schedule threads . Solaris 7, for example, uses pre-emptive multitasking, whereas Windows 95 uses round-robin time slicing. Because Java is platform-neutral, it can run on any number of systems, any of which can have a different scheme for scheduling threads. You can't predict how long a given thread will execute for before it is interrupted or pre-empted, even on a specific system. You cannot write code that ...

Get PURE Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.