<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>YEUO.com &#187; Coding (编程)</title>
	<atom:link href="http://yeuo.com/index.php/archives/category/coding/feed" rel="self" type="application/rss+xml" />
	<link>http://yeuo.com</link>
	<description>Interesting@Everything.net</description>
	<lastBuildDate>Sat, 28 Aug 2010 18:54:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Have fun?!:D</title>
		<link>http://yeuo.com/index.php/archives/548</link>
		<comments>http://yeuo.com/index.php/archives/548#comments</comments>
		<pubDate>Fri, 24 Jul 2009 19:59:38 +0000</pubDate>
		<dc:creator>CiberLinkNiC</dc:creator>
				<category><![CDATA[ArcEmu]]></category>

		<guid isPermaLink="false">http://yeuo.com/?p=548</guid>
		<description><![CDATA[Have Fun?! This screenshot got from a private dedicated server which powered by ArcEmu(Ceb Edition)
Share on Facebook
	Related posts
	
	No related posts.
	

]]></description>
		<wfw:commentRss>http://yeuo.com/index.php/archives/548/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>YEUO&#8217;s Pcsx2(ps2) &amp; Dolphin(wii) BinaryPackages SVN Address</title>
		<link>http://yeuo.com/index.php/archives/313</link>
		<comments>http://yeuo.com/index.php/archives/313#comments</comments>
		<pubDate>Mon, 06 Jul 2009 02:07:04 +0000</pubDate>
		<dc:creator>Zack</dc:creator>
				<category><![CDATA[Platform Emulators]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[ps2]]></category>
		<category><![CDATA[ps2模拟器]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[TortoiseSVN]]></category>
		<category><![CDATA[wii]]></category>
		<category><![CDATA[wii模拟器]]></category>

		<guid isPermaLink="false">http://yeuo.com/?p=313</guid>
		<description><![CDATA[YEUO&#8217;s Pcsx2(ps2) &#38; Dolphin(wii) BinaryPackages SVN Address
Dolphin http://yeuo.com:8080/svn/wiibin/
Pcsx2 http://yeuo.com:8080/svn/pc2ps2bin/
username is &#8220;download&#8221; for Both of these links,and password just leave it empty.
You can use any of SVN Clients some one like TortoiseSVN to download it
http://tortoisesvn.tigris.org/
Dolphin http://yeuo.com:8080/svn/wiibin/
Pcsx2 http://yeuo.com:8080/svn/pc2ps2bin/
Username is &#8220;download&#8221; for Both of these links,and password just leave it empty.
You can use any of SVN Clients some [...]]]></description>
		<wfw:commentRss>http://yeuo.com/index.php/archives/313/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>完美xbox360手柄模拟器 (perfect xbox360 Controller Emulator)</title>
		<link>http://yeuo.com/index.php/archives/293</link>
		<comments>http://yeuo.com/index.php/archives/293#comments</comments>
		<pubDate>Thu, 02 Jul 2009 08:59:25 +0000</pubDate>
		<dc:creator>CiberLinkNiC</dc:creator>
				<category><![CDATA[Coding (编程)]]></category>
		<category><![CDATA[Game (游戏)]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Trick (技巧)]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[joystick]]></category>
		<category><![CDATA[xbox360]]></category>
		<category><![CDATA[手柄]]></category>
		<category><![CDATA[模拟器]]></category>

		<guid isPermaLink="false">http://yeuo.com/?p=293</guid>
		<description><![CDATA[要说手柄现在是越来越受到重视了.
终结者的合作必须使用手柄,Protype 非手柄不能玩爽;再到新出的街霸招式组合判定比原来可是严格多了,没有一个好的手柄根本无法&#8221;大展拳脚&#8221;,更别说那些如Fuel此类的竞速精确操控游戏了.
现今大多数手柄其主方向控杆基本都是模拟矢量化的，可以微控物件，在加上适合人体工程学的设计，使其在长时间玩游戏后也不会感觉到过于劳累，相比键盘那当然是好太多了。(FPS,RTS除外)
但是很多游戏只支持360手柄并且必须360才有震动效果，所以这里提供一个最新的360手柄模拟器可以让所有只支持360手柄的游戏获得完全的360手柄体验，前提是最好是双电机的震动手柄尤佳······

这个是本站自用的修改版模拟程序，完美支持所有游戏震动，且无须任何设置。

Xbox360 Controller Emulator Modified Edition 2009
==================================================
此工具使用rageS的源代码修改而来，特此声明。
==================================================
安装前有如下工作要确认: 所带的手柄已安装好驱动程序,并确认在&#8221;游戏控制器&#8221;中可以触发其振动,这就表示驱动安装完整且控制键都工作正常.
然后２步骤：

点击reg文件先把注册表倒入系统. [如果你懂得编辑注册表可以手动修改无需倒入此注册表].
首先找到&#8221;控制面板&#8221;-&#62;&#8221;游戏控制器&#8221;,然后记下你手柄的名字,比如Betop c036 或 Saitek 等(根据手柄不同而不同),这张图已经修改完成,未修改的就会显示默认安装好驱动后的手柄原厂名. 然后在 &#8220;开始-&#62;运行&#8221; 那里输入 regedit 点查找查询你刚才记录的名字,比如 Betop C036,找到后把所有的此名字都改成: XBOX 360 Controller for Windows 如果你很懒则直接用自带的注册表文件好了.xD (本注册表只支持vista,xp的话自己按照手动方法来填写,非常之简单)
注:这步其实也可以不做,但是很多特殊的游戏会用直接读注册表OEMName的方式来看是否是360手柄,即使使用一个wrapper来转发api请求却因为引用未执行就会无法使用手柄,当然这只是很少的一部分而以,不过为了一劳永逸还是推荐做这步.
把所有文件拷入将要运行游戏的主执行文件(exe) 所在目录.(比如游戏终结者4就拷贝入TerminatorSalvation.exe 所在目录)执行 XinputTest.exe 后按动手柄看各功能是否正常,如果不正常请调整当前目录下的ini文件. 这里我提供2个默认配置文件,一个是对应&#8221;北通C036&#8243;一个是对应&#8221;赛钛克Saitek Pad&#8221;的ini. 如果你是这2种手柄可以在不更改任何设置下完美使用，直接拷贝子目录中的ini到&#8221;主文件&#8221;目录即可.

下载点此
Share on Facebook
	Related posts
	
	PS2模拟器编译版自动更新SVN (pcsx2最新版). (3)


]]></description>
		<wfw:commentRss>http://yeuo.com/index.php/archives/293/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dolphin(WII Emulator) x64 Opt Edition BinPack has been updated.</title>
		<link>http://yeuo.com/index.php/archives/219</link>
		<comments>http://yeuo.com/index.php/archives/219#comments</comments>
		<pubDate>Wed, 17 Jun 2009 08:16:49 +0000</pubDate>
		<dc:creator>Zack</dc:creator>
				<category><![CDATA[Platform Emulators]]></category>
		<category><![CDATA[Dolphin]]></category>
		<category><![CDATA[wii]]></category>
		<category><![CDATA[wii模拟器]]></category>

		<guid isPermaLink="false">http://yeuo.com/?p=219</guid>
		<description><![CDATA[
 
Location also in http://yeuo.com:8080/svn/wiibin/
user: download
password leave as empty.
Share on Facebook
	Related posts
	
	再发一个Wii(Dolphin)模拟器最新版同步更新版地址(编译版). (0)
	YEUO&#8217;s Pcsx2(ps2) &#038; Dolphin(wii) BinaryPackages SVN Address (10)


]]></description>
		<wfw:commentRss>http://yeuo.com/index.php/archives/219/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>再发一个Wii(Dolphin)模拟器最新版同步更新版地址(编译版).</title>
		<link>http://yeuo.com/index.php/archives/146</link>
		<comments>http://yeuo.com/index.php/archives/146#comments</comments>
		<pubDate>Thu, 11 Jun 2009 07:53:46 +0000</pubDate>
		<dc:creator>CiberLinkNiC</dc:creator>
				<category><![CDATA[Platform Emulators]]></category>
		<category><![CDATA[Dolphin]]></category>
		<category><![CDATA[ps2模拟器]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[TortoiseSVN]]></category>
		<category><![CDATA[vc]]></category>
		<category><![CDATA[wii模拟器]]></category>
		<category><![CDATA[最新版]]></category>
		<category><![CDATA[编译]]></category>

		<guid isPermaLink="false">http://yeuo.com/?p=146</guid>
		<description><![CDATA[
 
 
 
 
 
使用方法如同 http://yeuo.com/index.php/archives/135 该文章指引. 用户名同样为download 密码留空即可.
http://yeuo.com:8080/svn/wiibin/  (插件以及主执行文件皆会保持更新)
Share on Facebook
	Related posts
	
	YEUO&#8217;s Pcsx2(ps2) &#038; Dolphin(wii) BinaryPackages SVN Address (10)
	PS2模拟器编译版自动更新SVN (pcsx2最新版). (3)
	Dolphin(WII Emulator) x64 Opt Edition BinPack has been updated. (3)


]]></description>
		<wfw:commentRss>http://yeuo.com/index.php/archives/146/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PS2模拟器编译版自动更新SVN (pcsx2最新版).</title>
		<link>http://yeuo.com/index.php/archives/135</link>
		<comments>http://yeuo.com/index.php/archives/135#comments</comments>
		<pubDate>Wed, 10 Jun 2009 11:32:37 +0000</pubDate>
		<dc:creator>CiberLinkNiC</dc:creator>
				<category><![CDATA[Platform Emulators]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[pcsx2]]></category>
		<category><![CDATA[ps2]]></category>
		<category><![CDATA[ps2模拟器]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[TortoiseSVN]]></category>
		<category><![CDATA[战神]]></category>
		<category><![CDATA[最新版]]></category>
		<category><![CDATA[模拟器]]></category>

		<guid isPermaLink="false">http://yeuo.com/?p=135</guid>
		<description><![CDATA[
如果你正在用PS2模拟器.
如果你厌烦了每次都下载rar然后再覆盖.
如果你每次都需要手动更改文件名.
如果你每次都要对比版本新旧.
如果你每次都要耗费时间查找论坛贴寻找最新已编译版本的ps2模拟器.
目前最新版本启用dx10模拟战神可以无错流畅完美运行.(无绿屏,无武器抖动,60帧保持,关闭原生还可以获得比原始ps2更好的画面)

这个SVN地址可以帮你.
你可以通过浏览器直接下载(以后只要添加收藏架定期下载即可) http://yeuo.com:8080/svn/pc2ps2bin/  [访问用户:download 密码为空]又或者使用 TortoiseSVN 来同步更新. 请注意,每次下载的文件都会自动更新为目前已编译好的最新版本.如果你有TortoiseSVN客户端那么一切只要简单的同步就会把当前所有文件更新为最新版本. 如果你没有,那么使用浏览器定期下载那些exe 和DLL 也是不错的选择,至少你可以省去手动寻找新版本的时间. 运行前请确保你系统安装有[根据你系统不同选择x86 or x64] VC2008Redist SP1(x86) 或者 (x64) 可再发行VC运行库.
当然由于所有文件都是散落的形式发布,如果你只会使用浏览器下载而不会用TortoiseSVN你可以从其它地方首先下载一个完整的Pcsx2的压缩包(含bios的) 然后觉得有需要了就更新某个文件即可.目录内所有文件都是跟随官方最新版本自动更新. 当然如果你有TortoiseSVN那就无所谓了,这里已经是一个完整的含bios的pcsx2了. 同步后即可立刻进入游戏.
Share on Facebook
	Related posts
	
	再发一个Wii(Dolphin)模拟器最新版同步更新版地址(编译版). (0)
	YEUO&#8217;s Pcsx2(ps2) &#038; Dolphin(wii) BinaryPackages SVN Address (10)
	完美xbox360手柄模拟器 (perfect xbox360 Controller Emulator) (2)
	Apache Server running on SONY Playstation! (0)


]]></description>
		<wfw:commentRss>http://yeuo.com/index.php/archives/135/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>能过PB的cod5多人作弊.</title>
		<link>http://yeuo.com/index.php/archives/115</link>
		<comments>http://yeuo.com/index.php/archives/115#comments</comments>
		<pubDate>Tue, 09 Jun 2009 18:20:36 +0000</pubDate>
		<dc:creator>Zack</dc:creator>
				<category><![CDATA[CodHacks]]></category>
		<category><![CDATA[cod hack]]></category>
		<category><![CDATA[cod5]]></category>
		<category><![CDATA[CodHack]]></category>
		<category><![CDATA[Coding (编程)]]></category>
		<category><![CDATA[作弊器]]></category>
		<category><![CDATA[竞舞台]]></category>

		<guid isPermaLink="false">http://yeuo.com/?p=115</guid>
		<description><![CDATA[YEUO的cod4作弊器ceb很早便不开发了,这里放一个一直保持更新的国外cod5作弊器.能过pb!!! 之所以能过pb是因为不是使用传统的injectorMemoryPatch的办法,而是使用frap进程attach的办法来进行操作,使得非常容易的骗过了PB,而且一般来说除非pb专门出Special patch 对这个作弊器,否则即使pb升级很多次这个作弊器也还是一直可以使用的.
目前为止PB都无法检测. 既然cod6快出来了况且cod5也没什么人在玩,那么就放出来给大家试验吧. 类似这种的作弊器除此之外目前还有2个,由于含有自动爆头功能就暂时不放出了.  编程方法在GD也有讨论,相信可供很多人学习. 也表明PB并非可以让喜欢玩LAN Game的人高枕无忧.
该作弊器可以用于最新cod4 1.7或cod5 1.4或BF等游戏. 系统可以使用xp/vista/vistax64皆可完美运行.
使用方法:

下载一个录像和截图软件-Fraps.(相信很多人都有了,破解非破解皆可)并运行.
下载本作弊器(非YEUO开发)后开发,发布只为让某些妄想企图独享虐人的人好自为之.
最后运行cod游戏.(即使从竞舞台进入也可以正确开启作弊)

祝愿对战愉快.
Share on Facebook
	Related posts
	
	Never touch cod4 again! [Imported from My MSlive's space] (0)
	Visual Studio 2008 Stuffs &#8230;URL records (0)
	lockers in Multi CPU!  竞争加速的问题,留下以便以后参考. (0)
	Discuz 7 with Ionic IsapiRewrite(IIRF) under IIS (2)
	COD5 mappack2 地图包2视频 (2)


]]></description>
		<wfw:commentRss>http://yeuo.com/index.php/archives/115/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Discuz 7 with Ionic IsapiRewrite(IIRF) under IIS</title>
		<link>http://yeuo.com/index.php/archives/82</link>
		<comments>http://yeuo.com/index.php/archives/82#comments</comments>
		<pubDate>Thu, 04 Jun 2009 18:31:37 +0000</pubDate>
		<dc:creator>CiberLinkNiC</dc:creator>
				<category><![CDATA[Coding (编程)]]></category>
		<category><![CDATA[iirf]]></category>
		<category><![CDATA[ionic]]></category>
		<category><![CDATA[isapirewrite]]></category>

		<guid isPermaLink="false">http://yeuo.com/?p=82</guid>
		<description><![CDATA[大多数现成的IIS rewriteRules都是面向rewrite.dll的,这里是我写的一个简单的面向IIRF的.
Copy + Paste 即可解决你的烦恼.
Put this below into the isapirewirte4.ini

RewriteRule ^/forum-([0-9]+)-([0-9]+).html$ /forumdisplay.php?fid=$1&#38;page=$2 [L]
RewriteRule ^/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ /viewthread.php?tid=$1&#38;extra=page\%3D$3&#38;page=$2&#38;$3 [L]
RewriteRule ^/space-(username&#124;uid)-(.+).html$ /space.php?$1=$2&#38;$3
RewriteRule ^/archiver/((fid&#124;tid)-[\w\-]+.html)$ /archiver/index.php?$1&#38;$2 [L]
RewriteRule ^/tag-(.+).html$ /tag.php?name=$1&#38;$2

Share on Facebook
	Related posts
	
	能过PB的cod5多人作弊. (11)
	Visual Studio 2008 Stuffs &#8230;URL records (0)
	Never touch cod4 again! [Imported from My MSlive's space] (0)
	lockers in Multi CPU!  竞争加速的问题,留下以便以后参考. (0)


]]></description>
		<wfw:commentRss>http://yeuo.com/index.php/archives/82/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2008 Stuffs &#8230;URL records</title>
		<link>http://yeuo.com/index.php/archives/70</link>
		<comments>http://yeuo.com/index.php/archives/70#comments</comments>
		<pubDate>Thu, 26 Mar 2009 13:11:40 +0000</pubDate>
		<dc:creator>CiberLinkNiC</dc:creator>
				<category><![CDATA[Coding (编程)]]></category>
		<category><![CDATA[hotfixes]]></category>
		<category><![CDATA[vc2008]]></category>

		<guid isPermaLink="false">http://yeuo.com/?p=70</guid>
		<description><![CDATA[Service Pack 1
http://www.microsoft.com/downloads/details.aspx?familyid=27673C47-B3B5-4C67-BD99-84E525B5CE61&#38;displaylang=en
Feature Pack
http://www.microsoft.com/downloads/details.aspx?FamilyId=D466226B-8DAB-445F-A7B4-448B326C48E7&#38;displaylang=en
Hotfixes:
http://connect.microsoft.com/VisualStudio/Downloads
Share on Facebook
	Related posts
	
	能过PB的cod5多人作弊. (11)
	Never touch cod4 again! [Imported from My MSlive's space] (0)
	lockers in Multi CPU!  竞争加速的问题,留下以便以后参考. (0)
	Discuz 7 with Ionic IsapiRewrite(IIRF) under IIS (2)


]]></description>
		<wfw:commentRss>http://yeuo.com/index.php/archives/70/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>lockers in Multi CPU!  竞争加速的问题,留下以便以后参考.</title>
		<link>http://yeuo.com/index.php/archives/67</link>
		<comments>http://yeuo.com/index.php/archives/67#comments</comments>
		<pubDate>Thu, 26 Mar 2009 04:24:16 +0000</pubDate>
		<dc:creator>CiberLinkNiC</dc:creator>
				<category><![CDATA[Coding (编程)]]></category>
		<category><![CDATA[interlocked]]></category>
		<category><![CDATA[locker]]></category>
		<category><![CDATA[multi-cpu]]></category>

		<guid isPermaLink="false">http://yeuo.com/?p=67</guid>
		<description><![CDATA[无锁编程与分布式编程那个更适合多核CPU？

前一篇文章多核系统中三种典型锁竞争的加速比分析讲过了三种典型锁竞争情况下的加速比情况，特别是分布式锁竞争的加速比和CPU核数成正比，有很好的加速比性能。由于近些年在学术界中，无锁编程属于研究热点。那么使用无锁编程是不是可以取得更好的加速比性能呢？或者说无锁编程是不是更适合多核CPU系统呢？
无锁编程主要是使用原子操作替代锁来实现对共享资源的访问保护，举个例子，要对某个整数变量进行加1操作的话，用锁保护操作的代码如下：
int a = 0;
Lock();
a+= 1;
Unlock();

如果对上述代码反编译可以发现 a+=1;被翻译成了以下三条汇编指令：
mov         eax,dword ptr [a] 
add         eax,1 
mov         dword ptr [a],eax 


如果在单核系统中,由于在上述三条指令的任何一条执行完后都可能发生任务切换，比如执行完第1条指令后就发生了任务切换，这时如果有其他任务来对a进行操作的话，当任务切换回来后，将继续对a进行操作，很可能出现不可预测的结果，因此上述三条指令必须使用锁来保护，以使这段时间内其他任务无法对a进行操作。
需要注意的是，在多核系统中，因为多个CPU核在物理上是并行的，可能发生同时写的现象；所以必须保证一个CPU核在对共享内存进行写操作时，其他CPU核不能写这块内存。因此在多核系统中和单核有区别，即使只有一条指令，也需要要加锁保护。
如果使用原子操作来实现上述加1操作的话，例如使用VC里的InterlockedIncrement来操作的话，那么对a的加1操作需要以下语句
InterlockedIncrement (&#38;a);
这条语句最终的实际加1操作会被翻译成以下一条带lock前缀的汇编指令：
lock xadd   dword ptr [ecx],eax 


使用原子操作时，在进行实际的写操作时，使用了lock指令，这样就可以阻止其他任务写这块内存，避免出现数据竞争现象。原子操作速度比锁快，一般要快一倍以上。
使用lock前缀的指令实际上在系统中是使用了内存栅障（memory barrier），当原子操作在进行时，其他任务都不能对内存操作，会影响其他任务的执行。因此这种原子操作实际上属于一种激烈竞争的锁，不过由于它的操作时间很快，因此可以看成是一种极细粒度锁。
在无锁(Lock－free)编程环境中，主要使用的原子操作为CAS（Compare and Swap）操作，在VC里对应的操作为InterlockedCompareExchange或者InterlockedCompareExchangeAcquire；如果是64位的操作，需要使用InterlockedCompareExchange64或者InterlockedCompareExchangeAcquire64。使用这种原子操作替代锁的最大的一个好处是它是非阻塞的。
按照微软MSDN的说明，InterlockedCompareExchange带有全局的内存栅障(full memory barrier)，在使用了full memory barrier的情况下，即使不是访问同一内存变量的原子操作也会发生竞争，从竞争形式上来讲，会发生固定式锁竞争或随机锁竞争现象，并且无法实现分布式锁竞争的竞争模式，比起使用普通锁的竞争会更激烈，因此最终得到的加速比会比上一篇文章里讲的固定式锁竞争还要糟糕。
对于象InterlockedCompareExchangeAcquire这类的原子操作，没有使用full memory barrier，因此性能理论上会比使用full memory barrier的原子操作好很多（由于目前这类原子操作只有在特定的机器才支持，具体性能到底如何没有测试过，微软的MSDN里也对性能方面作出说明）。但是如果采用固定式锁竞争形式，其加速比仍然是按照前面的固定式锁竞争的加速比公式来计算：


由于原子操作速度比锁快，其实相比于普通锁操作，相当于加锁解锁时间 1减少了2～3倍左右，不妨以2倍来计算，对应的任务粒度会增大一倍，为 ，另外由于原子操作内的锁内计算通常只是简单一两条指令，因此其锁粒度很小，可以近似看成为0，因此加速比为：

因此在固定式锁竞争情况下，加速比的极限值约等于使用普通锁时的2倍任务粒度大小，大约比使用 普通锁时的加速比大一倍左右。加速比并不能随CPU核数增长而线性增加。
对于随机式锁竞争情况，加速比为： 
如果讲普通锁操作改成原子操作，将锁粒度近似看成0，那么 ，对于任务粒度非常大的情况，概率p的增加并不大；对于任务粒度非常小的情况，概率p最大可以增大近似一倍，加速比相比于普通锁也可以获得一定程度的提高。
对于普通锁随机竞争情况下的最坏情况，加速比为：

改成原子操作后，加速比为：

只是相对于普通锁竞争情况提高了一些，并不能随CPU核数增加而增加。
注意上面没有考虑无锁编程的算法开销，采用无锁编程时，要完成一个CAS操作需要在一个循环里来完成，有可能要循环很多次才能完成一次写操作，因此实际性能并达不到上面的计算结果。
因此即使使用无锁编程，如果锁竞争形式仍然是固定式竞争或随机竞争的形式，加速比性能仍然是不乐观的，仍然跟分布式锁竞争的加速比差很远，因为分布式锁竞争在最坏情况下加速比也可以做到接近CPU核数。
当然有人也会提出，既然分布式锁竞争的加速比性能这么好，那么将原子操作替代普通锁来进行分布式竞争，岂不是可以取得更好的加速比性能？理论上来说，如果以不带full memory barrier的原子操作来替代普通锁进行分布式竞争，是可以取得比普通锁进行分布式竞争更好的加速比，分布式加速比为 ，使用原子操作后，任务粒度将会增大2~3倍，对于任务粒度非常小的情况，比如任务粒度小于0.5（这种情况实际中很难出现），加速比将比使用普通锁时增大一倍左右，对于任务粒度较大的情况，加速比增加并不明显。
对于任务粒度的大小，很大程度上取决于程序员对任务的划分，只要程序员在划分任务时不要将任务粒度划得太小，这样就可以降低任务粒度对加速比造成的影响。
但是使用分布式锁竞争时，性能已经可以和单核多任务时的程序性能接近了，使用无锁编程难度非常高，程序复杂度也非常高，非专业人士难以掌握，普通程序员想要进行无锁编程几乎是不可能的事情。而分布式编程的难度和以前单核多任务时代的数据结构算法编程难度差不多，普通程序员都可以掌握。因此在实际情况中只要任务粒度不是太小，就没有必要过于追求性能，使用普通锁的分布式锁竞争已经足够了。
从目前无锁编程的发展来看，已经实现了的无锁算法很有限，并且功能也很有限，并且无锁编程是独立于以前的单核时代的编程的，使用无锁编程几乎无法复用以前的成果。分布式编程是在原有的单核多任务编程基础上发展而来，可以继承以前单核时代的成果，比如队列池便可以继承已有的队列算法，因此采用分布式编程可以大大减轻将现有单核程序移植到多核系统中的工作量，只要对现有程序进行一些重构即可完全支持多核CPU系统。
综上所述，可以得到下表所示的结论




 


比较项目


无锁编程


分布式编程




1


加速比性能


取决于竞争方式，除非也采用分布式竞争，否则不如分布式锁竞争的性能


加速比和CPU核数成正比关系，接近于单核多任务时的性能




2


实现的功能


有限


不受限制




3


程序员掌握难易程度


难度太高，过于复杂，普通程序员无法掌握，目前世界上只有少数几个人掌握。


和单核时代的数据结构算法难度差不多，普通程序员可以掌握




4


现有软件的移植


使用无锁算法后，以往的算法需要废弃掉，无法复用


可以继承已有的算法，在已有程序基础上重构即可。





从上表的四个方面的综合比较可以看出，无锁编程的实用价值是远远不如分布式编程的，因此分布式编程比无锁编程更适合多核CPU系统。 
Share on Facebook
	Related posts
	
	能过PB的cod5多人作弊. (11)
	Visual Studio 2008 Stuffs &#8230;URL records (0)
	Never touch cod4 [...]]]></description>
		<wfw:commentRss>http://yeuo.com/index.php/archives/67/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
