J2EEOnline J2EE 






Java Exceptions  «Prev  Next»
Lesson 13

Concurrency and Multitasking Conclusion

Many methods in the class Thread which represent a thread of control, are declared using the throws keyword. These methods throw exceptions as part of the control flow of working with threads.
The keyword called synchronized will be discussed, which helps you coordinate between competing threads.

Multithreaded

Java was designed to meet the real-world requirement of creating interactive, networked programs. To accomplish this, Java supports multithreaded programming, which allows you to write programs that do tasks simultaneously. The Java runtime system comes with a sophisticated solution for multiprocess synchronization that enables you to construct smoothly running interactive systems. Java’s easy-to-use approach to multithreading allows you to think about the specific behavior of your program, not the multitasking subsystem.


Multithreading

Unlike some computer languages, Java provides built-in support for multithreaded programming. A multithreaded program contains two or more parts that can run concurrently. Each part of such a program is called a thread, and each thread denotes a separate path of execution. Hence, multithreading is a specialized form of multitasking.
You are almost certainly acquainted with multitasking because it is supported by virtually all modern operating systems. However, there are two distinct types of multitasking:
  1. process-based and
  2. thread-based.
It is important to understand the difference between the two. For many readers, process-based multitasking is the more familiar form. A process is, in essence, a program that is executing. Thus, process-based multitasking is the feature that allows your computer to run two or more programs concurrently. For example, process-based multitasking enables you to run the Java compiler at the same time that you are using a text editor or visiting a web site. In process-based multitasking, a program is the smallest unit of code that can be dispatched by the scheduler.
Recommended reading