<?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>格物致知 &#187; 计算机网络</title>
	<atom:link href="http://leeing.org/category/computer-network/feed/" rel="self" type="application/rss+xml" />
	<link>http://leeing.org</link>
	<description>keep Thinking</description>
	<lastBuildDate>Fri, 04 Nov 2011 16:20:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>PeerSim 源代码分析之一：程序入口</title>
		<link>http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 03:17:58 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[PeerSim]]></category>

		<guid isPermaLink="false">http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/</guid>
		<description><![CDATA[PeerSim 的文档资料很少，有很多地方看上去概念很模糊，去年曾经翻译过官方的几篇文档，按顺序汇总如下： PeerSim 中文教程：解析 Cycle-based 模式仿真 PeerSim 中文教程：编写一个新协议 PeerSim 中文教程：拓扑生成器 PeerSim 中文教程：Event-driven 模型&#160; 当时翻译的时候，并没有深入地去学习，最近由于仿真的需要，又静下心来研究了几天，有些东西发现在文档中是无法得到一个很清晰的解释，看了一下PeerSim的源代码规模也并不是很大，所以决定 RTFSC (Read the F *** ing Source Code : –) ，源代码本身就是最好的学习资料，当然，这需要足够的耐心。 不过不得不说的是 PeerSim 的源代码的缩进真是有点混乱。 首先，是程序的入口 peersim.Simulator.java： package peersim; import java.io.*; import peersim.cdsim.*; import peersim.config.*; import peersim.core.*; import peersim.edsim.*; /** * peersim.Simulator.java * * 程序的入口，主要作用就是读取配置文件，并根据仿真类型来调用仿真引擎。 */ public class Simulator { // 某些静态变量，一看就懂。 [...]


Related posts:<ol><li><a href='http://leeing.org/2010/07/02/peersim-turtorial-how-to-write-a-new-protocol/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：编写一个新协议'>PeerSim 中文教程：编写一个新协议</a></li>
<li><a href='http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：Event-driven 模型'>PeerSim 中文教程：Event-driven 模型</a></li>
<li><a href='http://leeing.org/2010/07/02/peersim-turtorial-topology-generator/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：拓扑生成器'>PeerSim 中文教程：拓扑生成器</a></li>
<li><a href='http://leeing.org/2011/11/05/swing-%e5%b0%86-system-out-%e9%87%8d%e5%ae%9a%e5%90%91%e5%88%b0-jtextarea-%e5%92%8c-jtextpane-%e5%b0%81%e8%a3%85%e7%89%88/' rel='bookmark' title='Permanent Link: Swing : 将 System.out 重定向到 JTextArea 和 JTextPane (2)'>Swing : 将 System.out 重定向到 JTextArea 和 JTextPane (2)</a></li>
<li><a href='http://leeing.org/2011/02/24/java-%e5%a4%9a%e7%ba%bf%e7%a8%8b%ef%bc%9a%e6%8d%95%e6%8d%89%e7%ba%bf%e7%a8%8b%e4%b8%ad%e9%80%83%e9%80%b8%e7%9a%84%e5%bc%82%e5%b8%b8/' rel='bookmark' title='Permanent Link: Java 多线程：捕捉线程中逃逸的异常'>Java 多线程：捕捉线程中逃逸的异常</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPV6 Tracker : 从 PPA 安装 Transmission 2.21</title>
		<link>http://leeing.org/2011/02/22/ipv6-tracker-%e4%bb%8e-ppa-%e5%ae%89%e8%a3%85-transmission-2-21/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2011/02/22/ipv6-tracker-%e4%bb%8e-ppa-%e5%ae%89%e8%a3%85-transmission-2-21/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 15:12:02 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[BT]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Transmission]]></category>

		<guid isPermaLink="false">http://leeing.org/2011/02/22/ipv6-tracker-%e4%bb%8e-ppa-%e5%ae%89%e8%a3%85-transmission-2-21/</guid>
		<description><![CDATA[这两天一直在安装配置 Transmission，由于Ubuntu 源中的 Transmission 版本是2.0.5，经过试用之后，发现默认对 IPV6 的支持不好，无法连接北邮人BT的Tracker，于是开始了漫漫的修改源码+编译的旅程（关于编译，又是很多稀奇古怪的问题出现），虽然最终成功编译出二进制文件，但很奇怪的是自行编译的 Transmission 一旦打开一个种子，很快就CPU占用率飙升，最终进程 transmission-daemon 僵死 &#8211; -！ Transmission 2.21的Changelog： Fix compile error in the the 2.20 tarball File re-verification is no longer needed in some situations Fix “Too many open files” error Show the total downloading and seeding time per torrent Fix webseeds Better support for IPv6-only trackers Add [...]


Related posts:<ol><li><a href='http://leeing.org/2011/02/22/defunct-%e8%bf%9b%e7%a8%8b-%e5%83%b5%e5%b0%b8%e8%bf%9b%e7%a8%8b/' rel='bookmark' title='Permanent Link: defunct 进程 (僵尸进程)'>defunct 进程 (僵尸进程)</a></li>
<li><a href='http://leeing.org/2010/04/13/install-r-in-ubuntu-karmic/' rel='bookmark' title='Permanent Link: Ubuntu 9.10 安装 R'>Ubuntu 9.10 安装 R</a></li>
<li><a href='http://leeing.org/2011/02/25/ubuntu-10-10-%e5%ae%89%e8%a3%85-hadoop-cdh-beta4/' rel='bookmark' title='Permanent Link: Ubuntu 10.10 安装 Hadoop (CDH beta4)'>Ubuntu 10.10 安装 Hadoop (CDH beta4)</a></li>
<li><a href='http://leeing.org/2010/04/17/chromium-google-chrome-for-linux/' rel='bookmark' title='Permanent Link: Chromium : Google chrome for linux'>Chromium : Google chrome for linux</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2011/02/22/ipv6-tracker-%e4%bb%8e-ppa-%e5%ae%89%e8%a3%85-transmission-2-21/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JXTA/JXSE 2.6 的最新消息</title>
		<link>http://leeing.org/2010/09/29/news-of-jxta-2-6/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2010/09/29/news-of-jxta-2-6/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 12:42:48 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[P2P]]></category>

		<guid isPermaLink="false">http://leeing.org/?p=661</guid>
		<description><![CDATA[JXTA/JXSE 2.6 JXTA 是什么？请参见 百度百科。 刚刚在网上搜索了一下 JXTA 的状态，才知道在几个月前已经出了2.6版本。JXTA在2001年初刚刚被创建时曾被寄予厚望，但是bug不少，文档也很匮乏，在2007年出了2.5版本之后几年没什么动静，断断续续地有少数的snapshot版本发布。 在 https://jxta-jxse.dev.java.net/ 依旧是2.5版本，其实JXTA已经迁移到 Kenai 平台上，地址是 http://jxse.kenai.com，需要到可以到前面这个网址下载。 关于 JXTA 2.6 的消息在网络上中文信息也很少，blogspot 上倒是有一篇文章《JATX/JXSE 2.6 is out》，大致是说重新启动了这个项目并裁剪重构了很多老的代码，下面简要地说说这个版本的新特性： OSGI支持 任务管理器 缓存管理器 配置对象 连接方法 新的基于Netty的TCP实现 改进的文档 另外，出版了一本新书《Practical JXTA II》。 目前尚不知道JXTA在最近的项目中能否起到什么作用，先暂时看一下。 // No related posts.


No related posts.]]></description>
		<wfw:commentRss>http://leeing.org/2010/09/29/news-of-jxta-2-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PeerSim 中文教程：Event-driven 模型</title>
		<link>http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 11:32:44 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[P2P]]></category>
		<category><![CDATA[PeerSim]]></category>

		<guid isPermaLink="false">http://leeing.org/?p=637</guid>
		<description><![CDATA[1. 介绍 本教程使用Event-driven模型来演示一个简单的例子，仍然使用的是gossip-based平均数协议，对消息的发送将进行更细节的建模；通过与cycle-based模型的对比，可以发现本协议存在的问题。 在Event-based模型中，除了时间管理和control传递给protocols的方式以外，其它与cycle-based模型相同。不可执行的Protocols（只用于存储数据，比如只存储邻居节点的linkable协议，或存储数值的vectors）可以以同样的方式应用和初始化，在peersim.cdsim包之外的controls也都可以使用。在默认情况下，在cycle-based模型中，controls会的每个周期中调用 ，但在event-based模型中，它们需要进行明确的调度，因为事件驱动模型并不存在周期的概念。 显然，我们可以编写专用于event-based模型的controls，即可以给协议发送事件（消息）。在很多情况下，这是必要的，因为系统经常完全或部分地由外部事件如用户的查询来驱动 ，这能很好地用由生成这些事件，并且驱动仿真执行的controls进行建模。 有些组件是不可用的。例如依赖于静态类peersim.cdsim.CDState（它提供了读取cycle相关的全局状态的接口）的所有组件。我们的经验是，很多依赖于这个状态的 cycle-based 组件可以经过简单的修改并删除这个依赖。 然而，可能有些令人吃惊的是，实现了cycle-based接口的peersim.cdsim.CDProtocol也可以使用于event-based模型，但是必须指出，在大部份的情况下这样做没有什么意义。然而，这个特性的有用之处在于：它让周期性地调用protocols变得很简单，这是一个几乎对所有与housekeeping，失效检测和sending heartbeat message有关的P2P协议来说典型的特性。 2. Protocol 下面以event-based模型来实现平均数协议： package example.edaggregation; import peersim.vector.SingleValueHolder; import peersim.config.*; import peersim.core.*; import peersim.transport.Transport; import peersim.cdsim.CDProtocol; import peersim.edsim.EDProtocol; /** * Event driven version of epidemic averaging. */ public class AverageED extends SingleValueHolder implements CDProtocol, EDProtocol { 首先，这里同时实现了EDProtocol和CDProtocol接口，前者能让这个类能处理输入的消息，后者则可能令人困惑，因为它属于cycle-based模型的接口。但注意 event-based 的协议不是必须实现CDProtocol接口的，然而想要实现一个可以周期性取得control的协议时，可以通过实现CDProtocol接口，并在配置文件中设置一个CDScheduler 来实现。这样，代码就显得更清晰：以一个单独的组件来管理周期性的执行，而且能单独地进行配置。最后，我们还能简单地将 cycle-based 的协议移植到 event-based 模型上。 [...]


Related posts:<ol><li><a href='http://leeing.org/2010/07/02/peersim-turtorial-how-to-write-a-new-protocol/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：编写一个新协议'>PeerSim 中文教程：编写一个新协议</a></li>
<li><a href='http://leeing.org/2010/07/02/peersim-turtorial-topology-generator/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：拓扑生成器'>PeerSim 中文教程：拓扑生成器</a></li>
<li><a href='http://leeing.org/2010/06/30/peersim-turtorial-analyse-of-cycle-based-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：解析 Cycle-based 模式仿真'>PeerSim 中文教程：解析 Cycle-based 模式仿真</a></li>
<li><a href='http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/' rel='bookmark' title='Permanent Link: PeerSim 源代码分析之一：程序入口'>PeerSim 源代码分析之一：程序入口</a></li>
<li><a href='http://leeing.org/2010/01/20/common-p2p-simulator/' rel='bookmark' title='Permanent Link: 常用的 P2P 仿真平台'>常用的 P2P 仿真平台</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PeerSim 中文教程：拓扑生成器</title>
		<link>http://leeing.org/2010/07/02/peersim-turtorial-topology-generator/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2010/07/02/peersim-turtorial-topology-generator/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 11:35:15 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[P2P]]></category>
		<category><![CDATA[PeerSim]]></category>

		<guid isPermaLink="false">http://leeing.org/?p=612</guid>
		<description><![CDATA[本教程描述了如何构建一个新的 PeerSim 拓扑生成器。 1. 什么是拓扑？为什么它很重要？ 在一个大型的动态P2P系统中，节点没有关于整个网络的信息，而所有的节点都可能拥有一些邻居节点，即节点能”感知”的peers，这种”感知”的关系就定义了一个覆盖网络，这是P2P系统中的一个基本概念。 很多P2P协议都需要在多个不同的网络拓扑上进行实验。PeerSim中的peersim.dynamic.Wire*类已经包含了很多拓扑结构，可以直接用来对linkable协议进行初始化，本教程将展示如何构建一个自定义的拓扑生成器。 2. 一个用来模拟Internet的简单模型 下面我们将编写一个拓扑生成器来构建类似于Internet的树状拓扑，整个构建过程基于一个特定的，与位置相关的preferential attachment方法，编写规则很简单，并且会考虑几何和网络的限制以更好地模拟真实的网络。Preferential attachment由参数a来调整，这个参数能扩大或减少几何位置所带来的影响。 这个规则的策略如下：给定一个单位正方形，将x0置于中心，即x0 = (0.5,0.5)，这个节点被称为root，令W()为与root相隔的跳数(hops)，对于i=1 … n-1，随机在单位正方形中选择一个xi，然后选择使下面的表达式值最小的节点xj来连接它： 在这里dist()是欧几里德距离而a (alpha)是权重参数，显然， 通过这个方案我们得到了一个x0以为根的树。这个拓扑中每个节点(除了root外)的出度都为1,如果想更深入地理解这个模型，可以参考下面的文章： Heuristically Optimized Trade-offs: A New Paradigm for Power Laws in the Internet Degree distributions of the FKP network model On Power-Law Relationships of the Internet Topology 3. 如何编码 我们的目标是编写一个可以根据 a (alpha)参数生成所需拓扑的PeerSim组件，并且能对生成的拓扑进行分析。这个拓扑可以在仿真过程中逐步生成，也可以用一个步骤生成拓扑，在这里我们倾向后者。为了构建需要的拓扑结构，我们需要下面的组件（注意这只是其中一种方案）。 一个protocol 类，可以存储坐标，它不具备行为元素，只是一个普通的容器。 一个initializer 类，可以为每个节点设置坐标值。 [...]


Related posts:<ol><li><a href='http://leeing.org/2010/07/02/peersim-turtorial-how-to-write-a-new-protocol/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：编写一个新协议'>PeerSim 中文教程：编写一个新协议</a></li>
<li><a href='http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：Event-driven 模型'>PeerSim 中文教程：Event-driven 模型</a></li>
<li><a href='http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/' rel='bookmark' title='Permanent Link: PeerSim 源代码分析之一：程序入口'>PeerSim 源代码分析之一：程序入口</a></li>
<li><a href='http://leeing.org/2010/06/30/peersim-turtorial-analyse-of-cycle-based-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：解析 Cycle-based 模式仿真'>PeerSim 中文教程：解析 Cycle-based 模式仿真</a></li>
<li><a href='http://leeing.org/2010/04/30/swing-redirecting-system-out-and-system-err-to-jtextpane-or-jtextarea/' rel='bookmark' title='Permanent Link: Swing : 将 System.out 重定向到 JTextArea 和 JTextPane'>Swing : 将 System.out 重定向到 JTextArea 和 JTextPane</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2010/07/02/peersim-turtorial-topology-generator/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PeerSim 中文教程：编写一个新协议</title>
		<link>http://leeing.org/2010/07/02/peersim-turtorial-how-to-write-a-new-protocol/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2010/07/02/peersim-turtorial-how-to-write-a-new-protocol/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 16:52:29 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[P2P]]></category>
		<category><![CDATA[PeerSim]]></category>

		<guid isPermaLink="false">http://leeing.org/?p=592</guid>
		<description><![CDATA[本文的目的是在PeerSim中用Cycle-based模型实现一个简单的负载均衡算法。节点的状态有两种值：本地负载（local load）和配额(quota)，其中配额是指节点在每个周期中允许传输的“负载”的大小。配额是必要的，是一个时间单元中能传输的负载上限。每个节点与和它距离最远的邻居节点交换配额值，这里“距离最远”是指与当前节点的负载差异最大。经过对比距离，协议将在负载均衡时选用push或pull的方式。 在每个周期之后，配额值将会被存储。协议并不关心拓扑管理，它依赖于其它组件来访问邻居节点（例如，Newscast，或者由IdleProtocol实现的静态拓扑）。 一. 必要的组件 一般来说只编写一个协议类是不足够的，还需要一些附加的组件。例如，为了在每个周期结束时为每个节点存储配额值，需要一个特定的Control对象。基本上来说，PeerSim是一个可替换的组件集合，所以在开发时需要注意模块化以让代码尽可能重用，出于这样的目的，我们这样设计下面的类： protocol 它基于peersim.vector.SimpleValueHolder，这是一个简单的基类，用于访问一个浮点变量。Aggreation协议也使用了同样的基类。 ResetQuota 用于在每个周期结束时存储每个节点配额的control。 QuotaObserver 一个control，用于监视quota参数，即覆盖网中交换的流量大小。 initialization 这是在aggregation示例中的初始化器，这里也可以直接使用，因为它们实现了同样的接口SingleValueHolder。注意在example包中提供的初始化器是轻量级的，开发者应当更多地使用peersim.vector.*包中的初始化器。 observers 可以使用aggreagation.AverageObserver，因为这些组件实现了相同接口。 下面将根据源代码来解释这一过程： package example.loadbalance; import peersim.config.Configuration; import peersim.config.FastConfig; import peersim.core.*; import peersim.vector.SingleValueHolder; import peersim.cdsim.CDProtocol; public class BasicBalance extends SingleValueHolder implements CDProtocol { protected static final String PAR_QUOTA = "quota"; /** Quota amount. Obtained from config property {@link #PAR_QUOTA}. */ private [...]


Related posts:<ol><li><a href='http://leeing.org/2010/07/02/peersim-turtorial-topology-generator/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：拓扑生成器'>PeerSim 中文教程：拓扑生成器</a></li>
<li><a href='http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：Event-driven 模型'>PeerSim 中文教程：Event-driven 模型</a></li>
<li><a href='http://leeing.org/2010/06/30/peersim-turtorial-analyse-of-cycle-based-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：解析 Cycle-based 模式仿真'>PeerSim 中文教程：解析 Cycle-based 模式仿真</a></li>
<li><a href='http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/' rel='bookmark' title='Permanent Link: PeerSim 源代码分析之一：程序入口'>PeerSim 源代码分析之一：程序入口</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2010/07/02/peersim-turtorial-how-to-write-a-new-protocol/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PeerSim 中文教程：解析 Cycle-based 模式仿真</title>
		<link>http://leeing.org/2010/06/30/peersim-turtorial-analyse-of-cycle-based-model/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2010/06/30/peersim-turtorial-analyse-of-cycle-based-model/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 08:33:50 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[PeerSim]]></category>
		<category><![CDATA[P2P]]></category>

		<guid isPermaLink="false">http://leeing.org/?p=574</guid>
		<description><![CDATA[本文介绍了PeerSim的基本概念，并解析了两个示例以更清晰地说明PeeSim的仿真流程。 Peersim支持两种仿真模式，即Cycle-based的模型和传统的event-based的模型，本文专注于前者， Cycle-based模型是一个简化的模型，拥有更好的伸缩性及性能，在拥有4GB内存的情况下，event-driven模式目前最多支持十万节点级别，而cycle-based模式则支持千万个节点级别。 但是Cycle-based模型缺少对传输层的仿真和并行处理，节点之间是直接通信的，仿真核心以一定的顺序周期性地给以节点控制。在运行时，可以进行任意的操作，如调用其它对象的方法并执行一些计算。 Cycle-based模型损失了一些真实性，虽然一些简单的协议可以忽略这些差别，但是在选择使用这个模型时，需要注意这些区别。我们可以相对简单地将Cycle-based的仿真移植到Event-driven引擎上，但在本文中不讨论这个话题。 一．基本介绍 PeerSim鼓励基于接口的模块化编程，每一个组件都能被其它实现了相同接口的组件代替，一般的仿真过程如下： 选择网络大小（即节点数量）。 选择要实验的一个或多个协议并进行初始化。 选择一个或多个Control对象来监视感兴趣的属性，并在仿真时修改一些参数（比如，网络大小，协议的内部状态，等等）。 根据配置文件，调用Simulator类运行仿真。 在仿真时创建的对象都是实现了一个或多个接口的类的实例，主要的接口如下所示： Node P2P网络是由节点组成的，节点是协议的容器。Node接口提供了对节点所包含的协议的访问方法，并为节点提供了固定的ID。 CDProtocol 这是一个特定的协议，被设计用来在Cycle-based模型中运行，它只定义了在每一个周期中要运行的操作。 Linkable 一般都由协议来实现，这个接口为其它协议提供了访问邻居节点集合的服务，节点间相同的linkable协议类的实例定义了一个覆盖网络。 Control 实现了这个接口的类可以在仿真期间的某个时间点调度执行，这些类一般用于观察或修改仿真过程。 Cycle-based仿真的生命周期是这样的： 读取配置文件（通过命令行参数传递进来），然后仿真器初始化网络中的节点和节点中的协议，每个节点都拥有相同的协议栈。节点和协议的实例是通过克隆来创建的，只有一个原型是通过构造方法创建，其它的节点和协议都是从这个原型中克隆而来。基于这个原因，协议类中clone方法的实现是很重要的。 初始化操作，设置每个协议的初始状态。初始化阶段是由Control对象控制运行的，仅在实验开始时运行一次。在配置文件中，初始化的组件可以由init前缀识别，在下面讨论的initializer对象也是controls，但为了标记其功能以区别于一般的Control对象，它被配置用来在初始阶段运行。 在初始化完成后，Cycle-based引擎在每一个周期中调用所有组件（protocols和controls）一次，直到完成了指定的周期数，或者某个组件决定终止仿真为止。在PeerSim中每一个对象（controls和protocols）都被赋以一个Scheduler对象，它定义了什么时候本组件将会被执行。在默认情况下，所有对象都会在每个周期中运行。但我们也可以配置一个protocol或control只在某些特定的周期中运行，也可以在每一个周期中指定组件的执行顺序。 下图展示了对controls和protocols的调度，其中C代表Control而P代表一个协议。图下方的数字代表PeerSim的周期，在最后一个周期后，可以运行一个control来获取最后的快照（snapshot）。 在一个Control收集数据时，数据将会被格式化并发送到标准输出或重定向到一个文件以进行后续的处理。 配置文件只是一个普通的ASCII文本，本质上就是java.util.Properties，以#开头的行代表注释。 用以下的方式在命令行的模式下运行，比如： java -cp peersim.Simulator config-edexample.txt 具体来说，可能是： java -cp D:\library\peersim-1.0.5\jep-2.3.0.jar;D:\library\peersim-1.0.5\djep-1.0.0.jar;D:\library\peersim-1.0.5\peersim-1.0.5.jar;D:\library\peersim-1.0.5\peersim-doclet.jar peersim.Simulator D:\library\peersim-1.0.5\example\config-edexample.txt 当然你的jar包和配置文件的位置可能有所不同，也可以将这个jar包直接加到 classpath上，就不必使用-cp参数来显示指定classpath。 二．配置文件示例一 Gossip-based Aggregation协议，Aggregation是聚集的意思，这里是指对一个分布于网络中的数值集合运行一个特定的函数进行计算（如求平均数，最大值，最小值等等），每个节点周期性地选择一个邻居节点进行通讯（基于覆盖网），并且在每次通讯时，基于前一个取得的近似值，相互更新它们下次计算的近似值。 本例将创建一个由50000个节点组成的固定P2P随机拓扑，选定的协议是使用average函数的Aggregation协议，每个节点中用于求平均的值使用一个区间在(0,100)的线性分布来初始化，最后再定义一个Control监视平均值。 # PEERSIM EXAMPLE 1 random.seed 1234567890 simulation.cycles 30 control.shf Shuffle network.size [...]


Related posts:<ol><li><a href='http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：Event-driven 模型'>PeerSim 中文教程：Event-driven 模型</a></li>
<li><a href='http://leeing.org/2010/07/02/peersim-turtorial-topology-generator/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：拓扑生成器'>PeerSim 中文教程：拓扑生成器</a></li>
<li><a href='http://leeing.org/2010/07/02/peersim-turtorial-how-to-write-a-new-protocol/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：编写一个新协议'>PeerSim 中文教程：编写一个新协议</a></li>
<li><a href='http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/' rel='bookmark' title='Permanent Link: PeerSim 源代码分析之一：程序入口'>PeerSim 源代码分析之一：程序入口</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2010/06/30/peersim-turtorial-analyse-of-cycle-based-model/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>用户访问行为，齐普夫分布及其 Java 实现</title>
		<link>http://leeing.org/2010/05/18/user-behavior-zipf-distribution-and-java-implementation/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2010/05/18/user-behavior-zipf-distribution-and-java-implementation/#comments</comments>
		<pubDate>Tue, 18 May 2010 08:47:02 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[CDN]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[Zipf distribution]]></category>

		<guid isPermaLink="false">http://leeing.org/?p=541</guid>
		<description><![CDATA[Zipf定律是文献计量学的重要定律之一，它和罗特卡定律、布拉德福定律一起被并称为文献计量学的三大定律。 对于CDN的内容管理，也近似符合Zipf 定律，就是大家常说对于内容的访问遵循80/20原则，也就是20%的内容，会占有80%的访问量。 这里 r 表示一个单词的出现频率的排名，P(r)表示排名为r的单词的出现频率. (单词频率分布中 C约等于0.1, a约等于1) 后人将这个分布称为zipf distribution，中文名称为齐普夫分布或Zeta 分布。这是一个离散事件分布，广泛应用于语言学，保险学，网络模拟，以及对稀疏事件的建模中。 它表明在英语单词中,只有极少数的词被经常使用,而绝大多数词很少被使用。实际上,包括汉语在内的许多国家的语言都有这种特点。这个定律后来在很多领域得到了同样的验证，包括网站的访问者数量、城镇的大小和每个国家公司的数量。。这个定理也在很多分布里面得到了验证，比如人们的收入，互联网的网站数量和访问比例，互联网内容和访问比例(其他分布两个常数有所不同,a越大，分布越密集,对于VOD来说某些时候符合双zipf分布)。 比起枯燥的公式，图表更具有说服力，下面是用三百个严格符合zipf 分布的数据点描绘成的图，其中横轴表示排名，纵轴表示访问的频率，分别使用线性坐标和对数坐标表示： 可以看到对数坐标下是一条完美的直线。 在很多网页的用户访问行为中，都是近似于zipf 分布的，例如下表是www.sun.com 在1996 年7月的页面访问情况： zipf 定律也可以用于其它领域，例如下面的表格的横轴表示城市的人口排名的对数值，而纵轴则是人口数量的对数值。 编程实现：Mathematica，R，还有Java都有相应的API，在这里，主要讨论Java。 在模拟用户的访问请求时，可以近似地使用zipf 定律， Apache Foundation 的commons-math 项目提供了一个Java实现： 在org.apache.commons.math.distribution 包中的类： ZipfDistributionImpl(int numberOfElements, double exponent) Create a new Zipf distribution with the given number of elements and exponent. 它提供的方法主要有： double cumulativeProbability(int x) 概率密度函数：P(X &#60;= x) 的值。 [...]


Related posts:<ol><li><a href='http://leeing.org/2010/01/17/java-%e7%9a%84%e5%bc%95%e7%94%a8%e4%bc%a0%e9%80%92/' rel='bookmark' title='Permanent Link: Java 的引用传递'>Java 的引用传递</a></li>
<li><a href='http://leeing.org/2010/01/17/java-constructor/' rel='bookmark' title='Permanent Link: Java 的构造方法'>Java 的构造方法</a></li>
<li><a href='http://leeing.org/2011/01/18/java-io-%e7%ae%80%e4%bb%8b/' rel='bookmark' title='Permanent Link: Java IO 简介'>Java IO 简介</a></li>
<li><a href='http://leeing.org/2011/02/24/java-%e5%a4%9a%e7%ba%bf%e7%a8%8b%ef%bc%9a%e6%8d%95%e6%8d%89%e7%ba%bf%e7%a8%8b%e4%b8%ad%e9%80%83%e9%80%b8%e7%9a%84%e5%bc%82%e5%b8%b8/' rel='bookmark' title='Permanent Link: Java 多线程：捕捉线程中逃逸的异常'>Java 多线程：捕捉线程中逃逸的异常</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2010/05/18/user-behavior-zipf-distribution-and-java-implementation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OMNeT++ 的仿真流程</title>
		<link>http://leeing.org/2010/03/06/simulation-with-omnetpp-chinese-edition/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2010/03/06/simulation-with-omnetpp-chinese-edition/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 04:01:43 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[OMNeT++]]></category>
		<category><![CDATA[计算机网络]]></category>

		<guid isPermaLink="false">http://leeing.org/?p=306</guid>
		<description><![CDATA[Simulation with OMNeT++ 用OMNeT++进行仿真的大致流程如下： 一个OMNeT++模型是用通过交换信息来通讯的组件（模块）来构建的。模块可以嵌套，也就是说，几个模块可以组成一个复合模块。在创建模型时，你需要将系统映射到一个相互通讯的模块体系中。 用NED语言定义模型的结构。你可以在OMNet++提供的IDE中以文本或图形化方式来编辑NED文件。 模型的活动组件（简单模块）需要用C++来编程，当中要使用仿真内核及类库。 提供一个拥有配置和参数的omnetpp.ini文件给模型，一个配置文件可以用不同的参数来描述若干个仿真过程。 构建仿真程序并运行它。你可以将代码链接到OMNet++的仿真内核及其提供的一个用户接口：命令行和交互式接口或图形化接口。 仿真结果将写入输出向量和输出标量文件中。你可以使用IDE中提供的分析工具来进行可视化。结果文件是普通的文本，所以你能用R,Matlab或其它工具来进行绘图。 原文在 &#62;&#62; 这里 &#60;&#60;。 Related posts:OMNet++ 10 分钟教程 OMNet++ 中的 NED 语言学习(1)


Related posts:<ol><li><a href='http://leeing.org/2010/03/05/omnetpp-in-a-nutshell-chinese-edition/' rel='bookmark' title='Permanent Link: OMNet++ 10 分钟教程'>OMNet++ 10 分钟教程</a></li>
<li><a href='http://leeing.org/2010/01/24/the-ned-language-of-omnetpp-4-0/' rel='bookmark' title='Permanent Link: OMNet++ 中的 NED 语言学习(1)'>OMNet++ 中的 NED 语言学习(1)</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2010/03/06/simulation-with-omnetpp-chinese-edition/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OMNet++ 10 分钟教程</title>
		<link>http://leeing.org/2010/03/05/omnetpp-in-a-nutshell-chinese-edition/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2010/03/05/omnetpp-in-a-nutshell-chinese-edition/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 13:22:19 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[OMNeT++]]></category>
		<category><![CDATA[计算机网络]]></category>

		<guid isPermaLink="false">http://leeing.org/?p=297</guid>
		<description><![CDATA[OMNet++ in a nutshell // 本文适合对网络模拟器有一定了解的读者，阅读本文时，最好同时打开用户手册和API文档以便随时查阅。 1. 在omnetpp.org中提到的仿真模型和框架与OMNet++是什么关系？ OMNet++提供了基本的工具和机制来编写仿真代码，但它本身并不提供任何特定用于计算机网络仿真，系统架构仿真和任意其它领域的组件；具体的仿真是由一些仿真模型和框架如Mobility Framework或INET Framework来支持，这些模型独立于OMNet++开发，并有自己的发布周期。 2. OMNet++提供了什么？ 一个C++库，它由仿真内核及一些用来创建仿真组件（简单模块和信息）的工具类（如随机数生成，统计收集，拓扑发现等）；组装和配置这些组件的基础设施（NED语言，ini文件）；运行时用户接口或仿真环境（TKenv,Cmdenv）；一个用来设计，运行和评估仿真的IDE环境；实时仿真的扩展接口；MRIP，并行的分布式仿真，数据库连接等等这些组成。 3. OMNet++的仿真模型是什么样的？ OMNet++提供了一个基于组件的架构，模型是由可重用的组件或模块组成的。模块之间可以通过gates（在其它系统中称为ports，即端口）进行连接，以构成复合模块。每个仿真模型是一个复合模块类型的实例。这一层次（组件和拓扑）由NED文件来处理。例如，一个名为EtherMAC的组件可以用NED来描述： // // Ethernet CSMA/CD MAC // simple EtherMAC { parameters: string address; // others omitted for brevity gates: input phyIn; // to physical layer or the network output phyOut; // to physical layer or the network input llcIn; [...]


Related posts:<ol><li><a href='http://leeing.org/2010/01/25/the-ned-language-of-omnetpp-4-0-part-2/' rel='bookmark' title='Permanent Link: OMNet++ 中的 NED 语言学习(2)'>OMNet++ 中的 NED 语言学习(2)</a></li>
<li><a href='http://leeing.org/2010/01/24/the-ned-language-of-omnetpp-4-0/' rel='bookmark' title='Permanent Link: OMNet++ 中的 NED 语言学习(1)'>OMNet++ 中的 NED 语言学习(1)</a></li>
<li><a href='http://leeing.org/2010/01/28/the-ned-language-of-omnetpp-4-0-part-3/' rel='bookmark' title='Permanent Link: OMNet++ 中的 NED 语言学习(3)'>OMNet++ 中的 NED 语言学习(3)</a></li>
<li><a href='http://leeing.org/2010/03/06/simulation-with-omnetpp-chinese-edition/' rel='bookmark' title='Permanent Link: OMNeT++ 的仿真流程'>OMNeT++ 的仿真流程</a></li>
<li><a href='http://leeing.org/2010/01/21/a-quick-overview-of-the-omnetpp4-ide-chinese-edition/' rel='bookmark' title='Permanent Link: OMNeT/OMNEST 4.0 集成开发环境概述'>OMNeT/OMNEST 4.0 集成开发环境概述</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2010/03/05/omnetpp-in-a-nutshell-chinese-edition/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

