Netease cloud classroom micro specialty — Java Senior Development Engineer — multithreaded concurrent programming — learning notes (I)

Chapter 1 multithreaded concurrent programming

Section 1 Java Basics

1.1. 1 Analysis of Java program operation principle

Class file content

JVM runtime data area

Method area

Heap memory

VM Stack

Native Method Stack

Program counter

View class file contents

Program integrity analysis

1.1. 2 thread status

Multithreading running state switching source code example

1.1. 3 thread termination

Incorrect thread termination - stop

Source code example

Correct thread termination – interrupt

Source code example

Correct thread termination - flag bit

1.1. 4 memory barrier and CPU cache

CPU performance optimization method - cache

Multilevel cache
Cache synchronization protocol

CPU performance optimization means - runtime instruction rearrangement

Problems in CPU performance optimization

Solution – memory barrier

1.1. 5 thread communication

Mode of communication

1. File sharing
2. Network sharing
3. Shared variables
4. Thread coordination API provided by JDK

False Awakening

1.1. 6 ThreadLocal and stack closure of thread closure

Thread closure concept

ThreadLocal

Stack closure

1.1. Application and implementation principle of thread pool

Why use thread pools?

Thread pool principles – concepts

Thread pool API – interface definition and implementation classes

Thread pool API - method definition

ExcutorService
ScheduleExecutorService

Example code demo9

Thread pool API – excellers tool class

Thread pool principle - task execute process
How to determine the appropriate number of threads?
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>