<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Experiences with CompSci</title>
	<atom:link href="http://ubirevera.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ubirevera.wordpress.com</link>
	<description>Facts resist fading away</description>
	<lastBuildDate>Sat, 06 Feb 2010 14:49:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ubirevera.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Experiences with CompSci</title>
		<link>http://ubirevera.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ubirevera.wordpress.com/osd.xml" title="Experiences with CompSci" />
	<atom:link rel='hub' href='http://ubirevera.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Model checking with Spin</title>
		<link>http://ubirevera.wordpress.com/2009/07/02/model-checking-with-spin/</link>
		<comments>http://ubirevera.wordpress.com/2009/07/02/model-checking-with-spin/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 14:37:14 +0000</pubDate>
		<dc:creator>Abhishek</dc:creator>
				<category><![CDATA[Model Checking]]></category>
		<category><![CDATA[formal verification]]></category>
		<category><![CDATA[LTL]]></category>
		<category><![CDATA[spin]]></category>

		<guid isPermaLink="false">http://ubirevera.wordpress.com/?p=156</guid>
		<description><![CDATA[Real engineers, when faced with complex design problems build and analyze prototypes to reduce the risk of implementing a flawed design. Can the same be done with software also? How can we show if the system meets its design requirements? It is hard to devise all the possible test cases especially for concurrent software. One [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ubirevera.wordpress.com&amp;blog=8178762&amp;post=156&amp;subd=ubirevera&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Real engineers, when faced with complex design problems build and analyze prototypes to reduce the risk of implementing a flawed design. Can the same be done with software also? How can we show if the system meets its design requirements? It is hard to devise all the possible test cases especially for concurrent software.</p>
<p>One of the most powerful formal methods is <a href="http://www.cs.cmu.edu/~modelcheck/">model checking</a>. In principle model checking generates all possible states of a program and checks that the correctness specifications hold in each state. Model checking is challenging because the model should describe the system in sufficient detail and yet the model must be sufficiently simple so that the model checker can perform the verification within the reasonable limits of time and memory.</p>
<p>In this blog post I will model the <a href="http://web.sau.edu/lilliskevinm/csci410/2008Spring/slides/Ch07/09_algorithm3.htm">Peterson&#8217;s algorithm</a> and verify the mutual exclusion property. We will use <a href="http://spinroot.com/spin/whatispin.html">Spin model checker</a>. Spin accepts design specification in the verification language Promela. Promela is not an implementation language but a systems description language.  The emphasis in the language is on the modelling of process synchronization and coordination, and not on computation.</p>
<p><code><font face="monospace" size="2.5"><font color="#307D7E">/** Model specified using Promela for Peterson's algorithm **/</font><br /><font color="#307D7E">/* condition for mutual exclusion */</font><br />
#define mutex (critical <font color="#339900">&lt;=</font>&nbsp;1)<br />
<font color="#307D7E">/* flag value is 1 when the process wants to enter CS */</font><br />
<font color="#307D7E">/* turn holds the ID of the process whose turn it is */</font><br />
<font color="#339900">bool</font>&nbsp;flag<font color="#336666">[</font>2<font color="#336666">]</font>, turn<font color="#336666">;</font><br />
<font color="#307D7E">/* number of processes in the critical section */</font><br />
<font color="#339900">byte</font>&nbsp;critical <font color="#339900">=</font>&nbsp;0<font color="#336666">;</font><br />
<font color="#307D7E">/* instantiating two processes */</font><br />
<font color="#CC9933">active</font>&nbsp;<font color="#336666">[</font>2<font color="#336666">]</font>&nbsp;<font color="#CC9933">proctype</font>&nbsp;process()<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#307D7E">/* process identifiers start from 0 */</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pid i <font color="#339900">=</font>&nbsp;_pid<font color="#336666">;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pid j <font color="#339900">=</font>&nbsp;1 <font color="#339900">-</font>&nbsp;_pid<font color="#336666">;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#307D7E">/* do statement*/</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#CC9933">do</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#307D7E">/* only one choice for execution */</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#336666">::</font>&nbsp;&nbsp;&nbsp;&nbsp; <font color="#307D7E">/* process wants to enter CS */</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flag<font color="#336666">[</font>i<font color="#336666">]</font>&nbsp;<font color="#339900">=</font>&nbsp;true<font color="#336666">;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#307D7E">/* but asks other process to go ahead */</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;turn <font color="#339900">=</font>&nbsp;j<font color="#336666">;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#307D7E">/* wait until the other process is not interested, */</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#307D7E">/* or it is his own turn */</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#307D7E">/* process is blocked until the statement is true */</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#339900">!</font>(flag<font color="#336666">[</font>j<font color="#336666">]</font>&nbsp;&amp;&amp; turn <font color="#339900">==</font>&nbsp;j)<font color="#336666">;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#307D7E">/* critical section */</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;critical<font color="#339900">++</font><font color="#336666">;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;critical<font color="#339900">--</font><font color="#336666">;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#307D7E">/* end of critical section */</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flag<font color="#336666">[</font>i<font color="#336666">]</font>&nbsp;<font color="#339900">=</font>&nbsp;false<font color="#336666">;</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#CC9933">od</font><font color="#336666">;</font><br />
}</font></code>Correctness claims are specified in the syntax of standard <a href="http://www.cs.man.ac.uk/~korovink/cs2142/chapter14.pdf">Linear Temporal Logic</a> &#8211; a logic which is built for reasoning about things that change over time. Mutual exclusion can be expressed using the temporal operator for <font face="monospace" size="3">always &#8211; []</font>. </p>
<p>For verification, the negation of the LTL formula is added with the <font face="monospace" size="3">-a</font> argument (verification mode) and <font face="monospace" size="3">-f</font> argument (fairness condition of contention manager) to the Spin command which generates the C source code for the model checker. The file is compiled with the <font face="monospace" size="3">-DSAFETY</font> argument so that it is optimized for checking safety properties. Absence of an example on executing <font face="monospace" size="3">pan</font> will indicate that the property is not violated.<br />
<code><font face="monospace" size="2.5">$ spin -a -f '![]mutex' peterson.pml<br />$ gcc -DSAFETY -o pan pan.c<br />$ ./pan</font></code>Fortunately there is no ‘Model Checking for Dummies’ book as of now. To get started on this subject, I would suggest that you read the chapter on ‘Verification by Model Checking’ in the book <a href="http://www.cs.bham.ac.uk/research/projects/lics/">Logic in Computer Science</a> followed by the manual of the appropriate model checker.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ubirevera.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ubirevera.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ubirevera.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ubirevera.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ubirevera.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ubirevera.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ubirevera.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ubirevera.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ubirevera.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ubirevera.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ubirevera.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ubirevera.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ubirevera.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ubirevera.wordpress.com/156/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ubirevera.wordpress.com&amp;blog=8178762&amp;post=156&amp;subd=ubirevera&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ubirevera.wordpress.com/2009/07/02/model-checking-with-spin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/232e733f15a736d39d2051708e17fbd2?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">Abhishek</media:title>
		</media:content>
	</item>
		<item>
		<title>Combining different software licenses</title>
		<link>http://ubirevera.wordpress.com/2009/06/22/combining-different-software-licenses/</link>
		<comments>http://ubirevera.wordpress.com/2009/06/22/combining-different-software-licenses/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 07:11:20 +0000</pubDate>
		<dc:creator>Abhishek</dc:creator>
				<category><![CDATA[Evangelism]]></category>
		<category><![CDATA[GPL]]></category>
		<category><![CDATA[license compatibility]]></category>
		<category><![CDATA[software licenses]]></category>

		<guid isPermaLink="false">http://ubirevera.wordpress.com/?p=35</guid>
		<description><![CDATA[Any big software is made up of small modules. With the rise of open source, the developer can now use different open source libraries, toolkits, languages etc. Though open source, these components might be covered under different and even mutually exclusive licenses. Also the developer might have opted for a new license to release his [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ubirevera.wordpress.com&amp;blog=8178762&amp;post=35&amp;subd=ubirevera&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Any big software is made up of small modules. With the rise of open source, the developer can now use different open source libraries, toolkits, languages etc. Though open source, these components might be covered under different and even mutually exclusive licenses. Also the developer might have opted for a new license to release his final product. It is up to the developer to make sure that combining code does not violate the licensing terms that apply to each piece.</p>
<p>You must have heard of <a href="http://www.gnu.org/copyleft/gpl.html">General Public License</a> (GPL), <a href="http://www.gnu.org/licenses/lgpl.html">Lesser GPL</a> (LGPL), <a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache license</a>, <a href="http://www.opensource.org/licenses/bsd-license.php">BSD license</a>, <a href="http://www.mozilla.org/MPL/MPL-1.1.txt">Mozilla Public License</a> along with their version numbers. The problem in combining different licenses is that inbound rights – the rights granted from others to you should be as broad as outbound rights – the rights you granted to others.</p>
<div id="attachment_41" class="wp-caption alignnone" style="width: 469px"><img class="size-full wp-image-41" title="Combining the code" src="http://ubirevera.files.wordpress.com/2009/06/picture11.png?w=510" alt="Apache Software License is incompatible with the GPLv2 because it has certain patent termination cases that the GPL does not require."   /><p class="wp-caption-text">Apache Software License is incompatible with the GPLv2 because it has certain patent termination cases that the GPL does not require.</p></div>
<p>The first step in understanding the problem is to know about the restricting nature of the open source licenses.</p>
<ol>
<li><a href="http://en.wikipedia.org/wiki/Permissive_free_software_licence">Permissive</a><br />
Permissive licenses like Berkeley Software Distribution (BSD) and Apache permit the software to become proprietary.</li>
<li><a href="http://www.gnu.org/copyleft/">Copyleft</a><br />
They contain flow-down provisions that must be included in any of the downstream outbound licenses. For example, all licensees who accept code under GPL, must provide it to others under GPL. GPL requires that executables are accompanied with the complete corresponding machine-readable source code. The <a href="http://www.gnu.org/copyleft/gpl.txt">GPL</a> says:</p>
<blockquote><div style="background-color:lemonchiffon;">
<p style="border-style:solid;border-width:1px;padding:10px;">10.  Automatic Licensing of Downstream Recipients<br />
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License.<br />
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License.</p>
</div>
</blockquote>
</li>
</ol>
<p>It is possible for the developer to divide the code base into different parts each covered in its appropriate license. However, GPL covers all code in the same executable, except proprietary system libraries. In contrast, LGPL code can be combined with any other code by using the LGPL code as a dynamically linked library. GPLv2 itself is not compatible with GPLv3. Eclipse Public License allows derivative works to choose their own license for their contributions.</p>
<p>The more you read and interpret the license documents, technical definitions seem fuzzy and legal language becomes philosophical. You can get a brief idea about the compatibility of common licenses on the <a href="http://www.dwheeler.com/essays/floss-license-slide.html">FLOSS license slide</a>.</p>
<p>I would recommend that you go for permissive licenses like BSD. The more permissive the license, the more likely the software will be used. But if you are a believer in freedom of software and don’t want your code to be used in any proprietary program then GNU GPL is the answer.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ubirevera.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ubirevera.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ubirevera.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ubirevera.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ubirevera.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ubirevera.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ubirevera.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ubirevera.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ubirevera.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ubirevera.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ubirevera.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ubirevera.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ubirevera.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ubirevera.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ubirevera.wordpress.com&amp;blog=8178762&amp;post=35&amp;subd=ubirevera&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ubirevera.wordpress.com/2009/06/22/combining-different-software-licenses/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/232e733f15a736d39d2051708e17fbd2?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">Abhishek</media:title>
		</media:content>

		<media:content url="http://ubirevera.files.wordpress.com/2009/06/picture11.png" medium="image">
			<media:title type="html">Combining the code</media:title>
		</media:content>
	</item>
		<item>
		<title>Making selfish BitTorrent clients history</title>
		<link>http://ubirevera.wordpress.com/2009/06/16/making-selfish-bittorrent-clients-history/</link>
		<comments>http://ubirevera.wordpress.com/2009/06/16/making-selfish-bittorrent-clients-history/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 02:49:29 +0000</pubDate>
		<dc:creator>Abhishek</dc:creator>
				<category><![CDATA[BitTorrent]]></category>
		<category><![CDATA[bitthief]]></category>
		<category><![CDATA[free riding]]></category>
		<category><![CDATA[p2p]]></category>

		<guid isPermaLink="false">http://ubirevera.wordpress.com/?p=21</guid>
		<description><![CDATA[It is evident from the study of different exploits that we need to keep a check on the number of peers that we send to a newly connected client. The tracker has a list of all the peers for the torrent. A new field for timestamp is to be added for each peer. The following [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ubirevera.wordpress.com&amp;blog=8178762&amp;post=21&amp;subd=ubirevera&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It is evident from the study of <a href="http://ubirevera.wordpress.com/2009/06/15/4/">different exploits</a> that we need to keep a check on the number of peers that we send to a newly connected client.</p>
<p>The tracker has a list of all the peers for the torrent. A new field for <strong>timestamp</strong> is to be added for each peer. The following steps should be followed <span style="text-decoration:underline;">when a client connects (with its unique IP and port address) to the tracker</span>:</p>
<ul>
<li>check if it is in the connected peers list</li>
<li>if not or if the time when it last contacted the tracker exceeds <font face="monospace" size="3">1800 seconds</font> (1800 is selected since it is the average time of scheduled exchange of messages between tracker and the peer), then send it the list of peers</li>
<li>add/update to the list of peers in the trackers, the timestamp describing when it established the connection with the tracker</li>
</ul>
<p>The client can then only contact the tracker after a specified time of 1800 seconds to give information about its status and a new list of peers. This will help in removing peers which have moved out of the network. But genuine clients might have to restart the download or the peers in their list might have died.</p>
<p>When a <span style="text-decoration:underline;">client connects again within the 1800 seconds period</span>:</p>
<ul>
<li>the clients will have to provide the original list of peers given to them</li>
<li>tracker will verify the list and give a new set of replacement only for the peers in the list which have died out</li>
</ul>
<p>So the repeated query for a list of peer sets will not yield new peers. Hence the methods which are dependent on having large peer set will be useless. There would not be any significant overhead in the network as even if the client sends the list of peers it has, it will only get a small set of peers which have died out in return. Otherwise it would have got a new random list of all the peers.</p>
<p>The tracker has to do some additional work in checking the timestamps and died out peers in the list sent by newly connected clients. However at present the capabilities of the tracker are underutilized, so a small overhead should not be a problem.</p>
<div id="attachment_64" class="wp-caption aligncenter" style="width: 414px"><img class="size-full wp-image-64" title="BitTorrent Clients" src="http://ubirevera.files.wordpress.com/2009/06/img_torrents.png?w=510" alt="Different BitTorrent Clients"   /><p class="wp-caption-text">Different BitTorrent Clients</p></div>
<p>Some other clients also apply enhancements to overcome the free-riding behavior as described below:</p>
<ul>
<li><a href="http://azureus.sourceforge.net/">Azureus </a>client stores the information from which it has received the subpieces and immediately bans the IP address once the hash verification fails. Only a recent subset of history is necessary to determine the trustworthiness of a given peer.</li>
<li>The trackers of the sharing communities should <a href="http://www.dcg.ethz.ch/publications/hotnets06.pdf">verify the upload numbers sent by the peers</a>. For instance, the sum of all reported download and upload amounts could be analyzed over different torrents and time periods, in order to detect and ban dishonest peers.</li>
<li>Many clients now implement <a href="http://en.wikipedia.org/wiki/Superseeding">super-seeding</a>. Rather than claiming to have every piece from the outset, the seeder claims to have no pieces. As peers connect, the seed will inform a peer that it has received a new piece, one that has not yet been sent to any other peers. Thus allowing nodes to hide their properties does not allow selfish peers to detect the seeds.</li>
</ul>
<p>The BitTorrent protocol is based on the obedience of clients. This appears unrealistic as more users will employ free riding clients because of their reluctance to upload. The users should realize that they <a href="http://www.sigecom.org/exchanges/volume_5/5.4-feldman.pdf">need to contribute their resources in order to improve the download rates</a>. On the other hand, in many countries, it is illegal to upload but <em>okay</em> to download, maybe these rogue clients can come to their rescue.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ubirevera.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ubirevera.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ubirevera.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ubirevera.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ubirevera.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ubirevera.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ubirevera.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ubirevera.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ubirevera.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ubirevera.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ubirevera.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ubirevera.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ubirevera.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ubirevera.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ubirevera.wordpress.com&amp;blog=8178762&amp;post=21&amp;subd=ubirevera&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ubirevera.wordpress.com/2009/06/16/making-selfish-bittorrent-clients-history/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/232e733f15a736d39d2051708e17fbd2?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">Abhishek</media:title>
		</media:content>

		<media:content url="http://ubirevera.files.wordpress.com/2009/06/img_torrents.png" medium="image">
			<media:title type="html">BitTorrent Clients</media:title>
		</media:content>
	</item>
		<item>
		<title>Free riding on BitTorrent</title>
		<link>http://ubirevera.wordpress.com/2009/06/15/4/</link>
		<comments>http://ubirevera.wordpress.com/2009/06/15/4/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 11:13:03 +0000</pubDate>
		<dc:creator>Abhishek</dc:creator>
				<category><![CDATA[BitTorrent]]></category>
		<category><![CDATA[bitthief]]></category>
		<category><![CDATA[free riding]]></category>
		<category><![CDATA[p2p]]></category>

		<guid isPermaLink="false">http://ubirevera.wordpress.com/?p=4</guid>
		<description><![CDATA[I will, in this post, describe the loopholes in the BitTorrent protocol and how they are exploited by the rogue clients. Loopholes in the BitTorrent protocol Peer list during startup During start-up phase a new peer connects with tracker and requests for a list of peers (seeders and leechers) having the pieces of the file. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ubirevera.wordpress.com&amp;blog=8178762&amp;post=4&amp;subd=ubirevera&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I will, in this post, describe the loopholes in the BitTorrent protocol and how they are exploited by the rogue clients.</p>
<p><strong>Loopholes in the <a href="http://www.ittc.ku.edu/~niehaus/classes/750-s06/documents/BT-description.pdf">BitTorrent protocol</a></strong></p>
<ul>
<li><span style="text-decoration:underline;">Peer list during startup</span><br />
During start-up phase a new <em>peer </em>connects with <em>tracker </em>and requests for a list of peers (<em>seeders </em>and <em>leechers</em>) having the pieces of the file. The tracker generally responds with 50 peer addresses per announcement. This parameter can be increased to at most 200 in the announce request. Tracker announcements are repeated at an interval received in the first announce response, usually in the order of <em>once every 1800 seconds</em>. However downloaders may rerequest on nonscheduled times if an event happens or they need more peers.</li>
<li><span style="text-decoration:underline;">No upload to seeders</span><br />
Peers that provide a complete file are called <em>seeders</em>, and the peer providing the initial copy is called the initial seeder. So the peer having connection with seed does not have to upload any data to the seed. Seeders upload to all peers in the <em>round-robin </em>fashion.</li>
<li><span style="text-decoration:underline;">Optimistic Unchoke</span><br />
The purpose of optimistic unchoking policy is to allow newly joined peers without any pieces of torrent to bootstrap to the swarm. Which peer is optimistically unchoked <em>rotates every 30 seconds</em>. Newly connected peers are three times as likely to start as the current optimistic unchoke as anywhere else in the rotation. This gives them a decent chance of getting a complete piece to upload.</li>
</ul>
<p><strong>How rogue clients work?</strong></p>
<p style="text-align:center;"><strong><img class="alignnone size-full wp-image-71" title="BitTorrent Protocol vs Rogue Clients" src="http://ubirevera.files.wordpress.com/2009/06/img_torrents_vs2.png?w=510" alt="BitTorrent Protocol vs Rogue Clients"   /><br />
</strong></p>
<ul>
<li><span style="text-decoration:underline;">Downloading only from seeds</span><br />
A selfish client, upon connecting, <em>repeatedly asks for new lists</em>. Since most trackers perform some form of load balancing, after a short period of time, such a client has the information for most of the seeds in the torrent. The selfish client then only connects and <a href="http://www.iptps.org/papers-2006/Liogkas-BitTorrent06.pdf">downloads pieces from the seeds and ignores the leechers</a>. Since seeds are typically high-bandwidth clients, the selfish client are able to sustain high download rates without any uploads.</li>
<li><span style="text-decoration:underline;">BitThief</span><br />
<a href="http://www.dcg.ethz.ch/projects/bitthief/">BitThief</a> re-announces itself frequently during the startup period to the tracker in order to get as many remote peer addresses as quickly as possible. BitThief also sends an empty list of available pieces during connection setup and it does not inform the remote peer about any new pieces it acquires. So the BitThief client has a big list of different seeders and leechers for the torrent. The default BitTorrent client has 4 open connections (i.e. it is connected with at most 4 peers at a time). However the BitThief <em>opens a large number of connections</em>.</p>
<p>Having more connections increases the number of seeders in the swarm, so the client benefits from their round robin unchoking periods. BitThief never uploads to the leechers and is regularly snubbed by them. The leechers in the swarm would also include BitThief in their periodical optimistic unchoke slot.</li>
<li><span style="text-decoration:underline;">Pretending to upload</span><br />
Since, many times, torrent files are of pure quality or are fake, a lot of <em><a href="http://en.wikipedia.org/wiki/BitTorrent_tracker#Private_trackers">sharing communities </a></em>have emerged. Sharing communities require their users to upload at least as much data as they download, i.e., to keep their sharing ratio above 1. The community sites make use of the tracker announcements which every client performs regularly. In these announcements the client reports the current amount of data downloaded and uploaded. However, the client can announce bogus information and fake peers so that the tracker&#8217;s peer list fills up with dozens of clients which do not exist.</li>
<li><span style="text-decoration:underline;">Advertising false pieces</span><br />
A selfish peer when asked for a sub-piece can <a href="http://www.iptps.org/papers-2006/Liogkas-BitTorrent06.pdf">send garbage data</a>. The receiving leecher is able to verify the <em>SHA1 hash </em>only after receiving all sub-pieces of a piece.</p>
<p>When selecting which piece to start downloading next, peers generally download pieces which the fewest of their own peers have, referred to as <em>rarest first</em>. A client can announce it has rare pieces, so more peers try to connect with it, they get garbage values while the rogue client will have a piece of the file.</li>
</ul>
<p>Next post will list the enhancements used by some clients to overcome the free-riding behavior and propose a method to limit the peer list a client has.</p>
<p><!-- HTML Encryption provided by kurac --></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ubirevera.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ubirevera.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ubirevera.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ubirevera.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ubirevera.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ubirevera.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ubirevera.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ubirevera.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ubirevera.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ubirevera.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ubirevera.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ubirevera.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ubirevera.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ubirevera.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ubirevera.wordpress.com&amp;blog=8178762&amp;post=4&amp;subd=ubirevera&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ubirevera.wordpress.com/2009/06/15/4/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/232e733f15a736d39d2051708e17fbd2?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">Abhishek</media:title>
		</media:content>

		<media:content url="http://ubirevera.files.wordpress.com/2009/06/img_torrents_vs2.png" medium="image">
			<media:title type="html">BitTorrent Protocol vs Rogue Clients</media:title>
		</media:content>
	</item>
		<item>
		<title>Hello world!</title>
		<link>http://ubirevera.wordpress.com/2009/06/15/hello-world/</link>
		<comments>http://ubirevera.wordpress.com/2009/06/15/hello-world/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 06:12:52 +0000</pubDate>
		<dc:creator>Abhishek</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ubirevera.wordpress.com&amp;blog=8178762&amp;post=1&amp;subd=ubirevera&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Welcome to <a href="http://wordpress.com/">WordPress.com</a>. This is your first post. Edit or delete it and start blogging!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ubirevera.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ubirevera.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ubirevera.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ubirevera.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ubirevera.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ubirevera.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ubirevera.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ubirevera.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ubirevera.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ubirevera.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ubirevera.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ubirevera.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ubirevera.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ubirevera.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ubirevera.wordpress.com&amp;blog=8178762&amp;post=1&amp;subd=ubirevera&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ubirevera.wordpress.com/2009/06/15/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/232e733f15a736d39d2051708e17fbd2?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">Abhishek</media:title>
		</media:content>
	</item>
	</channel>
</rss>
