10-Asynchronous programming (concurrent, parallel, synchronous, asynchronous, blocking, non-blocking), synchronous blocking, asynchronous blocking, synchronous non-blocking, asynchronous non-blocking

1 concurrent 2 parallel 3 sync 4 asynchronous 5 blocking 6 non-blocking 6.1 Synchronous blocking, asynchronous blocking, synchronous non-blocking, asynchronous non-blocking 7 Asynchronous Programming 1 concurrent 1 Concurrency describes the organizational structure of the program. It means that the program should be designed into multiple subtasks that can be executed independently. 2 The purpose is […]

synchronized and reentrantlock implement multi-thread synchronization locking

Table of Contents Multithreading: Advantages of multithreading: Disadvantages of multithreading: Solution: Multi-thread synchronization Locking method one: synchronized() Inherit Thread() Implement the Runnable interface Locking method two: reentrantLock implements locking Multi-threading: In an application, there are multiple threads, and different threads can perform tasks in parallel. Multi-threading advantages: Improve program processing capabilities For example: anti-virus software […]

Escape Analysis: The secret key to unlocking performance!

High-quality blog posts: IT-BLOG-CN Interviewer pitfall: Do newly created objects in Java necessarily allocate memory on the heap? If your answer is “Yes” then you need to read this article. 1. Introduction Escape Analysis Escape Analysis: It is a very important JIT optimization technology, used to determine whether the object will be accessed outside the […]

Why does optimistic locking take effect under the MySQL repeatable read isolation level?

A very stupid question popped up today, let me record it Can optimistic locking implemented through version numbers take effect in MySQL under the repeatable read transaction isolation level? For example: two transactions one and two are opened, a certain piece of data is modified in transaction one, and the version number changes. But in […]

mybarisplus plug-in (paging and optimistic locking)

Article directory 1. Pagination plug-in 2. Customized paging 3. Optimistic locking 3.1 Scenario 3.2 Optimistic locking and pessimistic locking 3.3 Simulate modification conflicts 3.4 Optimistic locking solves problems 1. Pagination plug-in MyBatis Plus comes with a paging plug-in, which can realize the paging function with simple configuration. Add configuration class MyBatisPlusConfig @Configuration @MapperScan(“com.atguigu.mybatisplus.mapper”) public class […]

Basic use of PyAudio module, blocking/non-blocking recording/playing of audio

pyaudio library: audio processing pyaudio documentation, most variables and interface definitions are still in the C version of PortAudio documentation. The PyAudio object is only responsible for playing audio, and is not responsible for reading binary data from the file, so the reading must be done outside, and what is given to it is binary […]

python thread pool/AIO (asynchronous non-blocking) example of sending http request

Tested multi-threading, thread pool, aio and other modes respectively Threads are limited by CPU scheduling, and AIO is most efficient under large request volumes. See the code for details. There are detailed instructions in the comments. The main method is the program entry point. “”” Comparison of various ways to initiate http requests in python […]

Driver development 5 blocking IO instances, IO multiplexing

1 blocking IO Process 1 #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> #include <fcntl.h> #include <unistd.h> #include <string.h> int main(int argc, char const *argv[]) { char buf[128] = {0}; int a,b; int fd = open(“/dev/myled0”,O_RDWR); if(fd < 0) { printf(“Failed to open device file\ “); exit(-1); } while(1) { memset(buf,0,sizeof(buf)); read(fd,buf,sizeof(buf)); printf(“buf:%s\ […]