.NET或Windows同步原语性能规格 [英] .NET or Windows Synchronization Primitives Performance Specifications

查看:116
本文介绍了.NET或Windows同步原语性能规格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在写科学文章,在这里我需要非常精确的用引文。有人点我要么MSDN,MSDN文章,有些发表的文章来源,或一本书,在那里我能找到的Windows或.NET同步原语的性能比较。

I am currently writing a scientific article, where I need to be very exact with citation. Can someone point me to either MSDN, MSDN article, some published article source or a book, where I can find performance comparison of Windows or .NET Synchronization primitives.

我知道这些都是在下降的性能顺序为:互锁API,临界区,.NET锁语句,监视器,互斥的EventWaitHandle,信号量

I know that these are in the descending performance order: Interlocked API, Critical Section, .NET lock-statement, Monitor, Mutex, EventWaitHandle, Semaphore.

非常感谢,
Ovanes

Many Thanks,
Ovanes

P.S。我发现了一个伟大的书:并发编程在Windows乔·达菲。这本书是由头部并发开发商.NET框架之一,简直是辉煌的,有很多的解释,是如何工作的,或实施了的。

P.S. I found a great book: Concurrent Programming on Windows by Joe Duffy. This book is written by one of the head concurrency developers for .NET Framework and is simply brilliant with lots of explanations, how things work or were implemented.

推荐答案

对于一个粗略的比较继起的无锁编程注意事项为Xbox 360和Microsoft Windows 可能会派上用场。

For a rough comparison following numbers from Lockless Programming Considerations for Xbox 360 and Microsoft Windows may come handy.

的同步指令和功能在Windows上的表现差异很大,取决于处理器类型和配置,以及其他哪些code上。多核和多插槽系统通常需要更长的时间来执行同步指令,并获取锁需要更长的时间,如果另一个线程当前拥有的锁。

不过,即使从非常简单的测试产生了一些测量是有帮助的:

However, even some measurements generated from very simple tests are helpful:

  • MemoryBarrier 是衡量考虑的 20-90次
  • InterlockedIncrement 是衡量考虑的 36-90次
  • 在获取或释放的关键栏目是衡量考虑的 40-100次
  • 在获取或释放互斥是衡量考虑关于 750-2500次
  • MemoryBarrier was measured as taking 20-90 cycles.
  • InterlockedIncrement was measured as taking 36-90 cycles.
  • Acquiring or releasing a critical section was measured as taking 40-100 cycles.
  • Acquiring or releasing a mutex was measured as taking about 750-2500 cycles.

这些测试在一系列不同的处理器在Windows XP环境。短时间是一个单处理器机器上,和较长的时间分别在多处理器计算机上

These tests were done on Windows XP on a range of different processors. The short times were on a single-processor machine, and the longer times were on a multi-processor machine.

这篇关于.NET或Windows同步原语性能规格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆