<?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>Software updates by Troy D. Hanson</title>
	<atom:link href="http://troydhanson.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://troydhanson.wordpress.com</link>
	<description>C, &#38;c.</description>
	<lastBuildDate>Tue, 08 Nov 2011 05:49:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='troydhanson.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Software updates by Troy D. Hanson</title>
		<link>http://troydhanson.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://troydhanson.wordpress.com/osd.xml" title="Software updates by Troy D. Hanson" />
	<atom:link rel='hub' href='http://troydhanson.wordpress.com/?pushpress=hub'/>
		<item>
		<title>pmtr: a process monitor</title>
		<link>http://troydhanson.wordpress.com/2011/11/08/pmtr-a-process-monitor/</link>
		<comments>http://troydhanson.wordpress.com/2011/11/08/pmtr-a-process-monitor/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 05:49:08 +0000</pubDate>
		<dc:creator>troydhanson</dc:creator>
				<category><![CDATA[Software updates]]></category>

		<guid isPermaLink="false">http://troydhanson.wordpress.com/?p=127</guid>
		<description><![CDATA[Starting processes at boot time, and keeping them running, is not glamorous but it&#8217;s important (if your computer gets power cycled, it&#8217;s nice to have your applications bounce right back&#8230; but I&#8217;m sure you already do this). I put together a utility called pmtr (process monitor) to run my application daemons at boot time, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=127&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a name="preamble"></a>
<p>Starting processes at boot time, and keeping them running, is not glamorous but it&#8217;s important (if your computer gets power cycled, it&#8217;s nice to have your applications bounce right back&#8230; but I&#8217;m sure you already do this).</p>
<p>I put together a utility called <tt>pmtr</tt> (process monitor) to run my application daemons at boot time, and restart them as needed. I wanted to keep all of these jobs defined in one place&#8211; one configuration file. No rooting around in sysvinit files. Just my application&#8217;s jobs, all in one place. Like this,</p>
<p><b>/etc/pmtr.conf</b></p>
<table border="0" bgcolor="#e8e8e8" width="100%" style="margin:.2em 0;">
<tr>
<td style="padding:.5em;">
<pre style="margin:0;padding:0;">  job {
    name weather-server
    cmd /usr/local/bin/weather -v
  }

  # this one keeps stderr and stdout
  job {
    name doppler-update
    cmd /usr/bin/dop-up
    dir /var/log
    err dop.err
    out dop.out
  }</pre>
</td>
</tr>
</table>
<p>That&#8217;s a simple <tt>pmtr.conf</tt> with just two jobs. No rocket science &#8211; just two jobs, in one place. There&#8217;s a handful of job configuration <a href="http://troydhanson.github.com/pmtr/#options">options</a> it supports.</p>
<p>A friend asked me to support &#8220;deltas&#8221; if you change the configuration file- and this turned into one of the most useful features. It&#8217;s really two handy features that go together: <tt>pmtr</tt> monitors the file (using inotify) for changes so you don&#8217;t have to signal it when you make a change; then, when it rescans the configuration, it only fiddles with the jobs you&#8217;ve actually changed.  You can disable or reconfigure jobs, or add new ones, and have that take effect without disrupting the other ones.</p>
<p>It&#8217;s not sysvinit, it&#8217;s not upstart, it&#8217;s not sophisticated. It&#8217;s just &#8230; handy.</p>
<p>You can <a href="http://troydhanson.github.com/pmtr/">read more about pmtr</a> on it&#8217;s GitHub page.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/troydhanson.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/troydhanson.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/troydhanson.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/troydhanson.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/troydhanson.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/troydhanson.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/troydhanson.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/troydhanson.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/troydhanson.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/troydhanson.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/troydhanson.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/troydhanson.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/troydhanson.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/troydhanson.wordpress.com/127/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=127&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://troydhanson.wordpress.com/2011/11/08/pmtr-a-process-monitor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8520d3f7da902afea5eedab6d9bd6f67?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">troydhanson</media:title>
		</media:content>
	</item>
		<item>
		<title>ZeroMQ control port</title>
		<link>http://troydhanson.wordpress.com/2011/10/30/zeromq-control-port/</link>
		<comments>http://troydhanson.wordpress.com/2011/10/30/zeromq-control-port/#comments</comments>
		<pubDate>Sun, 30 Oct 2011 22:41:40 +0000</pubDate>
		<dc:creator>troydhanson</dc:creator>
				<category><![CDATA[Software updates]]></category>

		<guid isPermaLink="false">http://troydhanson.wordpress.com/?p=121</guid>
		<description><![CDATA[I&#8217;ve posted my ØMQ zcontrol control port library to GitHub tonight. This makes it easy to embed an interactive control port in your ØMQ (v2 or v3)-based C programs. Example of using a control port % ./zcon -e tcp://127.0.0.1:3333 Connecting to tcp://127.0.0.1:3333. zcon&#62; help help this text version version info shutdown shutdown server quit close [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=121&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve posted my ØMQ <a href="http://troydhanson.github.com/zcontrol/">zcontrol control port library</a> to GitHub tonight. This makes it easy to embed an interactive control port in your ØMQ (v2 or v3)-based C programs.</p>
<p><b>Example of using a control port</b></p>
<table border="0" bgcolor="#e8e8e8" width="100%" style="margin:.2em 0;">
<tr>
<td style="padding:.5em;">
<pre style="margin:0;padding:0;">% ./zcon -e tcp://127.0.0.1:3333
Connecting to tcp://127.0.0.1:3333.
zcon&gt; help
help                 this text
version              version info
shutdown             shutdown server
quit                 close session

zcon&gt; version
Current 0MQ version is 3.0.3

zcon&gt; quit</pre>
</td>
</tr>
</table>
<p>You can add commands, for example&#8201;&#8212;&#8201;to control or monitor your program&#8201;&#8212;&#8201;using the zcontrol API. Use the <tt>zcon</tt> client shown above to run these commands interactively. Or, you can invoke them from any ØMQ <tt>req</tt> socket. I&#8217;ve used zcontrol both ways, e.g. manually and from a PHP script.</p>
<p>For further information please see,</p>
<ul>
<li> the zcontrol documentation: <a href="http://troydhanson.github.com/zcontrol/">http://troydhanson.github.com/zcontrol/</a> </li>
<li> or <tt>git clone git://github.com/troydhanson/zcontrol.git</tt> </li>
</ul>
<p>Feedback or suggestions are welcome- feel free to leave comments.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/troydhanson.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/troydhanson.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/troydhanson.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/troydhanson.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/troydhanson.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/troydhanson.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/troydhanson.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/troydhanson.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/troydhanson.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/troydhanson.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/troydhanson.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/troydhanson.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/troydhanson.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/troydhanson.wordpress.com/121/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=121&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://troydhanson.wordpress.com/2011/10/30/zeromq-control-port/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8520d3f7da902afea5eedab6d9bd6f67?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">troydhanson</media:title>
		</media:content>
	</item>
		<item>
		<title>Data streams, ZeroMq, entropy</title>
		<link>http://troydhanson.wordpress.com/2011/10/09/data-streams-zeromq-entropy/</link>
		<comments>http://troydhanson.wordpress.com/2011/10/09/data-streams-zeromq-entropy/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 05:13:45 +0000</pubDate>
		<dc:creator>troydhanson</dc:creator>
				<category><![CDATA[Software updates]]></category>

		<guid isPermaLink="false">http://troydhanson.wordpress.com/?p=116</guid>
		<description><![CDATA[kvspool, coming soon Pending some final approvals, I&#8217;m looking forward to releasing a new library this week for streaming data processing. It&#8217;s a small API for spooling off events (key-value sets, aka a dictionary, hash, etc). From there, other programs can consume them (possibly at a slower rate, hence you can couple fast and slow [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=116&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3><a name="_kvspool_coming_soon"></a>kvspool, coming soon</h3>
<p>Pending some final approvals, I&#8217;m looking forward to releasing a new library this week for streaming data processing. It&#8217;s a small API for spooling off events (key-value sets, aka a dictionary, hash, etc). From there, other programs can consume them (possibly at a slower rate, hence you can couple fast and slow processes, while limiting the total resource consumption of the buffer). Or you can publish the stream to remote subscribers, and it will continuously receive the events written to the local stream. It&#8217;s a tiny API in C, Python, Perl and Java.</p>
<h3><a name="_zero_mq"></a>Zero MQ</h3>
<p>Just a few words of appreciation for Zero MQ (sorry, &#8220;ØMQ&#8221;). <a href="http://zero.mq">These guys</a> have taken a new conceptual approach to sockets (layering an API over standard TCP/IP sockets) that takes care of most of the headaches in network programs. I won&#8217;t go into detail but I immediately used pub-sub, went from there to using req-rep, to push-pull, and I love that the API is tiny, the docs are great (I love the ASCII diagrams rendered nicely as PNG, I discovered they are using <a href="http://ditaa.sourceforge.net">ditaa</a> for that, by the way). I ported my <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/controlport">controlport</a> library for use with ZeroMq-message-loop based programs. Hope to post it here soon.</p>
<h3><a name="_entropy"></a>Entropy</h3>
<p>For those who appreciate a dose of theory with their morning coffee, my notes about measuring <a href="http://tkhanson.net/cgit.cgi/misc.git/plain/entropy/Entropy.html">entropy of a byte stream</a> are on on <a href="http://tkhanson.net/misc/">Scripts &amp; Snippets</a>. Since I&#8217;m more interested in practical applications, here&#8217;s a <a href="http://tkhanson.net/cgit.cgi/misc.git/plain/entropy/shlimit.c">program</a> that calculates the ultimate percentage to which an input file could be compressed.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/troydhanson.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/troydhanson.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/troydhanson.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/troydhanson.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/troydhanson.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/troydhanson.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/troydhanson.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/troydhanson.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/troydhanson.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/troydhanson.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/troydhanson.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/troydhanson.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/troydhanson.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/troydhanson.wordpress.com/116/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=116&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://troydhanson.wordpress.com/2011/10/09/data-streams-zeromq-entropy/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8520d3f7da902afea5eedab6d9bd6f67?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">troydhanson</media:title>
		</media:content>
	</item>
		<item>
		<title>UNIX domain sockets</title>
		<link>http://troydhanson.wordpress.com/2011/07/02/unix-domain-sockets/</link>
		<comments>http://troydhanson.wordpress.com/2011/07/02/unix-domain-sockets/#comments</comments>
		<pubDate>Sun, 03 Jul 2011 00:35:55 +0000</pubDate>
		<dc:creator>troydhanson</dc:creator>
				<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://troydhanson.wordpress.com/?p=113</guid>
		<description><![CDATA[My notes about UNIX domain sockets are now on Scripts &#38; Snippets. Here&#8217;s the condensed version. Communication within a host UNIX domain sockets are a method by which processes on the same host can communicate. Communication is bidirectional with stream sockets and unidirectional with datagram sockets. Identity Instead of identifying a server by an IP [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=113&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div> <img src="http://troydhanson.files.wordpress.com/2011/07/snippets.png?w=420" style="border-width:0;" alt="scripts and snippets"> </div>
<p>My notes about <a href="http://tkhanson.net/cgit.cgi/misc.git/plain/unixdomain/Unix_domain_sockets.html">UNIX domain sockets</a> are now on <a href="http://tkhanson.net/misc/">Scripts &amp; Snippets</a>. Here&#8217;s the condensed version.</p>
<hr />
<h2><a name="_communication_within_a_host"></a>Communication within a host</h2>
<p>UNIX domain sockets are a method by which processes on the same host can communicate. Communication is bidirectional with stream sockets and unidirectional with datagram sockets.</p>
<h3><a name="_identity"></a>Identity</h3>
<p>Instead of identifying a server by an IP address and port, a UNIX domain socket is known by a pathname. Obviously the client and server have to agree on the pathname for them to find each other. The server binds the pathname to the socket.</p>
<h3><a name="_file_permissions_control_who_can_connect"></a>File permissions control who can connect</h3>
<p>For UNIX domain sockets, file and directory permissions restrict which processes on the host can open the file, and thus communicate with the server.  Therefore, UNIX domain sockets provide an advantage over Internet sockets (to which anyone can connect, unless extra authentication logic is implemented).</p>
<h3><a name="_comparison_with_named_pipes_for_ipc"></a>Comparison with named pipes for IPC</h3>
<p>IPC within a UNIX host by may be accomplished by several other means including named pipes.  What circumstances favor UNIX domain sockets versus pipes? The choice is influenced by these factors:</p>
<dl>
<dt> Duplex </dt>
<dd> Stream sockets provide bi-directional communication while named pipes are uni-directional. </dd>
<dt> Distinct clients </dt>
<dd> Clients using sockets each have an independent connection to the server. With named pipes, many clients may write to the pipe, but the server cannot distinguish the clients from each other&#8211; the server has only one descriptor to read from the named pipe. Because the named pipe has only read descriptor and possibly-multiple writers, random interleaving can also occur if a client writes more than <tt>PIPE_BUF</tt> bytes in one operation. Since pipes have these limitations, UNIX domain sockets should be used if there are multiple clients that need to be distinguishable or which write long messages to the server. </dd>
<dt> Method of creating and opening </dt>
<dd> Sockets are created using <tt>socket</tt> and assigned their identity via <tt>bind</tt>. Named pipes are created using <tt>mkfifo</tt>. To connect to a UNIX domain socket the normal <tt>socket</tt>/<tt>connect</tt> calls are used, but a named pipe is written using regular file <tt>open</tt> and <tt>write</tt>. That makes them easier to use from a shell script for example. </dd>
</dl>
<h3><a name="_linux_abstract_socket_namespace"></a>Linux Abstract Socket Namespace</h3>
<p>Linux has a special feature: if the pathname for a UNIX domain socket begins with a null byte <em></em>, its name is not mapped into the filesystem. Thus it won&#8217;t collide with other names in the filesystem.  Also, when a server closes its UNIX domain listening socket in the abstract namespace, its file is deleted; with regular UNIX domain sockets, the file persists after the server closes it.</p>
<hr />
<h2><a name="_resources"></a>Resources</h2>
<p>Here are <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/unixdomain/">some C programs</a> that implement a UNIX domain socket client and server. These are placed in the public domain.</p>
<ul>
<li> A <a href="http://tkhanson.net/cgit.cgi/misc.git/plain/unixdomain/srv.c">server</a> example </li>
<li> A <a href="http://tkhanson.net/cgit.cgi/misc.git/plain/unixdomain/cli.c">client</a> example </li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/troydhanson.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/troydhanson.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/troydhanson.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/troydhanson.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/troydhanson.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/troydhanson.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/troydhanson.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/troydhanson.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/troydhanson.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/troydhanson.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/troydhanson.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/troydhanson.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/troydhanson.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/troydhanson.wordpress.com/113/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=113&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://troydhanson.wordpress.com/2011/07/02/unix-domain-sockets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8520d3f7da902afea5eedab6d9bd6f67?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">troydhanson</media:title>
		</media:content>

		<media:content url="http://troydhanson.files.wordpress.com/2011/07/snippets.png" medium="image">
			<media:title type="html">scripts and snippets</media:title>
		</media:content>
	</item>
		<item>
		<title>uthash 1.9.4 released</title>
		<link>http://troydhanson.wordpress.com/2011/06/05/uthash-1-9-4-released/</link>
		<comments>http://troydhanson.wordpress.com/2011/06/05/uthash-1-9-4-released/#comments</comments>
		<pubDate>Sun, 05 Jun 2011 20:24:57 +0000</pubDate>
		<dc:creator>troydhanson</dc:creator>
				<category><![CDATA[Software updates]]></category>

		<guid isPermaLink="false">http://troydhanson.wordpress.com/?p=101</guid>
		<description><![CDATA[uthash v1.9.4 has been released. Version 1.9.4 (2011-06-05) uthash now supports MurmurHash v3 utlist now includes concatenation macros (LL_CONCAT and DL_CONCAT) utarray now supports binary search (utarray_find) utstring now supports a new-or-clear-existing macro (utstring_renew) documented technique for a multi-level hash table clarified scope requirements for UT_icd in the utarray documentation fixed termination when utstring_clear is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=101&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div> <img src="http://troydhanson.files.wordpress.com/2011/06/uthash-mini.png?w=420" style="border-width:0;" alt="uthash-mini.png"> </div>
<p><a href="http://uthash.sourceforge.net">uthash v1.9.4</a> has been released.</p>
<hr />
<h2><a name="_version_1_9_4_2011_06_05"></a>Version 1.9.4 (2011-06-05)</h2>
<ul>
<li> uthash now supports MurmurHash v3 </li>
<li> utlist now includes concatenation macros (<tt>LL_CONCAT</tt> and <tt>DL_CONCAT</tt>) </li>
<li> utarray now supports binary search (<tt>utarray_find</tt>) </li>
<li> utstring now supports a new-or-clear-existing macro (<tt>utstring_renew</tt>) </li>
<li> documented technique for a multi-level hash table </li>
<li> clarified scope requirements for <tt>UT_icd</tt> in the utarray documentation </li>
<li> fixed termination when <tt>utstring_clear</tt> is followed by <tt>utstring_body</tt> </li>
<li> fixed utarray_inserta macro when used with complex arguments </li>
<li> on Visual Studio define missing type <tt>uint8_t</tt> </li>
<li> Debian/Ubuntu include uthash in the package <tt>uthash-dev</tt>. </li>
<li> uthash has been downloaded 16,211 times. </li>
</ul>
<p>Thanks to Yu Feng, Richard Cook, Dino Ciuffetti, Chris Groer, and Arun Cherian for feedback and fixes in this release!</p>
<p>Edited to add: nice example of an LRU cache with uthash at <a href="http://jehiah.cz/a/uthash">http://jehiah.cz/a/uthash</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/troydhanson.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/troydhanson.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/troydhanson.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/troydhanson.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/troydhanson.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/troydhanson.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/troydhanson.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/troydhanson.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/troydhanson.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/troydhanson.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/troydhanson.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/troydhanson.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/troydhanson.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/troydhanson.wordpress.com/101/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=101&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://troydhanson.wordpress.com/2011/06/05/uthash-1-9-4-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8520d3f7da902afea5eedab6d9bd6f67?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">troydhanson</media:title>
		</media:content>

		<media:content url="http://troydhanson.files.wordpress.com/2011/06/uthash-mini.png" medium="image">
			<media:title type="html">uthash-mini.png</media:title>
		</media:content>
	</item>
		<item>
		<title>upstart: init in Ubuntu</title>
		<link>http://troydhanson.wordpress.com/2011/02/28/upstart-init-in-ubuntu/</link>
		<comments>http://troydhanson.wordpress.com/2011/02/28/upstart-init-in-ubuntu/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 02:04:39 +0000</pubDate>
		<dc:creator>troydhanson</dc:creator>
				<category><![CDATA[Software updates]]></category>

		<guid isPermaLink="false">http://troydhanson.wordpress.com/?p=96</guid>
		<description><![CDATA[Here&#8217;s an example of software just working well: I went to write a &#8220;startup script&#8221; for my process (you know, one of those init.d startup scripts that gets your process going when the box is rebooted). I learned that, on Ubuntu, the init process has been replaced with the very friendly &#8220;upstart&#8221; package. Here&#8217;s how [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=96&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an example of software just working well: I went to write a &#8220;startup script&#8221; for my process (you know, one of those init.d startup scripts that gets your process going when the box is rebooted). I learned that, on Ubuntu, the init process has been replaced with the very friendly &#8220;upstart&#8221; package.</p>
<p>Here&#8217;s how a startup script looks. This is for the acpid daemon:</p>
<pre style="color:gray;padding:.5em;"># acpid - ACPI daemon
#
# The ACPI daemon provides a socket for other daemons to multiplex kernel
# ACPI events from, and a framework for reacting to those events.</pre>
<pre style="color:gray;padding:.5em;">description   "ACPI daemon"</pre>
<pre style="color:gray;padding:.5em;">start on runlevel [2345]
stop on runlevel [!2345]</pre>
<pre style="color:gray;padding:.5em;">expect fork
respawn</pre>
<pre style="color:gray;padding:.5em;">exec acpid -c /etc/acpi/events -s /var/run/acpid.socket</pre>
<p>I copied this file (renaming it for my own process and adjusting the <tt>exec</tt> line), put the file in <tt>/etc/init/pm.conf</tt> and voilà&#8211; my work was done. I just had to start up the process manually the first time using,</p>
<pre style="color:gray;padding:.5em;">service pm start</pre>
<p>A few pointers:</p>
<ul>
<li> If you want to see the upstart logs, look in /var/log/daemon.log. </li>
<li> upstart itself is documented in init(8) (<tt>man -s 8 init</tt>) </li>
<li> the conf file syntax is documented in init(5) (<tt>man -s 5 init</tt>) </li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/troydhanson.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/troydhanson.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/troydhanson.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/troydhanson.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/troydhanson.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/troydhanson.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/troydhanson.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/troydhanson.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/troydhanson.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/troydhanson.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/troydhanson.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/troydhanson.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/troydhanson.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/troydhanson.wordpress.com/96/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=96&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://troydhanson.wordpress.com/2011/02/28/upstart-init-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8520d3f7da902afea5eedab6d9bd6f67?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">troydhanson</media:title>
		</media:content>
	</item>
		<item>
		<title>A sampling of C snippets</title>
		<link>http://troydhanson.wordpress.com/2010/12/19/a-sampling-of-c-snippets/</link>
		<comments>http://troydhanson.wordpress.com/2010/12/19/a-sampling-of-c-snippets/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 01:38:30 +0000</pubDate>
		<dc:creator>troydhanson</dc:creator>
				<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://troydhanson.wordpress.com/?p=92</guid>
		<description><![CDATA[On my Scripts and Snippets page, there are a dozen or so tiny C programs that each show usage of a particular library (like PCRE), technique (like a DNS lookup), tricky task (like writing a parser) or easy &#8220;boilerplate&#8221; code (like read some options and iterate over lines of a file). These programs are there [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=92&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div> <img src="http://troydhanson.files.wordpress.com/2010/12/snippets.png?w=420" style="border-width:0;" alt="snippets.png"> </div>
<p>On my <a href="http://tkhanson.net/misc">Scripts and Snippets</a> page, there are a dozen or so tiny C programs that each show usage of a particular library (like PCRE), technique (like a DNS lookup), tricky task (like writing a parser) or easy &#8220;boilerplate&#8221; code (like read some options and iterate over lines of a file).</p>
<p>These programs are there to jog my memory, or to give me something to quickly copy and modify when doing something similar in the future. Here&#8217;s some of the snippets that are there today. Maybe they&#8217;ll be useful to you if you need to see a quick, minimal complete program that does one of these tasks. They&#8217;re all placed in the public domain.</p>
<hr />
<h2><a name="_c_snippets"></a>C snippets</h2>
<ul>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/lemon">lemon</a>       using the Lemon parser generator </li>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/dns">dns</a>           doing DNS lookup </li>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/udp">udp</a>           UDP client and server </li>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/tcp">tcp</a>           TCP client and server </li>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/ifinfo">ifinfo</a>     list network interfaces, their IPv4/v6 addresses and MACs </li>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/pcre">pcre</a>         using pcre library </li>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/dlsym">dlsym</a>       using dlsym </li>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/readline">readline</a> using readline library </li>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/looper">looper</a>     iterating over lines of file </li>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/slurp">slurp</a>       using read or mmap to slurp a whole file </li>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/mworkers">mworkers</a> a sigsuspend-based parent process managing multiple worker processes </li>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/bloom">bloom</a>       building a Bloom filter from lines of one file, and testing other lines on it </li>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/zlib">zlib</a>         a simple gzip/gunzip implementation using the zlib C API </li>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/tconf">tconf</a>       function to read configuration file entries </li>
<li> <a href="http://tkhanson.net/cgit.cgi/misc.git/tree/iconv">iconv</a>       using the iconv library </li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/troydhanson.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/troydhanson.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/troydhanson.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/troydhanson.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/troydhanson.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/troydhanson.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/troydhanson.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/troydhanson.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/troydhanson.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/troydhanson.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/troydhanson.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/troydhanson.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/troydhanson.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/troydhanson.wordpress.com/92/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=92&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://troydhanson.wordpress.com/2010/12/19/a-sampling-of-c-snippets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8520d3f7da902afea5eedab6d9bd6f67?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">troydhanson</media:title>
		</media:content>

		<media:content url="http://troydhanson.files.wordpress.com/2010/12/snippets.png" medium="image">
			<media:title type="html">snippets.png</media:title>
		</media:content>
	</item>
		<item>
		<title>uthash 1.9.3 released</title>
		<link>http://troydhanson.wordpress.com/2010/10/31/uthash-1-9-3-released/</link>
		<comments>http://troydhanson.wordpress.com/2010/10/31/uthash-1-9-3-released/#comments</comments>
		<pubDate>Sun, 31 Oct 2010 20:08:11 +0000</pubDate>
		<dc:creator>troydhanson</dc:creator>
				<category><![CDATA[Software updates]]></category>

		<guid isPermaLink="false">http://troydhanson.wordpress.com/?p=89</guid>
		<description><![CDATA[uthash v1.9.3 has been released. This is a minor bug fix release. Version 1.9.3 (2010-10-31) fix an ifdef for compatibility with Intel compiler (thanks, degski!) fix HASH_ITER macro to satisfy C++ casting rules (thanks, Erik Bai!)<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=89&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div> <img src="http://troydhanson.files.wordpress.com/2010/10/uthash-mini1.png?w=420" style="border-width:0;" alt="uthash-mini.png"> </div>
<p><a href="http://uthash.sourceforge.net">uthash v1.9.3</a> has been released. This is a minor bug fix release.</p>
<hr />
<h2><a name="_version_1_9_3_2010_10_31"></a>Version 1.9.3 (2010-10-31)</h2>
<ul>
<li> fix an <tt>ifdef</tt> for compatibility with Intel compiler (thanks, degski!) </li>
<li> fix <tt>HASH_ITER</tt> macro to satisfy C++ casting rules (thanks, Erik Bai!) </li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/troydhanson.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/troydhanson.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/troydhanson.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/troydhanson.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/troydhanson.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/troydhanson.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/troydhanson.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/troydhanson.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/troydhanson.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/troydhanson.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/troydhanson.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/troydhanson.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/troydhanson.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/troydhanson.wordpress.com/89/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=89&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://troydhanson.wordpress.com/2010/10/31/uthash-1-9-3-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8520d3f7da902afea5eedab6d9bd6f67?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">troydhanson</media:title>
		</media:content>

		<media:content url="http://troydhanson.files.wordpress.com/2010/10/uthash-mini1.png" medium="image">
			<media:title type="html">uthash-mini.png</media:title>
		</media:content>
	</item>
		<item>
		<title>uthash 1.9.2 released</title>
		<link>http://troydhanson.wordpress.com/2010/10/04/uthash-1-9-2-released/</link>
		<comments>http://troydhanson.wordpress.com/2010/10/04/uthash-1-9-2-released/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 07:20:02 +0000</pubDate>
		<dc:creator>troydhanson</dc:creator>
				<category><![CDATA[technotes]]></category>

		<guid isPermaLink="false">http://troydhanson.wordpress.com/?p=86</guid>
		<description><![CDATA[uthash v1.9.2 has been released. This is a minor enhancement release with a new iteration macro, a bug fix and a port of the hashscan utility to FreeBSD. Here is the ChangeLog entry: Version 1.9.2 (2010-10-04) new HASH_ITER macro for more convenient deletion-safe iteration hashscan can now run on FreeBSD 8.1 and later (thanks, Markus [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=86&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div> <img src="http://troydhanson.files.wordpress.com/2010/10/uthash-mini.png?w=420" style="border-width:0;" alt="uthash-mini.png"> </div>
<p><a href="http://uthash.sourceforge.net">uthash v1.9.2</a> has been released. This is a minor enhancement release with a new iteration macro, a bug fix and a port of the hashscan utility to FreeBSD. Here is the ChangeLog entry:</p>
<hr />
<h2><a name="_version_1_9_2_2010_10_04"></a>Version 1.9.2 (2010-10-04)</h2>
<ul>
<li> new <tt>HASH_ITER</tt> macro for more convenient deletion-safe iteration </li>
<li> <tt>hashscan</tt> can now run on FreeBSD 8.1 and later (thanks, Markus Gebert!) </li>
<li> More parens to evaluate complex macro arguments properly (thanks, ngg!) </li>
<li> Add sz parameter to the <tt>uthash_free</tt> hook for platforms that do their own memory management. Hopefully this minor API change doesn&#8217;t cause too much breakage for people. (thanks, Niall Douglas!) </li>
<li> uthash has been downloaded 12,294 times </li>
</ul>
<h3><a name="_upcoming_tpl_release"></a>Upcoming tpl release</h3>
<p>I hope to make a release of tpl before the year is out.  So, this would be a good time to submit any feature requests. Feel free to post them here or email me directly at <a href="mailto:tdh@tkhanson.net">tdh@tkhanson.net</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/troydhanson.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/troydhanson.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/troydhanson.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/troydhanson.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/troydhanson.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/troydhanson.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/troydhanson.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/troydhanson.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/troydhanson.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/troydhanson.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/troydhanson.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/troydhanson.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/troydhanson.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/troydhanson.wordpress.com/86/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=86&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://troydhanson.wordpress.com/2010/10/04/uthash-1-9-2-released/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8520d3f7da902afea5eedab6d9bd6f67?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">troydhanson</media:title>
		</media:content>

		<media:content url="http://troydhanson.files.wordpress.com/2010/10/uthash-mini.png" medium="image">
			<media:title type="html">uthash-mini.png</media:title>
		</media:content>
	</item>
		<item>
		<title>Virtual Memory in a nutshell</title>
		<link>http://troydhanson.wordpress.com/2010/07/18/virtual-memory-in-a-nutshell/</link>
		<comments>http://troydhanson.wordpress.com/2010/07/18/virtual-memory-in-a-nutshell/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 15:15:56 +0000</pubDate>
		<dc:creator>troydhanson</dc:creator>
				<category><![CDATA[technotes]]></category>

		<guid isPermaLink="false">http://troydhanson.wordpress.com/?p=77</guid>
		<description><![CDATA[In 2009 I put together a set of slides about Virtual Memory (pdf). Recently someone suggested I post them online, so here they are. This might be of interest to anyone doing Linux/Unix programming who&#8217;s struggled with questions like, How much memory does my process really take? What do RSS and VSIZE mean? If two [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=77&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In 2009 I put together a set of <a href="http://tkhanson.net/virtual_memory.pdf">slides about Virtual Memory</a> (pdf). Recently someone suggested I post them online, so here they are. This might be of interest to anyone doing Linux/Unix programming who&#8217;s struggled with questions like,</p>
<ul>
<li> How much memory does my process <em>really</em> take? </li>
<li> What do RSS and VSIZE mean? </li>
<li> If two processes share memory, does their RSS/VSIZE give a misleading picture of true memory usage? </li>
<li> What does it mean for the kernel to &#8220;overcommit&#8221; memory? Why does it do that? </li>
<li> When a process creates another process via fork, does all its memory get copied? What is copy-on-write? </li>
<li> Can I watch these phenomena in action using system commands? </li>
</ul>
<p>Now, I&#8217;m not a memory expert. If you need a deep reference on Linux kernel memory management, this is not the place to look.  But if you&#8217;re a programmer looking for a 10 minute demystification of Linux virtual memory then you might find it helpful.</p>
<h3><a name="_smem"></a>smem</h3>
<p>Also, see this <a href="http://prefetch.net/blog/index.php/2010/07/02/getting-an-accurate-view-of-process-memory-usage-on-linux-hosts/">post</a> on Blog O&#8217; Matty about the <a href="http://www.selenic.com/smem/">smem</a> utility. For newer kernels (&gt; 2.6.27) this tool can report a new Proportional Set Size (PSS). This is an interesting way to deal with the shortcoming of RSS: when two processes share resident memory pages, RSS makes it look like they&#8217;re both consuming that much memory, but PSS will show each process consuming part of the total. To put that in perspective, start several bash shells and run smem. Here, you can see RSS makes it &#8220;look&#8221; like each shell uses over 3 mb of RAM, but PSS reveals that due to sharing each shell really uses less than 2 mb.</p>
<pre style="color:gray;padding:.5em;">$ smem -P bash
 PID User    Command        USS      PSS      RSS
2521 hanson  bash          1928     2029     3488
2538 hanson  bash          1928     2029     3488
2555 hanson  bash          1928     2029     3488</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/troydhanson.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/troydhanson.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/troydhanson.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/troydhanson.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/troydhanson.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/troydhanson.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/troydhanson.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/troydhanson.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/troydhanson.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/troydhanson.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/troydhanson.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/troydhanson.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/troydhanson.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/troydhanson.wordpress.com/77/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=troydhanson.wordpress.com&amp;blog=6309572&amp;post=77&amp;subd=troydhanson&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://troydhanson.wordpress.com/2010/07/18/virtual-memory-in-a-nutshell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8520d3f7da902afea5eedab6d9bd6f67?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">troydhanson</media:title>
		</media:content>
	</item>
	</channel>
</rss>
