"The semaphore is synchronized with multi-threaded multitasking, and one thread completes an action by telling the other thread that the other thread is going to do some action (where everyone is blocking when they are semtake)." The mutex is used
Mutex)
Mutex represents a mutex data structure and is also used as a binary signal lamp. A mutex is basically a multi-task sensitive binary signal. It can be used for synchronizing multiple tasks. It is often used to protect critical code
Today, I have sorted out the related knowledge about semaphores. In fact, it is quite interesting to think about it. The lock and mutex can all implement thread synchronization. There are three main types of semaphores in the framework.
:
Both the auxiliary thread and the user interface thread need to protect shared resources when accessing shared resources to avoid conflicts and errors. The processing method is similar to the use of Win32 API functions. However, MFC provides several
Detailed narration of interprocess communication is absolutely impossible here, and the author is very difficult to be confident that the understanding of this part of the content to achieve what the point, so at the beginning of this section to
Inter-process communication:
1. Pipe and named pipe ):
A pipeline can be used for communication between kinship processes. In addition to the functions of a pipeline, a famous Pipeline also allows communication between unrelated processes.
2. Signal
Recently, some netizens have repeatedly mentioned an open source project kernel-win32 designed to move wineserver into the kernel; some questions and themselves, hoping to make some analysis and explanation of its code, also asked about the
Why multithreading?
Multithreading is not necessarily the best, the right is the best.The main advantage of multithreading is cheap, start fast, quit fast, share core objects with other threads, it is easy to realize the great dream of
Introduction
The two basic problems of inter-thread communication are mutual exclusion and synchronization.
Thread Synchronization is a type of constraint between threads. The execution of one thread depends on messages of another thread. When
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.