Study notes (32): Chapter 1 Distributed Foundation of Concurrent Programming-Understanding the meaning and use of multithreading (on)

Learn now: https://edu.csdn.net/course/play/29000/424233?utm_source=blogtoedu

1. Concurrency:

Factors affecting concurrency

1.1 Hardware: CPU, memory, disk, network

1.2 Software level: the number of threads, JVM memory allocation size, network communication mechanism (BIO, NIO, AIO), disk IO

2. How to increase the number of concurrent threads on the server

3. Concurrency and parallelism

Concurrency: throughput carried by the server

Parallel: the number of threads that the CPU can process simultaneously

So a single-core CPU can also support multi-threading => cpu time slice switching

4. Features of multithreading:

Asynchronous, parallel

5. How to write threads in java

(1)class extends Thread

  (2)  class implements Runnable

  (3) Callable/Future=> class implements Callable<return value type> => with return value

6. Asynchronous/parallel use

(1) Network request distribution scenario

(2) File import

(3) SMS sending scenario

Guess you like

Origin blog.csdn.net/qq_28500837/article/details/112850638