<?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>总结，归纳，演绎</title>
	<atom:link href="http://thuskyblue.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://thuskyblue.wordpress.com</link>
	<description>又一个技术、心得和感悟的博客</description>
	<lastBuildDate>Mon, 04 Jul 2011 06:26:32 +0000</lastBuildDate>
	<language>zh-cn</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='thuskyblue.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>总结，归纳，演绎</title>
		<link>http://thuskyblue.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://thuskyblue.wordpress.com/osd.xml" title="总结，归纳，演绎" />
	<atom:link rel='hub' href='http://thuskyblue.wordpress.com/?pushpress=hub'/>
		<item>
		<title>理解python中global的含义了……</title>
		<link>http://thuskyblue.wordpress.com/2010/01/13/global-in-python/</link>
		<comments>http://thuskyblue.wordpress.com/2010/01/13/global-in-python/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 16:11:40 +0000</pubDate>
		<dc:creator>thuskyblue</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://thuskyblue.wordpress.com/?p=26</guid>
		<description><![CDATA[In [1]: a = [5, 6] In [2]: def somefun(): &#8230;:     b = [6, 7] &#8230;:     b += [4] &#8230;:     print b &#8230;: &#8230;: In [3]: somefun() [6, 7, 4] In [4]: def somefun(): a += [4] print a &#8230;: In [7]: somefun() &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; UnboundLocalError                         Traceback (most recent call last) /home/sky/&#60;ipython console&#62; in &#60;module&#62;() /home/sky/&#60;ipython [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thuskyblue.wordpress.com&amp;blog=11104157&amp;post=26&amp;subd=thuskyblue&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In [1]: a = [5, 6]<br />
In [2]: def somefun():<br />
&#8230;:     b = [6, 7]<br />
&#8230;:     b += [4]<br />
&#8230;:     print b<br />
&#8230;:<br />
&#8230;:<br />
In [3]: somefun()<br />
[6, 7, 4]<br />
In [4]: def somefun():<br />
a += [4]<br />
print a<br />
&#8230;:<br />
In [7]: somefun()<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
UnboundLocalError                         Traceback (most recent call last)</p>
<p>/home/sky/&lt;ipython console&gt; in &lt;module&gt;()</p>
<p>/home/sky/&lt;ipython console&gt; in somefun()</p>
<p>UnboundLocalError: local variable &#8216;a&#8217; referenced before assignment<br />
In [8]: def somefun():<br />
a.append(4)<br />
print a<br />
&#8230;.:<br />
In [11]: somefun()<br />
[5, 6, 4]<br />
In [12]:</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thuskyblue.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thuskyblue.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thuskyblue.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thuskyblue.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thuskyblue.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thuskyblue.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thuskyblue.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thuskyblue.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thuskyblue.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thuskyblue.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thuskyblue.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thuskyblue.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thuskyblue.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thuskyblue.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thuskyblue.wordpress.com&amp;blog=11104157&amp;post=26&amp;subd=thuskyblue&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thuskyblue.wordpress.com/2010/01/13/global-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aa8ae93d5452a6c953c2235a9c654db1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thuskyblue</media:title>
		</media:content>
	</item>
		<item>
		<title>python的复习(1)</title>
		<link>http://thuskyblue.wordpress.com/2010/01/12/python-review-1/</link>
		<comments>http://thuskyblue.wordpress.com/2010/01/12/python-review-1/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 14:43:08 +0000</pubDate>
		<dc:creator>thuskyblue</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://thuskyblue.wordpress.com/?p=24</guid>
		<description><![CDATA[如果是python a.py，在里面__name__是&#8221;__main__&#8221;，如果是被import的，__name__是module名 为全局变量起一个本地的别名: import os; ls = os.linesep;&#8230; 对象的唯一标识：id() isinstance(num, int) 使用L表示长整型，不过不像C/C++，没有U 在不同类型之间进行运算的时候，需要用到类型转换，与﻿coerce()函数有关 oct()和hex()，返回整数的字符串表示 chr() &#60;&#8211;&#62; ord(), plus unichr() basestring是unicode和str的父类 enumerate/max/min/sorted/sum/zip，都可以接受一个可迭代对象做参数 较多使用字典类型的字符串模式化 浅copy是用切片来实现的 dict.get(xx, yy), dict.pop(xx, yy), dict.setdefault(xx, yy) dict.sorted() 返回有序迭代子 __hash__()，不可变==可哈希 frozenset()，还有这个东东可以试试 使用迭代器 使用生成器表达式，看起来它返回一个可迭代的容器 open()，&#8217;U'支持通用换行符。另外可以设置缓冲 os.linesep, os.sep, os.pathsep, os.curdir, os.pardir file.encoding, file.name, file.mode 简单用getopt，复杂用optparse cStringIO 修饰器是实现函数模板的一种办法 只有需要修改的时候才使用global: global var1, var2, var3&#8230; 关于闭包、生成器，核心编程已经不够用了<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thuskyblue.wordpress.com&amp;blog=11104157&amp;post=24&amp;subd=thuskyblue&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<ol>
<li>如果是python a.py，在里面__name__是&#8221;__main__&#8221;，如果是被import的，__name__是module名</li>
<li>为全局变量起一个本地的别名: import os; ls = os.linesep;&#8230;</li>
<li>对象的唯一标识：id()</li>
<li>isinstance(num, int)</li>
<li>使用L表示长整型，不过不像C/C++，没有U</li>
<li>在不同类型之间进行运算的时候，需要用到类型转换，与﻿coerce()函数有关</li>
<li>oct()和hex()，返回整数的字符串表示</li>
<li>chr() &lt;&#8211;&gt; ord(), plus unichr()</li>
<li>basestring是unicode和str的父类</li>
<li>enumerate/max/min/sorted/sum/zip，都可以接受一个可迭代对象做参数</li>
<li>较多使用字典类型的字符串模式化</li>
<li>浅copy是用切片来实现的</li>
<li>dict.get(xx, yy), dict.pop(xx, yy), dict.setdefault(xx, yy)</li>
<li>dict.sorted() 返回有序迭代子</li>
<li>__hash__()，不可变==可哈希</li>
<li>frozenset()，还有这个东东可以试试</li>
<li>使用迭代器</li>
<li>使用生成器表达式，看起来它返回一个可迭代的容器</li>
<li>open()，&#8217;U'支持通用换行符。另外可以设置缓冲</li>
<li>os.linesep, os.sep, os.pathsep, os.curdir, os.pardir</li>
<li>file.encoding, file.name, file.mode</li>
<li>简单用getopt，复杂用optparse</li>
<li>cStringIO</li>
<li>修饰器是实现函数模板的一种办法</li>
<li>只有需要修改的时候才使用global: global var1, var2, var3&#8230;</li>
<li>关于闭包、生成器，核心编程已经不够用了</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thuskyblue.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thuskyblue.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thuskyblue.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thuskyblue.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thuskyblue.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thuskyblue.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thuskyblue.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thuskyblue.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thuskyblue.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thuskyblue.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thuskyblue.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thuskyblue.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thuskyblue.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thuskyblue.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thuskyblue.wordpress.com&amp;blog=11104157&amp;post=24&amp;subd=thuskyblue&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thuskyblue.wordpress.com/2010/01/12/python-review-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aa8ae93d5452a6c953c2235a9c654db1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thuskyblue</media:title>
		</media:content>
	</item>
		<item>
		<title>monit配置</title>
		<link>http://thuskyblue.wordpress.com/2010/01/12/monit-configuration/</link>
		<comments>http://thuskyblue.wordpress.com/2010/01/12/monit-configuration/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 11:15:53 +0000</pubDate>
		<dc:creator>thuskyblue</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[SA]]></category>

		<guid isPermaLink="false">http://thuskyblue.wordpress.com/?p=21</guid>
		<description><![CDATA[一，使用init来带monit cat &#62;&#62; /etc/inittab &#60;&#60; END # Run Monit in standard run-levels mo:2345:respawn:/usr/sbin/monit -Ic /etc/monit/monitrc END telinit q 或者 kill -1 1 二、待续<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thuskyblue.wordpress.com&amp;blog=11104157&amp;post=21&amp;subd=thuskyblue&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>一，使用init来带monit</p>
<p>cat &gt;&gt; /etc/inittab &lt;&lt; END</p>
<p># Run Monit in standard run-levels<br />
mo:2345:respawn:/usr/sbin/monit -Ic /etc/monit/monitrc<br />
END</p>
<p>telinit q 或者 kill -1 1</p>
<p>二、待续</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thuskyblue.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thuskyblue.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thuskyblue.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thuskyblue.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thuskyblue.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thuskyblue.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thuskyblue.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thuskyblue.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thuskyblue.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thuskyblue.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thuskyblue.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thuskyblue.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thuskyblue.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thuskyblue.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thuskyblue.wordpress.com&amp;blog=11104157&amp;post=21&amp;subd=thuskyblue&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thuskyblue.wordpress.com/2010/01/12/monit-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aa8ae93d5452a6c953c2235a9c654db1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thuskyblue</media:title>
		</media:content>
	</item>
		<item>
		<title>使用git的体会</title>
		<link>http://thuskyblue.wordpress.com/2010/01/10/feel-using-git/</link>
		<comments>http://thuskyblue.wordpress.com/2010/01/10/feel-using-git/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 06:41:51 +0000</pubDate>
		<dc:creator>thuskyblue</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://thuskyblue.wordpress.com/?p=19</guid>
		<description><![CDATA[git又好用又难用。好用是因为它理念很好，难用是因为有些复杂。 我在使用git的过程中有一些体会，发上来仅供参考。 push之前先remote update再merge，否则可能push失败 在本地开新的分支，尽可能多地细分commit，然后使用rebase -i将这些commit合成几个大的commit 不要rebase origin/*，而要merge，否则会给别人带来麻烦，而且rebase之前要求clean，而merge不要求 将本地的新分支合并入master的时候可以用rebase，这样可以产生直线的历史 windows下的msysgit很好用，有补全、提示 git svn clone的时候加上-s会很方便 暂时没了<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thuskyblue.wordpress.com&amp;blog=11104157&amp;post=19&amp;subd=thuskyblue&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>git又好用又难用。好用是因为它理念很好，难用是因为有些复杂。</p>
<p>我在使用git的过程中有一些体会，发上来仅供参考。</p>
<ol>
<li>push之前先remote update再merge，否则可能push失败</li>
<li>在本地开新的分支，尽可能多地细分commit，然后使用rebase -i将这些commit合成几个大的commit</li>
<li>不要rebase origin/*，而要merge，否则会给别人带来麻烦，而且rebase之前要求clean，而merge不要求</li>
<li>将本地的新分支合并入master的时候可以用rebase，这样可以产生直线的历史</li>
<li>windows下的msysgit很好用，有补全、提示</li>
<li>git svn clone的时候加上-s会很方便</li>
<li>暂时没了</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thuskyblue.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thuskyblue.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thuskyblue.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thuskyblue.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thuskyblue.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thuskyblue.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thuskyblue.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thuskyblue.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thuskyblue.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thuskyblue.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thuskyblue.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thuskyblue.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thuskyblue.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thuskyblue.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thuskyblue.wordpress.com&amp;blog=11104157&amp;post=19&amp;subd=thuskyblue&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thuskyblue.wordpress.com/2010/01/10/feel-using-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aa8ae93d5452a6c953c2235a9c654db1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thuskyblue</media:title>
		</media:content>
	</item>
		<item>
		<title>如何确定Linux下一个进程所占用的内存大小</title>
		<link>http://thuskyblue.wordpress.com/2010/01/07/howto-calculate-linux-process-memory-size/</link>
		<comments>http://thuskyblue.wordpress.com/2010/01/07/howto-calculate-linux-process-memory-size/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 16:50:17 +0000</pubDate>
		<dc:creator>thuskyblue</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://thuskyblue.wordpress.com/?p=16</guid>
		<description><![CDATA[如何确定Linux下一个进程所占用的内存大小？这看起来超简单，top或者ps一下就能看出来。今天研究了一下发现并没有这么简单，相反还比较复杂。 以TOP为例，它有若干指示内存占用的列，从man top里摘抄如下： n: %MEM  &#8211;  Memory usage (RES) A task&#8217;s currently used share of available physical memory. o: VIRT  &#8211;  Virtual Image (kb) The total amount of virtual memory used by the task.  It includes all code, data and shared libraries plus pages that have been swapped out. VIRT = SWAP + RES. p: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thuskyblue.wordpress.com&amp;blog=11104157&amp;post=16&amp;subd=thuskyblue&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>如何确定Linux下一个进程所占用的内存大小？这看起来超简单，top或者ps一下就能看出来。今天研究了一下发现并没有这么简单，相反还比较复杂。</p>
<p>以TOP为例，它有若干指示内存占用的列，从man top里摘抄如下：</p>
<p>n: %MEM  &#8211;  Memory usage (RES)<br />
A task&#8217;s currently used share of available physical memory.</p>
<p>o: VIRT  &#8211;  Virtual Image (kb)</p>
<p>The total amount of virtual memory used by the task.  It includes all code, data and shared libraries plus pages that have been swapped out.</p>
<p>VIRT = SWAP + RES.</p>
<p>p: SWAP  &#8211;  Swapped size (kb)<br />
The swapped out portion of a task&#8217;s total virtual memory image.</p>
<p>q: RES  &#8211;  Resident size (kb)<br />
The non-swapped physical memory a task has used.</p>
<p>r: CODE  &#8211;  Code size (kb)<br />
The amount of virtual memory devoted to executable code, also known as the &#8216;text resident set&#8217; size or TRS.</p>
<p>s: DATA  &#8211;  Data+Stack size (kb)<br />
The amount of virtual memory devoted to other than executable code, also known as the &#8216;data resident set&#8217; size or DRS.</p>
<p>t: SHR  &#8211;  Shared Mem size (kb)<br />
The amount of shared memory used by a task.  It simply reflects memory that could be potentially shared with other processes.</p>
<p>首先是MEM大有深意。&#8221;share of available physical memory&#8221;，意为可用物理内存的共享。这说明代表的是在真正的物理内存使用大小，不包括换页到swap上的部分。而且这个&#8221;share&#8221;说明这个大小可能被多个进程共享，最典型的是父子进程。MEM就是RES/物理内存大小 * 100%</p>
<p>其次VIRT是&#8221;the total amount of virtual memory used by the task&#8221;，说明这是这个进程的使用整个进程空间大小。</p>
<p>再次SWAP是VIRT与RES的差值。意为被换页出去的内存大小。看起来这部分内存被放到SWAP分区上了，但简单计算一下就可以看出不是这么回事儿，每个进程的SWAP大小加起来要远远超过所使用的SWAP分区的大小。</p>
<p>再次CODE和DATA分别代表代码段和数据与堆栈段，CODE+DATA与VIRT接近，但从观察的结果来看，不一定接近。</p>
<p>以进程pcmanx为例，CODE(248kb) + DATA(78mb) 远小于RES(10mb) + SWAP(243mb)。</p>
<p>这说明，进程空间往往远大于CODE＋DATA。因为在执行过程中会free掉部分malloc出来的内存，进程空间没有减小，但DATA段大小减小。这样分析是否正确？</p>
<p>最后SHR看起来就没什么意义，因为&#8221;could be potentially shared with other processes&#8221;可能也就代表代码段和动态链接的库的大小？这只是我的猜测。</p>
<p>因此可以总结为，从RES看物理内存中的占用量，但这部分占用量是可能被&#8221;share&#8221;的；从VIRT看进程的进程空间大小，从DATA看进程现在所持有的数据大小。</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thuskyblue.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thuskyblue.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thuskyblue.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thuskyblue.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thuskyblue.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thuskyblue.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thuskyblue.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thuskyblue.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thuskyblue.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thuskyblue.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thuskyblue.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thuskyblue.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thuskyblue.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thuskyblue.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thuskyblue.wordpress.com&amp;blog=11104157&amp;post=16&amp;subd=thuskyblue&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thuskyblue.wordpress.com/2010/01/07/howto-calculate-linux-process-memory-size/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aa8ae93d5452a6c953c2235a9c654db1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thuskyblue</media:title>
		</media:content>
	</item>
		<item>
		<title>开博的理由</title>
		<link>http://thuskyblue.wordpress.com/2010/01/01/4/</link>
		<comments>http://thuskyblue.wordpress.com/2010/01/01/4/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 02:45:30 +0000</pubDate>
		<dc:creator>thuskyblue</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thuskyblue.wordpress.com/?p=4</guid>
		<description><![CDATA[新千年的第一个十年已经过去。回顾这十年，十年前是我上升的开始，十年之后的现在恐怕还需要再过十年才能评价。在这样一个有意义的日子里开始我的博客，我希望我能坚持下去。 和一个朋友探讨过写博客，同感是写博客需要很多时间，忙起来未必能拿出来这部分时间。引申一步说，学习也需要很多时间，工作忙起来了也未必能拿出来这部分时间；锻炼也需要很多时间，其它事情忙起来了也未必能拿出来这部分时间；和亲人在一起也需要很多时间，等等。看起来，我真的是比日理万机还要日理万机。所以我又想，既然我还没有到日理万机，这些时间我就应该能拿出来。 我认为锻炼身体、学习和总结是我在工作中常常忽略的重要内容。这几部分内容都着眼于长期的回报，我想在这种问题上不能短视。 于是就有了今天这篇博客，我也正式开博了。<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thuskyblue.wordpress.com&amp;blog=11104157&amp;post=4&amp;subd=thuskyblue&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>新千年的第一个十年已经过去。回顾这十年，十年前是我上升的开始，十年之后的现在恐怕还需要再过十年才能评价。在这样一个有意义的日子里开始我的博客，我希望我能坚持下去。</p>
<p>和一个朋友探讨过写博客，同感是写博客需要很多时间，忙起来未必能拿出来这部分时间。引申一步说，学习也需要很多时间，工作忙起来了也未必能拿出来这部分时间；锻炼也需要很多时间，其它事情忙起来了也未必能拿出来这部分时间；和亲人在一起也需要很多时间，等等。看起来，我真的是比日理万机还要日理万机。所以我又想，既然我还没有到日理万机，这些时间我就应该能拿出来。</p>
<p>我认为锻炼身体、学习和总结是我在工作中常常忽略的重要内容。这几部分内容都着眼于长期的回报，我想在这种问题上不能短视。</p>
<p>于是就有了今天这篇博客，我也正式开博了。</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thuskyblue.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thuskyblue.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thuskyblue.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thuskyblue.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thuskyblue.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thuskyblue.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thuskyblue.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thuskyblue.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thuskyblue.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thuskyblue.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thuskyblue.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thuskyblue.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thuskyblue.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thuskyblue.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thuskyblue.wordpress.com&amp;blog=11104157&amp;post=4&amp;subd=thuskyblue&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thuskyblue.wordpress.com/2010/01/01/4/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aa8ae93d5452a6c953c2235a9c654db1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thuskyblue</media:title>
		</media:content>
	</item>
	</channel>
</rss>
