scala 多线程
Scala多线程 (Scala Multithreading)
Multithreading is the concept of using multiple threads simultaneously that allows the program to perform multiple operations simultaneously.
多线程是同时使用多个线程的概念,它允许程序同时执行多个操作。
A thread is a lightweight sub-processes that require a very lesser amount of memory to get executed. The general multithreaded program consists of two or more thread that runs concurrently to optimize the use of resources ( multiple CPUs) and increase the performance of the program.
线程是轻量级的子进程,需要很少的内存才能执行。 通用多线程程序由两个或多个并行运行的线程组成,以优化资源(多个CPU)的使用并提高程序的性能。
How thread works?
线程如何工作?
A thread is a lightweight process and its lifespan is defined as the time From which it starts to the point where it's terminated. In its lif