随笔分类 - Operating System
摘要:下图是Java里的概念,其中 Hashtable 和 SynchronizedMap 都是对整个map加锁,所以多个thread没法同时修改。 ConcurrentHashMap 则允许多个thread同时访问不同的entry,即如果thread操作的key不同,这些thread是可以同时读写的。如
阅读全文
摘要:The reader and writer processes share the following data structures: semaphore rw_mutex = 1; semaphore mutex = 1; int read_count = 0; The semaphores m
阅读全文
摘要:Operating systems often distinguish between counting and binary semaphores. The value of a counting semaphore can range over an unrestricted domain. T
阅读全文
摘要:Condition Variable The Bounded-Buffer problem, also known as the producer-consumer problem, can be easily solved using the semaphore. In C++, there ar
阅读全文
摘要:Condition Variable is a kind Event used for signaling between 2 or more threads. One thread can wait for it to get signaled, while other thread can si
阅读全文
摘要:Race Condition: A situation like this, where several processes access and manipulate the same data concurrently and the outcome of the execution depen
阅读全文
摘要:Constructor C++11 提供了std::thread,std::thread thread_object(callable),callable可以是 1. A function pointer 2. A function object 3. A lambda expression To
阅读全文
摘要:Overview C++11 Multithreading - Create Threads C++11 Multithreading - Mutex Lock C++11 Multithreading - Condition Variable C++11 Multithreading - Sema
阅读全文

浙公网安备 33010602011771号