首页> 外文期刊>MSDN Magazine >Concurrent Affairs: Reader/Writer Locks and the ResourceLock Library
【24h】

Concurrent Affairs: Reader/Writer Locks and the ResourceLock Library

机译:并发事务:读取器/写入器锁和ResourceLock库

获取原文
获取原文并翻译 | 示例
       

摘要

If multiple threads concurrently execute code that writes to or modifies a resource, then obviously the resource must be protected with a thread synchronization lock to ensure that the resource doesn't get corrupted. However, it is common to have a resource that is occasionally written to but frequently read from. If multiple threads are concurrently reading a resource, using a mutual exclusive lock hurts performance significantly because only one thread at a time is allowed to read from the resource. It's far more efficient to allow all the threads to read the resource simultaneously, and it's fine to do this if all of the threads treat the resource as read-only and do not attempt to write to or modify it.
机译:如果多个线程同时执行写入或修改资源的代码,那么显然必须使用线程同步锁来保护资源,以确保资源不会被破坏。但是,通常具有偶尔写入但经常读取的资源。如果多个线程正在同时读取资源,则使用互斥锁会严重影响性能,因为一次只允许一个线程从资源读取。允许所有线程同时读取资源效率更高,如果所有线程都将资源视为只读并且不尝试写入或修改资源,则可以这样做。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号