[Operating system principle]–Thread synchronization

Directory of series articles [Operating system principle]–Process management [Operating System Principle]–Process Scheduling [Operating system principle]–Thread synchronization [Operating system principle]–Semaphore and PV operation implementation [Operating system principle]–Linux memory management [Operating system principle]–File system programming Thread synchronization Table of Contents of Series Articles Experiment related knowledge 1. Processes and threads 2. Thread synchronization 3.Multi-threading 4. Thread related […]

<1>, C++ implements multi-thread synchronization processing: controlling the output sequence of ABC, outputting 10 groups, mutex+condition_variable

Table of Contents need: analyze: Some code implementation: 1. Operations implemented using only flag bits: 2. For greater security, the mutex lock code is added: 3. Use it with unique_lock to make the code safer Four: Use guard lock lock_guard to work with it 5. You can also use condition variables to process, which will […]

Synchronization experiment of operating system processes

1. Experimental purpose (1) Master the basic concepts and properties of processes and threads; (2) Implement multi-threaded ticketing: simulate multiple ticketing windows (there are 2 windows here), and each window can sell tickets at the same time. Through multi-threading, ticketing operations can be performed concurrently to ensure thread safety; (3) Provide user interface: Create a […]

Synchronization Quest: Understanding the differences and applications of System V and POSIX semaphores

Directory title 1. Introduction 1.1 Overview of the importance of semaphores 1.2 Purpose of this article: Compare System V and POSIX semaphores 2. Basics of Semaphores 2.1 Definition and Function of Semaphores 2.2 The role of semaphores in process synchronization (Role in Process Synchronization) Synchronization and Mutual Exclusion The similarity between the psychology of semaphores […]

Cache synchronization of multi-level cache

There are three common ways to synchronize cache data: Set validity period: Set the validity period for the cache, and it will be automatically deleted after expiration. Update when querying again Advantages: simple and convenient Disadvantages: poor timeliness, cache may be inconsistent before expiration Scenario: Business with low update frequency and low timeliness requirements Synchronous […]

MySQL single table is too large, master-slave mode, synchronization mode optimization principle

Article directory Is the performance of MYSQL severely degraded when the data in a single table reaches 20 million? Preface InnoDB index data structure B + tree Sharding Sphere sub-database and table Sharding-JDBC Sharding-JDBC related concept description logical table Broadcast table binding table Sharding-Sharding strategy in JDBC Automatic sharding algorithm Modulo sharding algorithm Hash modulo […]

Handling the problem of out-of-synchronization of data from the database in Mysql8.0 version

Handling the problem of out-of-synchronization of slave data in Mysql8.0 version Situation 1: Error during synchronization During the synchronization process of the slave database, the master database deletes data. 1. The slave database does not synchronize the data of the master database Cause analysis: Caused by data synchronization error. Operation from library show slave status\G […]

“GitHub Project Circle 01” A project to build an AI digital human is open source! Automatically realize audio and video synchronization!

Starting this week, Xiaoquan officially launches the “GitHub Project Selection Weekly” plan, which selects some fun, interesting, practical, and advanced open source projects that Xiaoquan has encountered or recommended by big players in the industry, and shares them in the form of weekly articles. For everyone to watch and learn, hoping to learn and make […]

Thread condition control realizes thread synchronization

I talked about mutex locks earlier, but I always feel that some functional mutex locks are not enough. Condition variables are another synchronization mechanism available for threads. Condition variables provide a place for multiple threads to meet. Condition variables, when used with mutexes, allow threads to wait for a specific condition to occur in a […]

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 […]