Java thread in-depth learning
Chapter 4: inter thread communication
4.1 waiting / notification mechanism
4.1.1 what is the waiting notification mechanism
In single thread programming, the operation to be executed needs to meet certain conditions, which can be placed in the if statement block. In multi-threaded programming, the conditions of thread a may not ...
Posted by Pavel_Nedved on Wed, 22 Sep 2021 08:36:43 -0700
Multithreaded learning notes (java)
Multithreading
Core:
A program is an independent execution pathWhen the program is running, even if you do not create a thread, there will be multiple threads in the background, such as the main thread and gc threadMain () is called the main thread, which is the entry of the system and is used to execute the whole programIn a process, if ...
Posted by ldd76 on Tue, 21 Sep 2021 18:26:12 -0700
Several semaphore mechanism algorithms
Producer-consumer questions:
_is too classic to be repeated.
import java.util.concurrent.Semaphore;
public class ProducerAndConsumer {
static int count = 0;
private static final Semaphore full = new Semaphore(0);
private static final Semaphore empty = new Semaphore(20);
private static final Semaphore mutex = new Semaphore(1);
publi ...
Posted by dannon on Mon, 20 Sep 2021 20:50:47 -0700
Solve the dining problem of philosophers
1. What is the dining problem of philosophers
If there are five philosophers, they sit at the same table and eat at the same time. After eating, they think. Each person has a chopstick on his left and right, with a total of five chopsticks So how can these five people eat at the same time? 1. Question conversion: philosophers are equivalent ...
Posted by joe_C_nice on Mon, 20 Sep 2021 15:04:26 -0700
Overview of Java Multithreading
Multi-threading concept
Concurrency|concurrency
Parallel: Multiple instructions executed simultaneously on multiple CPU sConcurrent: Multiple instructions executed alternately on a single CPU
Process|Thread
Processes: Processes in progress such as: word
Independence: An independent unit that runs, distributes, and schedules resources ind ...
Posted by webslinger on Thu, 16 Sep 2021 19:32:43 -0700
java-fair lock-re-lockable-deadlock-interrupt (how to gracefully stop a thread)
1. Fair-Unfair
1.1 Ticket Selling Cases (Unfair)
class Ticket
{
private int number = 50;
private Lock lock = new ReentrantLock(); //The default is an unfair lock. If you want an average allocation, =--, to be fair, change the constructor parameter to true
public void sale()
{
lock.lock();
try
{
...
Posted by SuperCam on Mon, 13 Sep 2021 20:06:10 -0700
Self-Organizing - Multi-threaded + JUC Notes
Thread Basics
Programs, Processes, Threads, Fibers (Programs)
Program: The.exe executable that was initially lying quietly on disk, load ed into memory by the system when we clicked Run, and executed by the cpu Processes: The basic unit for operating system resource allocation. (A program can be run by multiple processes, such as a computer ...
Posted by cabaz777 on Fri, 10 Sep 2021 20:43:24 -0700
Multi thread crawling NCBI database literature
Tip: after the article is written, the directory can be generated automatically. Please refer to the help document on the right for how to generate it
preface
Recently, I followed the dark horse programmer to learn the request crawler and successfully completed the batch processing of NCBI documents. The problem is that the crawling eff ...
Posted by dharprog on Thu, 09 Sep 2021 20:18:19 -0700