Multithreading and Garbage Collection

Multithreading allows programmers to write efficient programs that make the maximum use of the CPU.
Java provides built-in support for multithreading in the form of classes and interfaces.
When Java programs are executed, there is already one thread that is running and it is the main thread. This main thread is important for two reasons:
It is the thread from which child threads will be created.
Program is terminated when the main thread stops execution.
Thread objects can be created in two ways:
Declare the class to be a sub-class of the Thread class where we need to override the run() method of the Thread class.
Declare a class that implements the Runnable interface. Then define the run() method.
Each thread in a Java program is assigned a priority, and the Java Virtual Machine never changes the priority of a thread.

Từ khóa: Multithreading and Garbage Collection, lập trình java, lập trình máy tính, ngôn ngữ lập trình, Java programs

ppt 32 trang | Chia sẻ: thi | Ngày:11/10/2012 | Lượt xem:80 | Yêu thích: 0 | Bình luận: 0 | Download: 2

Đăng nhập để bình luận