随笔分类 -  Operating System

摘要:下图是Java里的概念,其中 Hashtable 和 SynchronizedMap 都是对整个map加锁,所以多个thread没法同时修改。 ConcurrentHashMap 则允许多个thread同时访问不同的entry,即如果thread操作的key不同,这些thread是可以同时读写的。如 阅读全文
posted @ 2019-10-26 06:00 約束の空 阅读(213) 评论(0) 推荐(0)
摘要:The reader and writer processes share the following data structures: semaphore rw_mutex = 1; semaphore mutex = 1; int read_count = 0; The semaphores m 阅读全文
posted @ 2019-10-26 04:44 約束の空 阅读(473) 评论(0) 推荐(0)
摘要:Operating systems often distinguish between counting and binary semaphores. The value of a counting semaphore can range over an unrestricted domain. T 阅读全文
posted @ 2019-10-14 07:43 約束の空 阅读(452) 评论(0) 推荐(0)
摘要:Condition Variable The Bounded-Buffer problem, also known as the producer-consumer problem, can be easily solved using the semaphore. In C++, there ar 阅读全文
posted @ 2019-10-14 06:09 約束の空 阅读(589) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-10-14 03:33 約束の空 阅读(348) 评论(0) 推荐(0)
摘要:Race Condition: A situation like this, where several processes access and manipulate the same data concurrently and the outcome of the execution depen 阅读全文
posted @ 2019-10-14 03:18 約束の空 阅读(504) 评论(0) 推荐(0)
摘要:Constructor C++11 提供了std::thread,std::thread thread_object(callable),callable可以是 1. A function pointer 2. A function object 3. A lambda expression To 阅读全文
posted @ 2019-10-14 00:23 約束の空 阅读(170) 评论(0) 推荐(0)
摘要:Overview C++11 Multithreading - Create Threads C++11 Multithreading - Mutex Lock C++11 Multithreading - Condition Variable C++11 Multithreading - Sema 阅读全文
posted @ 2019-10-13 23:16 約束の空 阅读(169) 评论(0) 推荐(0)