review

We’ve covered Java collections in previous articles

  • Overview of Java Collections
  • An ArrayList of Java collections
  • The LinkedList of Java collections
  • Java collection HashMap

This chapter begins with an introduction to multithreaded programming and other implementations of collections, which will be released later

From the CPU

The figure above shows the parameters of the three types of CPU. We only need to pay attention to the column of CPU core. The three types of CPU here are all 6 cores and 12 threads, see the figure below

Threads and processes

What is a thread? We can’t talk about threads without talking about processes

Process is a running activity of a program on a data set in a computer. It is the basic unit of resource allocation and scheduling in the system and the basis of operating system structure. In the early process-oriented computer architecture, the process is the basic execution entity of the program. In modern thread-oriented computer architectures, processes are containers for threads.

Open WinwoWS task manager can run a number of procedures, QQ is a process, and process is the container of threads,

An anti-virus program can fix bugs and clean up garbage simultaneously in separate threads and within a single process

So let’s look at what threads mean:

A thread is a single sequence control flow in a program. Process has a relatively independent, schedulable execution unit, is the system independent scheduling and dispatching CPU basic unit instruction run program scheduling unit. The simultaneous running of multiple threads in a single program to accomplish different tasks is called multithreading.

A single-core CPU can theoretically handle only one thread at a time, but multi-core multithreading with time-slice rotation allows us to write code while listening to music.

multithreading

Let’s say we have a ticket window, and we have 100 tickets sold in three Windows, and we need to use multithreading.

conclusion

Threads are a fairly important fundamental concept of computer abstraction that we need to know

  • A thread is the smallest unit of a program’s execution flow
  • A process is a container for threads
  • There can be multiple threads in a process
  • Multi-core multithreading allows multiple threads to be processed in parallel

Next time we will use Java programming to achieve three Windows to sell tickets, please look forward to ~~~

For those of you who like this article, please click on the image below to follow my programming notes for more highlights