LAB-2       Threads (1)

 

What Is a Thread?

A thread--sometimes called an execution context or a lightweight process--is a single sequential flow of control within a program. You use threads to isolate tasks.

 

Customizing a Thread's run Method

Basic support for threads in all versions of the Java platform is in the java.lang.Thread class. It provides a thread API and all the generic behavior for threads. These behaviors include starting, sleeping, running, yielding, and having a priority. To implement a thread using the Thread class, you need to provide it with a run method that performs the thread’s task.

 

The Life Cycle of a Thread

Once you know how to get a Thread to do something, you need to understand its life cycle.

 

Understanding Thread Priority

A thread's priority affects when it runs in relation to other threads. This section talks about how this affects your programs.

 

Practice and Solutions

 

 

Hosted by www.Geocities.ws

1