Scala is a JVM-based language, so programs written in Scala run in JVM. JVM, as we already know, is Java Virtual Machine, and runs as a single process in our operating system. In JVM, one of the basic concurrency constructs is a thread; we can create/use multiple threads as part of our Scala program. So, for a basic understanding of processes and threads, let's go through them.
Building blocks of concurrency
Understanding processes and threads
Think of a process as a program or application that our computer might have to run. This process is going to have some code that's executable, a process identifier (pid), and at least one thread of execution. The process might consume some computer resources as well, such as...