MultiThreaded Programming  «Prev  Next»

Lesson 9

Multithreaded Java programming Conclusion

This module tackled the topic of Multithreaded Java programming.
You began the module by learning some basics about multithreading and why threads are important. You examined some practical scenarios where it is necessary to employ threads to improve the structure and performance of programs.
You learned how to create and use threads, as well as how to put them asleep. The module also explained how to resolve the tricky issue of thread synchronization.
The next module introduces you to exceptions, which are used to handle certain types of program errors.

Glossary terms

This module discussed how the following terms relate to Java:
  1. Multithreading: Multithreading is the capability of a program to have multiple paths of execution called threads.
  2. Thread synchronization: Thread synchronization is the process of structuring threads so that they never interrupt each other while performing sensitive tasks.

Concurrency and Parallelism

In the computer world, when we talk about concurrency, we talk about a series of tasks that run simultaneously in a computer. This simultaneity can be real if the computer has more than one processor or a multi-core processor, or apparent if the computer has only one core processor. All modern operating systems allow the execution of concurrent tasks. You can read your e-mails while you listen to music and read the news in a web page. We can say that this kind of concurrency is a process-level concurrency. But inside a process, we can also have various simultaneous tasks and concurrent tasks that run inside a process are called threads.
Another concept related to concurrency is parallelism. There are different definitions and relations with the concurrency concept. While some authors talk about concurrency when you execute your application with multiple threads in a single-core processor, so simultaneously you can see when your program execution is apparent. Also, you can talk about parallelism when you execute your application with multiple threads in a multi-core processor or in a computer with more than one processor. Some publishers talk about concurrency when the threads of the application are executed without a predefined order, and talk about parallelism when you use various threads to simplify the solution of a problem, where all these threads are executed in an ordered way. This chapter presents a number of recipes that show how to perform basic operations with threads using the Java 7 API. You will see how to create and run threads in a Java program, how to control their execution, and how to group some threads to manipulate them as a unit.
The following link discusses Daemon and non-daemon Threads

Multithreaded Java Programming - Quiz

Click the Quiz link below to test what you have learned in this module.
Multithreaded Java Programming - Quiz