volatile,synchronized visibility, orderliness, atomic code proof (basic hard core)

0. Introduction The previous article "Synchronized Usage Principles and Lock Optimization Upgrade Process" analyzes the synchronized keyword principle in detail from the perspective of interviews. This article mainly focuses on the volatile keyword and uses code to analyze visibility, atomicity, ordering, and synchronized also assists ...

Posted by joejoejoe on Sat, 30 Apr 2022 00:15:00 +0300

Python multithreaded download of all hero skins of hero League

A civil engineering student in school has little understanding of programming. The only programming software I have ever been in contact with before is Matlab. However, the famous scientific research killer has become a calculator in my hands. I learned about python software from my tutor last week. I feel very cool. After checking the data ...

Posted by bftwofreak on Fri, 29 Apr 2022 01:58:36 +0300

python multithreading and multiprocessing

Processes and threads Process: is a running program It is an independent unit for the system to allocate and call resources Each process has its own memory space and system resources Thread: it is a single sequential control flow in a process and an execution path Thread, also known as lightweight process, is the smallest unit that the op ...

Posted by kiwis on Wed, 27 Apr 2022 04:26:13 +0300

08-02 multithreaded Thread

preface Thread in C # was born in net framework 1.0 is the encapsulation class of c# for the thread operation of computer resources. 1, Thread common methods 1. Start thread ThreadStart threadStart = () => { Console.WriteLine("Open thread"); }; Thread thread = new Thread(threadStart); thread.Start(); 2. Pause / stop / res ...

Posted by benny_g on Tue, 26 Apr 2022 01:09:50 +0300

Creation and use of threads

Thread creation   Method 1: to create a subclass that inherits the Thread class, you need to override the run() method of the parent class, then create the object of the subclass, and call the start() method through the subclass object (including using anonymous subclasses).   Small case: package com.threadstudy; public class MultiThreadingTe ...

Posted by Square1 on Wed, 20 Apr 2022 19:52:51 +0300

Java multithreading ReentrantLock

It realizes the similar synchronization function of synchronized(obj), but it is different from synchronized(obj), that is, reentracntlockojb Lock and synchronized (reentrant lock JB) are not mutually exclusive.The lock object in ReentrantLock lock is itself, which is equivalent to: synchronized(lock) {}.unlock the lock as many times as possi ...

Posted by elgoog on Wed, 20 Apr 2022 02:21:42 +0300

[lock] how does ReentrantLock implement fair lock / unfair lock

Flush Natural selection, survival of the fittest. The survival law of nature is also exceptionally applicable in Java. ReentrantLock uses unfair locks by default, allowing threads to compete on their own. In junior high school, the phenomenon of jumping in line after eating in the school canteen continued despite repeated prohibitions, ...

Posted by mazen on Tue, 19 Apr 2022 11:51:20 +0300

Multi thread synchronization mechanism

Multi thread synchronization mechanism (thread safety) Whether the program is thread safe: whether the method of the program is a synchronous method. When viewing the source code of a class in the future, if the method in the class is a synchronous method, it means that the class is thread safe. (when this kind of operation is in progress, it ...

Posted by lalabored on Tue, 19 Apr 2022 01:11:55 +0300

Thread pool source code analysis

summary In java, thread pool ThreadPoolExecutor is a class that cannot be bypassed. It is the embodiment of the idea of sharing meta mode. It can be reused by creating a certain number of threads in the container, so as to avoid the additional overhead caused by frequent thread creation. A reasonably set thread pool can improve the speed of tas ...

Posted by suvarthi on Mon, 18 Apr 2022 17:26:44 +0300

Using ePump framework to write TCP server

ePump framework based on non blocking, multithreading and event driven model can well solve the problems of complex thread scheduling and efficient communication. Using ePump framework can quickly develop various communication server systems, such as common HTTP Web server, RTMP streaming media server, timely communication message system and so ...

Posted by dniry on Mon, 18 Apr 2022 00:38:01 +0300