Current location - Loan Platform Complete Network - Big data management - How to master the skills of java multithreading, high concurrency and big data
How to master the skills of java multithreading, high concurrency and big data
Threads: The same kind of threads * * * share code and data space, and each thread has its own running stack and program counter (PC), so the overhead of thread switching is small. (thread is the smallest unit of cpu scheduling)

Threads, like processes, are divided into five stages: create, ready, run, block and terminate.

Multiprocess means that the operating system can run multiple tasks (programs) at the same time.

Multithreading means that there are multiple continuous streams executing in the same program.

There are two ways to realize multithreading in java, one is to inherit Thread class, and the other is to realize Runable interface. (In fact, there should be three kinds accurately, and the other is to implement callable interfaces, which are used in combination with the future and thread pools.