Book Image

Java Projects - Second Edition

By : Peter Verhas
Book Image

Java Projects - Second Edition

By: Peter Verhas

Overview of this book

Java is one of the most commonly used software languages by programmers and developers. In this book, you’ll learn the new features of Java 11 quickly and experience a simple and powerful approach to software development. You’ll see how to use the Java runtime tools, understand the Java environment, and create a simple namesorting Java application. Further on, you'll learn about advanced technologies that Java delivers, such as web programming and parallel computing, and will develop a mastermind game. Moving on, we provide more simple examples, to build a foundation before diving into some complex data structure problems that will solidify your Java 11 skills. With a special focus on the features of new projects: Project Valhalla, Project Panama, Project Amber, and Project Loom, this book will help you get employed as a top-notch Java developer. By the end of the book, you’ll have a firm foundation to continue your journey toward becoming a professional Java developer.
Table of Contents (12 chapters)

Threads

When I said that the OS executes the processes in time slots, I simplified how this really happens. Every process has one or more threads, and threads are executed. A thread is the smallest execution managed by an external scheduler. Older OSes did not have the notion of a thread and were executing processes. As a matter of fact, the first thread implementations were simply duplicates of processes that were sharing the memory.

You may hear the term lightweight process if you read something old. It means a thread.

The important thing is that the threads do not have their own memory. They use the memory of the process. In other words, the threads that run in the same process have indistinguishable access to the same memory segment.

The possibility of implementing parallel algorithms that make use of the multiple cores in a machine extremely powerful, but, at the same time...