<?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>geek thoughts &#187; capabilities</title>
	<atom:link href="http://www.mlesniak.com/category/capabilities/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mlesniak.com</link>
	<description></description>
	<lastBuildDate>Wed, 12 May 2010 09:04:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Idea for capabilities</title>
		<link>http://www.mlesniak.com/2010/01/03/idea-for-capabilities/</link>
		<comments>http://www.mlesniak.com/2010/01/03/idea-for-capabilities/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 17:50:16 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[capabilities]]></category>
		<category><![CDATA[ghc]]></category>

		<guid isPermaLink="false">http://www.mlesniak.com/?p=636</guid>
		<description><![CDATA[After looking at the source code in Capabilities.c I think a rudimentary implementation to add dynamic capabilities can work like this: Wait, until it is safe to change the capabilities structure. Allocate memory for number_of_capabilities + 1 Copy old capabilities structure to new allocated one Relink to new memory location To be honest, I don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>After looking at the source code in Capabilities.c I think a rudimentary implementation to add dynamic capabilities can work like this:</p>
<ol>
<li>Wait, until it is safe to change the capabilities structure.</li>
<li>Allocate memory for number_of_capabilities + 1</li>
<li>Copy old capabilities structure to new allocated one</li>
<li>Relink to new memory location</li>
</ol>
<p>To be honest, I don&#8217;t think it&#8217;s so easy; but at least this is a starting point I can use. Currently, I have to things to think about and which have to be solved before I can hack around in the code:</p>
<ol>
<li>How can I call C code in the RTS from Haskell?</li>
<li>When is it safe to modify the capabilities structure?</li>
</ol>
<p>Happy for any suggestions,<br />
 Michael</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mlesniak.com/2010/01/03/idea-for-capabilities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where am I?</title>
		<link>http://www.mlesniak.com/2009/12/12/where-am-i/</link>
		<comments>http://www.mlesniak.com/2009/12/12/where-am-i/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 13:19:14 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[capabilities]]></category>
		<category><![CDATA[ghc]]></category>

		<guid isPermaLink="false">http://www.mlesniak.com/?p=618</guid>
		<description><![CDATA[And what am I doing here? I currently read (more or less randomized) remarks about GHC&#8217;s source code; the codebase is quite huge (and probably the biggest code base that I&#8217;ve ever worked with): Extension Lines .lhs 300482 .hs 473479 .c 184039 .h 448394 combined 1406394 Found using wc -l `find . -name \*.` Thankfully [...]]]></description>
			<content:encoded><![CDATA[<p>And what am I doing here? I currently read (more or less randomized) remarks about GHC&#8217;s source code; the codebase is quite huge (and probably the biggest code base that I&#8217;ve ever worked with):</p>
<pre style="padding-left: 30px;" lang="c">Extension  Lines
.lhs       300482
.hs        473479
.c         184039
.h         448394

combined  1406394

Found using wc -l `find . -name \*.`
</pre>
<p>Thankfully I only need a tiny fraction of it to add the dynamic-capabilities-feature: according to the <a href="http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts">commentary</a> on the runtime system it consist of only about 50000 lines, and again, I probably need to modify / extend just a fraction of it. The code of the runtime system has an <a href="http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Rts">extra page</a> on the wiki; it describes</p>
<ul>
<li>the purpose of the single files. Unfortunately these are currently only one liners and links to the particular files. Maybe I will add a much more extensive description for the Capabilities-files.</li>
<li>the<a href="http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/Conventions"> coding conventions</a> for this subsystem. They are quite extensive but (in my humble opinion) very good and describe not only syntactical conventions but also some general remarks, debugging and robustness tricks. </li>
</ul>
<p>For seeing how the capabilites are initialized I think that the file RtsFlag.c is helpful:</p>
<ul>
<li>RtsFlag.c defines parsing for -N&lt;&#8230;&gt;, hence I see where the capabilites are set and how they fit in the big puzzle of the RTS. </li>
<li>RtsFlag.c uses and sets RtsFlags.ParFlags.nNodes (line 958). The structure is included in includes/Rts.h which includes include/rts/Flags.h (line 189 defines the important parts). </li>
<li>RtsMessage.c would probably help me in the future for printing some debugging messages.</li>
</ul>
<p>I&#8217;m curious if I&#8217;m on the right track. By the way, take all the informations with a grain of salt, since I&#8217;m currently in the beginning of understanding the code of the runtime system.</p>
<p><strong>Minor update</strong>: After a look at the <a href="http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts">commentary</a> I&#8217;m pretty sure I need to understand much of the <a href="http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/Scheduler">scheduling subsystem</a> to extend the capabilities-system. Thankfully the wiki seems to document it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mlesniak.com/2009/12/12/where-am-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Started hacking on GHC capabilities</title>
		<link>http://www.mlesniak.com/2009/12/11/started-hacking-on-ghc-capabilities/</link>
		<comments>http://www.mlesniak.com/2009/12/11/started-hacking-on-ghc-capabilities/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 19:57:40 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[capabilities]]></category>
		<category><![CDATA[haskell]]></category>

		<guid isPermaLink="false">http://www.mlesniak.com/?p=589</guid>
		<description><![CDATA[Today I&#8217;ve started the small personal hacking project of implementing dynamic capatiblities in GHC&#8216;s parallel runtime system; I&#8217;ll blog about my efforts, problems and solutions and would be grateful for any hints, comments or pointers for more documentation. I began by talking with Simon Marlow and discussing the idea. He said that it&#8217;s a least worthwhile [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ve started the small personal hacking project of implementing dynamic capatiblities in <a href="http://haskell.org/ghc/">GHC</a>&#8216;s parallel runtime system; I&#8217;ll blog about my efforts, problems and solutions and would be grateful for any hints, comments or pointers for more documentation. I began by talking with <a href="http://www.haskell.org/~simonmar/">Simon Marlow</a> and discussing the idea. He said that it&#8217;s a least worthwhile to try implementing it.</p>
<p>Currently I</p>
<ul>
<li>made an account (mlesniak) on the <a href="http://hackage.haskell.org/trac/ghc/">GHC&#8217;s developers wiki</a>.</li>
<li> opened a ticket (<a href="http://hackage.haskell.org/trac/ghc/ticket/3729">No. #3729</a>) as a task, describing my idea: <em>&#8220;Currently the number of capabilities can only be set at the start of a program using -N. At least for benchmarking and playing with semi-implicit code (any other real-world scenarious?) if would be nice to change the number of capabilities at runtime.&#8221; </em>
<p><em><span style="font-style: normal;"><strong>Current questions:</strong></span><br />
 </em></p>
<ul>
<li>There is no person assigned on this task, should I assign myself?</li>
<li>It&#8217;s the only project without a particular difficulty (Diffuclty: None); should I set one or is this set by one of the &#8220;important&#8221; maintainers?</li>
</ul>
</li>
<li>downloaded the source for GHC HEAD, according to <a href="http://hackage.haskell.org/trac/ghc/wiki/GettingStarted">Getting Started</a></li>
<li>was able to compile it on my 2.4 GHz Dualcore with 4 GB memory using the <a href="http://hackage.haskell.org/trac/ghc/wiki/Building">Building Guide</a>. It took about 40 minutes for a full compile (yikes!)</li>
<li>took a first look into ghc/rts/ <a href="http://www.mlesniak.com/wp-content/uploads/2009/12/Capability.c">Capability.c</a> and <a href="http://www.mlesniak.com/wp-content/uploads/2009/12/Capability.h">Capability.h</a>. This looks quite complicated and I probably have to understand a lot of the underlying system before I can even think about trying to modify this part of the RTS itself. Hopefully, the <a href="http://hackage.haskell.org/trac/ghc/wiki/Commentary">GHC Commentary</a> will help.</li>
</ul>
<p>Why do I do this? Firstly, I really like to solve problems and learn new things on the way. Secondly, I was always interested in the underlying parallel runtime system of GHC but without a concrete task motivating myself to understand this huge system was difficult. Thirdly, I hope that by learning part of the system I&#8217;m able to implement some of my (currently quite vague) ideas on dynamic adaptiblity of parallel runtime systems.</p>
<p>I will keep the interwebs updated, but do not expect too much soon, since I do this primary in my free time. Any hints, questions, remarks, (de-)motivating comments?</p>
<p><em> </em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mlesniak.com/2009/12/11/started-hacking-on-ghc-capabilities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
