<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7425907362171725677</id><updated>2024-09-13T05:11:15.786-07:00</updated><title type='text'>Lormann-pilot</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://lormann-pilot.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://lormann-pilot.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Lormann Chen</name><uri>http://www.blogger.com/profile/12034610919718116745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-VgPr5wGbjmw/TZGSys7EBUI/AAAAAAAAAAQ/djNtFhNyh1I/s220/174399_100002083652341_828117_q.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7425907362171725677.post-1880912814626610381</id><published>2011-06-15T23:55:00.000-07:00</published><updated>2011-06-15T23:55:14.378-07:00</updated><title type='text'>使用repo sync 作為同步方式的git code database</title><content type='html'>&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;我們使用同一台電腦的兩個不同 folder來作為code_server 及code_client，以下將分別說明在code_server 如何建置，在code_client 如果同步。&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-4d4BUIDdbWA/TfmbPpfdTAI/AAAAAAAAAAw/_kLSRZCLXsI/s1600/folders.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;192&quot; src=&quot;http://2.bp.blogspot.com/-4d4BUIDdbWA/TfmbPpfdTAI/AAAAAAAAAAw/_kLSRZCLXsI/s640/folders.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Code_Server 端:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1。建立一個.repo 的目錄&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 2。在.repo 的目錄下，建立一個manifests的目錄&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 3。在manifest目錄下產生一個default.xml 的檔，並建立一個softlink (manifest.xml)到.repo的根目錄下。&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-3eudixSAfbo/TfmhFdvV2xI/AAAAAAAAAA0/U6ESCdZ4eZg/s1600/manifest.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;68&quot; src=&quot;http://2.bp.blogspot.com/-3eudixSAfbo/TfmhFdvV2xI/AAAAAAAAAA0/U6ESCdZ4eZg/s640/manifest.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 4。在code_server 下，建立一個mycode1 的folder ，裡面先放入一個code1.c 的檔，並且git init 成為一個git 的codebase。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-NK6ZUo3qm9Y/Tfmh-DkKR1I/AAAAAAAAAA4/bBdRU2YKRK0/s1600/mycodegitinit.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;208&quot; src=&quot;http://1.bp.blogspot.com/-NK6ZUo3qm9Y/Tfmh-DkKR1I/AAAAAAAAAA4/bBdRU2YKRK0/s640/mycodegitinit.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; 5。在.repo下，建立一個projects 的目錄，其下建立一個softlink 名為mycode1.git ，連到mycode1下的.git folder&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-PLZzYgvWeTQ/Tfmi-iwM3yI/AAAAAAAAAA8/2MrHAiGg-hk/s1600/projectsfolder.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;54&quot; src=&quot;http://3.bp.blogspot.com/-PLZzYgvWeTQ/Tfmi-iwM3yI/AAAAAAAAAA8/2MrHAiGg-hk/s640/projectsfolder.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-B32zCYs1n0Y/Tfmi_7yeAgI/AAAAAAAAABA/tKef3WLidOU/s1600/projectssoftlink.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;78&quot; src=&quot;http://1.bp.blogspot.com/-B32zCYs1n0Y/Tfmi_7yeAgI/AAAAAAAAABA/tKef3WLidOU/s640/projectssoftlink.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;6。修改default.xml 如下：&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-0kfPDqNC7Fg/Tfmj8v-BrII/AAAAAAAAABE/rIRnRkcTH_k/s1600/defaultxml.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;238&quot; src=&quot;http://3.bp.blogspot.com/-0kfPDqNC7Fg/Tfmj8v-BrII/AAAAAAAAABE/rIRnRkcTH_k/s640/defaultxml.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;7。到.repo/manifests 目錄下，建立git database，並且在在.repo 下建立manifest.git 的 softlink到，manifest 下的.git &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-RWTrJ_5h8Iw/Tfmk4yKSzQI/AAAAAAAAABI/q0DgFTvXMcg/s1600/manifestgit.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;112&quot; src=&quot;http://3.bp.blogspot.com/-RWTrJ_5h8Iw/Tfmk4yKSzQI/AAAAAAAAABI/q0DgFTvXMcg/s640/manifestgit.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-9pjZc9mFCmc/Tfml5Hufb9I/AAAAAAAAABQ/0zDoWZy6R3M/s1600/manifestgitsoftlink.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;158&quot; src=&quot;http://1.bp.blogspot.com/-9pjZc9mFCmc/Tfml5Hufb9I/AAAAAAAAABQ/0zDoWZy6R3M/s640/manifestgitsoftlink.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Code_Client 端：&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1. 使用以下repo 指令，先抓下manifest.xml&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2. 接著下repo sync的指，開始同步 code&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;3. 可以到code 的目錄看文件內容是否一致同步下來了 (done)&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-_b9DasjEHN8/TfmoaI2_R3I/AAAAAAAAABU/j8QDnKw01fs/s1600/repoinit.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;142&quot; src=&quot;http://2.bp.blogspot.com/-_b9DasjEHN8/TfmoaI2_R3I/AAAAAAAAABU/j8QDnKw01fs/s640/repoinit.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-ohps1wmRZNk/Tfmoa-xRn3I/AAAAAAAAABY/Q6jVY4uV5ZA/s1600/reposync.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;352&quot; src=&quot;http://2.bp.blogspot.com/-ohps1wmRZNk/Tfmoa-xRn3I/AAAAAAAAABY/Q6jVY4uV5ZA/s640/reposync.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-GeKj2De7osw/TfmobTdfpzI/AAAAAAAAABc/STCpmuJVj6o/s1600/result.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;336&quot; src=&quot;http://3.bp.blogspot.com/-GeKj2De7osw/TfmobTdfpzI/AAAAAAAAABc/STCpmuJVj6o/s640/result.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lormann-pilot.blogspot.com/feeds/1880912814626610381/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://lormann-pilot.blogspot.com/2011/06/repo-sync-git-code-database.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/1880912814626610381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/1880912814626610381'/><link rel='alternate' type='text/html' href='http://lormann-pilot.blogspot.com/2011/06/repo-sync-git-code-database.html' title='使用repo sync 作為同步方式的git code database'/><author><name>Lormann Chen</name><uri>http://www.blogger.com/profile/12034610919718116745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-VgPr5wGbjmw/TZGSys7EBUI/AAAAAAAAAAQ/djNtFhNyh1I/s220/174399_100002083652341_828117_q.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-4d4BUIDdbWA/TfmbPpfdTAI/AAAAAAAAAAw/_kLSRZCLXsI/s72-c/folders.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7425907362171725677.post-1798590528329728861</id><published>2011-05-20T02:07:00.000-07:00</published><updated>2011-05-20T02:07:52.118-07:00</updated><title type='text'>Linux boot up  seq. with  pid0(idle) and pid1 (init)</title><content type='html'>&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体; font-size: 20px;&quot;&gt;參考:&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体; font-size: 20px;&quot;&gt;&lt;a href=&quot;http://os.51cto.com/art/200912/168847.htm&quot;&gt;分析linux内核的idle的知识&lt;/a&gt;，可以了解到kernel idle特色，其中補充一些了解如下 ：&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体; font-size: 20px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;PID0:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&amp;nbsp; &amp;nbsp; 這個就是最後idle task (cpu_idle)，它是從start_kernel開始，在一連串的初始化及folk 出pid1 (kernel_init) 及pid2(kthreadd)後，就進入cpu_idle.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&amp;nbsp; &amp;nbsp; cpu_idle 會引用pm_idle，這是函數指標，在initcall 的期間，設定相應的平台對應函數，例如：late_initcall(omap2_pm_init)，過此，idle休眠與平台的關係就建立起來了。&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&amp;nbsp; &amp;nbsp;其中initcall 是在kernel_init thread 中，於 (pid0)fork &amp;nbsp;init前，do_basic_setup()裡引用do_initcalls()。&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&amp;nbsp; &amp;nbsp;initcall 裡會去執行driver 的module_init，其中platform_driver_reg的動作與start_kernel下setup_arch裡的platform_device_reg中，已註冊過的device 作名字的比對配對，然後作對上的driver module init的流程。&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;PID1:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&amp;nbsp; 同上面提到PID1 從kernel_init 這個thread 開始，最終folk 出init 這個process。&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&amp;nbsp;值得一提的是，init 最後常駐在記憶体中，它主要是將init.rc的內容，parsing 為action_list 及 service_list, 分類依序配置及執行，同時最後的loop 會去watch 那些不是oneshot 的service，一旦被kill掉時，利用SIGCHLD的通知，把它們再re-start出來。&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 黑体;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 20px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lormann-pilot.blogspot.com/feeds/1798590528329728861/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://lormann-pilot.blogspot.com/2011/05/linux-boot-up-seq-with-pid0idle-and.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/1798590528329728861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/1798590528329728861'/><link rel='alternate' type='text/html' href='http://lormann-pilot.blogspot.com/2011/05/linux-boot-up-seq-with-pid0idle-and.html' title='Linux boot up  seq. with  pid0(idle) and pid1 (init)'/><author><name>Lormann Chen</name><uri>http://www.blogger.com/profile/12034610919718116745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-VgPr5wGbjmw/TZGSys7EBUI/AAAAAAAAAAQ/djNtFhNyh1I/s220/174399_100002083652341_828117_q.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7425907362171725677.post-493623856082113380</id><published>2011-04-11T18:27:00.000-07:00</published><updated>2011-04-12T00:38:36.821-07:00</updated><title type='text'>Android talks to service via three IPC methods</title><content type='html'>&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;當我們需要一些工作是在背景同執行的時候，我們會使用到service 的物件，而當該service產生之後，下一個問題就是怎麼與該service 進行溝通。&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;在Android 裡，有三種IPC 方式可以使用來與Service 作互動：（如下）&lt;br /&gt;
&lt;br /&gt;
１. 當該Service 僅在同一個Application執行，可以簡單讓Service extend Binder class，在Activity&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; font-size: 13px; white-space: pre;&quot;&gt;onServiceConnected&lt;/span&gt;時候，&lt;a href=&quot;http://developer.android.com/guide/topics/fundamentals/bound-services.html#Binder&quot;&gt;透過Binder 取得Serivce 的instance&lt;/a&gt; ，而後可以直接取用public 的method，來操作該個Service.且不經過&lt;a href=&quot;http://www.jguru.com/faq/viewquestion.jsp?EID=429488&quot;&gt;marshalling and unmarshalling&lt;/a&gt;的動作。&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;2. 當Service 不在同個Application 下，若而該Service 執行服務的函數可以依序排隊執行時，我們可以選用Messenger 的方式來進行IPC。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. 當Service 不在同一個Application 下，且Service 執行服務的動作需求同時並行，那就必需使用上AIDL（Android Interface Definition Language).</content><link rel='replies' type='application/atom+xml' href='http://lormann-pilot.blogspot.com/feeds/493623856082113380/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://lormann-pilot.blogspot.com/2011/04/android-talk-to-service-via-three-ipc.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/493623856082113380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/493623856082113380'/><link rel='alternate' type='text/html' href='http://lormann-pilot.blogspot.com/2011/04/android-talk-to-service-via-three-ipc.html' title='Android talks to service via three IPC methods'/><author><name>Lormann Chen</name><uri>http://www.blogger.com/profile/12034610919718116745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-VgPr5wGbjmw/TZGSys7EBUI/AAAAAAAAAAQ/djNtFhNyh1I/s220/174399_100002083652341_828117_q.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7425907362171725677.post-5807631511534199635</id><published>2011-04-05T09:12:00.000-07:00</published><updated>2011-04-05T18:26:36.301-07:00</updated><title type='text'>Linux Process 排程-3 (Processes Priority and time slice)</title><content type='html'>&amp;nbsp;&amp;nbsp; &amp;nbsp; 所謂的Process&amp;nbsp;Priority 指的是Process 能使用CPU的優先順序，以Linux 的系統為例，有兩個值影響Process Priority：&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;b&gt;nice value&lt;/b&gt;愈大，表示該process 對系統其它的processes愈&quot;nice&quot;，因為它使用CPU的優先權較低.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;b&gt;real -time priority value&lt;/b&gt; ，則與nice value相反，它的值愈大，其優先權愈大。&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; 一般embedded system中，依功能性的不同，而存在不同優先順序的tasks。通常提供服務的task或者是time critical的task，會給予較高的優先權，以提供使用者或client task 較好的response time 及服務，相對的使用服務的task其Priority 就較低。&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; 依不同的系統設計，高Priority value 的task 通常會給予較長的time slice 或是優先執行完畢&lt;b&gt;(非Linux目前作法，後述) 。&lt;/b&gt;而當多個task 指定同一個Priority value時，可以採取round-robin的方式，讓每個相同priority value的task輪流分到一個time slice 的CPU 使用時段，repeat cycle.&lt;b&gt;（假設以high priority task 優先執行畢的系統為例）&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; 其中指的Time slice 就是CPU 執行的duration for given process.這個值如果定義的太大，那系統執行起來就沒有concurrent 執行的感覺，也就是user interactive response會大長，感覺不好，但反之如果設的太短，那花在task context switch 的overhead就會太多，浪費了CPU整體的資源。&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; 在Linux CFS (Completely Fair Scheduler)的設定下，time slice 並非一個固定值，而是依據正在執行的processes 它們的nice value，來分配各個process 使用CPU的比例(proportion)，也就是會依系統的loading 及其對應的priority value 來作time slice 動態的調整。&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;在CFS 排程下，一個新加入的process 是否能preempting current process，立即執行，是根據該Process 的priority 及available time slice，而Linux 較新的CFS 中，這個動作的決策，則是依據佔CPU proportion 來決定，例如，原本的系統中有三個processes A(50%)　－＞　B(30%)　－＞C(20%)－＞A，假設有個D Process 產生在B執行的期間，那如果D佔CPU proportion會高於B, 那它會稍後執行A-&amp;gt;B-&amp;gt;D-&amp;gt;C-A ，反之，D可以preempting B立即執行，那會變成是A-&amp;gt;D-&amp;gt;B-&amp;gt;C-&amp;gt;A。&lt;b&gt;（以上的想法的假設，後續更了解後，如果有誤，再回頭修改）&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 14px; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; In Linux, under the new CFS scheduler, the decision is a&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;b&gt;&lt;b&gt;function of how much of a proportion of the processor the newly runnable processor has&amp;nbsp;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b&gt;consumed. If it has consumed a smaller proportion of the processor than the currently&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;display: inline !important;&quot;&gt;&lt;div style=&quot;display: inline !important;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b&gt;executing process, it runs immediately, preempting the current process. If not, it is scheduled&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;display: inline !important;&quot;&gt;&lt;div style=&quot;display: inline !important;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b&gt;to run at a later time.&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13;&quot;&gt;(from&amp;nbsp;Linux.Kernel.Development.3rd.Edition -Robert Love)&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lormann-pilot.blogspot.com/feeds/5807631511534199635/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://lormann-pilot.blogspot.com/2011/04/linux-process-3-processes-priority-and.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/5807631511534199635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/5807631511534199635'/><link rel='alternate' type='text/html' href='http://lormann-pilot.blogspot.com/2011/04/linux-process-3-processes-priority-and.html' title='Linux Process 排程-3 (Processes Priority and time slice)'/><author><name>Lormann Chen</name><uri>http://www.blogger.com/profile/12034610919718116745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-VgPr5wGbjmw/TZGSys7EBUI/AAAAAAAAAAQ/djNtFhNyh1I/s220/174399_100002083652341_828117_q.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7425907362171725677.post-6252431824127030671</id><published>2011-04-05T07:36:00.000-07:00</published><updated>2011-04-05T07:36:56.017-07:00</updated><title type='text'>Linux Process 排程-2 (I/O bound vs Processor -bound)</title><content type='html'>&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;一般Process 我們可以依它使用CPU的特性分為I/O-bound 及Processor-bound .&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;b&gt; &amp;nbsp;I/O bound &lt;/b&gt;指的是它用少量CPU 的時間，多數時間用來等待I/O 的input，例如Key input。&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;Processor-bound&lt;/b&gt; 則是以使用CPU的時間為主，例如一個無窮迴圈。&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;而一個系統的排程，通常會希望達到最小延遲的表現，也就要較好的user interactive response time。因此，以此為Policy 排程通常是以I/O-bound 的process 為優先。 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;</content><link rel='replies' type='application/atom+xml' href='http://lormann-pilot.blogspot.com/feeds/6252431824127030671/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://lormann-pilot.blogspot.com/2011/04/linux-process-2-io-bound-vs-processor.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/6252431824127030671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/6252431824127030671'/><link rel='alternate' type='text/html' href='http://lormann-pilot.blogspot.com/2011/04/linux-process-2-io-bound-vs-processor.html' title='Linux Process 排程-2 (I/O bound vs Processor -bound)'/><author><name>Lormann Chen</name><uri>http://www.blogger.com/profile/12034610919718116745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-VgPr5wGbjmw/TZGSys7EBUI/AAAAAAAAAAQ/djNtFhNyh1I/s220/174399_100002083652341_828117_q.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7425907362171725677.post-8880718198810452697</id><published>2011-04-03T07:51:00.000-07:00</published><updated>2011-04-03T07:51:31.660-07:00</updated><title type='text'>Lormann-pilot: Monolithic kernel and Microkernel</title><content type='html'>&lt;a href=&quot;http://lormann-pilot.blogspot.com/2011/03/monolithic-kernel-and-microkernel.html?spref=bl&quot;&gt;Lormann-pilot: Monolithic kernel and Microkernel&lt;/a&gt;: &quot;          Linux 屬於Monolithic , 而NT / XP 之類則屬於MicroKernel, 兩者的差別比較：           Monolithic Ke...&quot;</content><link rel='replies' type='application/atom+xml' href='http://lormann-pilot.blogspot.com/feeds/8880718198810452697/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://lormann-pilot.blogspot.com/2011/04/lormann-pilot-monolithic-kernel-and.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/8880718198810452697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/8880718198810452697'/><link rel='alternate' type='text/html' href='http://lormann-pilot.blogspot.com/2011/04/lormann-pilot-monolithic-kernel-and.html' title='Lormann-pilot: Monolithic kernel and Microkernel'/><author><name>Lormann Chen</name><uri>http://www.blogger.com/profile/12034610919718116745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-VgPr5wGbjmw/TZGSys7EBUI/AAAAAAAAAAQ/djNtFhNyh1I/s220/174399_100002083652341_828117_q.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7425907362171725677.post-1278082067400609672</id><published>2011-03-31T19:23:00.000-07:00</published><updated>2011-03-31T19:31:50.076-07:00</updated><title type='text'>Linux Process 排程-1</title><content type='html'>&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;所謂的process 排程，就是指CPU 的資源作有效的安排 &amp;nbsp;(&quot;which next process&quot; 、”when&quot; and &quot;how long&quot;).&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;多工執行的系統有分為&lt;a href=&quot;http://webcache.googleusercontent.com/search?q=cache:11zUIf54caEJ:entry.hit.edu.tw/~pn93030/C/C0191.HTML+multitask+cooperative&amp;amp;cd=3&amp;amp;hl=zh-TW&amp;amp;ct=clnk&amp;amp;gl=tw&amp;amp;source=www.google.com.tw&quot;&gt;preemptive multitasking and cooperative multitasking. Linux &lt;/a&gt;使用的是前者，preemptive multitasking. 而preemptive 簡單說就是執行中的task(Process )，可以非自願式在執行未結束的過程中，被scheduler 將其使用的CPU 的資源交給另一個優先權較高的task. 反之cooperative multitasking 則是由佔有CPU資源的程式執行到特定段落時，將CPU 資源交出時，才作重新排程，這也就是協調多工。（除了Win3.1及MAC OS 9使用cooperative multitasking 外，多數都是採用preemptive multitasking).&lt;br /&gt;
&lt;br /&gt;
在preemptive multitasking &amp;nbsp;中，有個名詞叫作timeslice，指的是每個process 能執行的時間片段。</content><link rel='replies' type='application/atom+xml' href='http://lormann-pilot.blogspot.com/feeds/1278082067400609672/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://lormann-pilot.blogspot.com/2011/03/process-1.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/1278082067400609672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/1278082067400609672'/><link rel='alternate' type='text/html' href='http://lormann-pilot.blogspot.com/2011/03/process-1.html' title='Linux Process 排程-1'/><author><name>Lormann Chen</name><uri>http://www.blogger.com/profile/12034610919718116745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-VgPr5wGbjmw/TZGSys7EBUI/AAAAAAAAAAQ/djNtFhNyh1I/s220/174399_100002083652341_828117_q.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7425907362171725677.post-3197461612728082326</id><published>2011-03-31T18:56:00.000-07:00</published><updated>2011-03-31T18:56:21.561-07:00</updated><title type='text'>thread and process under Linux</title><content type='html'>&amp;nbsp; &amp;nbsp; &amp;nbsp; 在Linux kernel 中，沒有thread的concept，有別於其它的OS -XP/NT，他們的process 結構有明確的定義所屬的thread, 也較為單純，有人說是lightweight process.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;但在Linux kernel裡，thread 就是標準的process ，差別是, 它與其它稱為 &quot;同一個process 下的threads&quot;，共享address、file open 等resource. &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;另一個要注意的名調是kernel thread, 這個thread 僅執行在kernel space, 所以他task結構中的mm是null，也就是說他沒有address space.</content><link rel='replies' type='application/atom+xml' href='http://lormann-pilot.blogspot.com/feeds/3197461612728082326/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://lormann-pilot.blogspot.com/2011/03/thread-and-process-under-linux.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/3197461612728082326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/3197461612728082326'/><link rel='alternate' type='text/html' href='http://lormann-pilot.blogspot.com/2011/03/thread-and-process-under-linux.html' title='thread and process under Linux'/><author><name>Lormann Chen</name><uri>http://www.blogger.com/profile/12034610919718116745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-VgPr5wGbjmw/TZGSys7EBUI/AAAAAAAAAAQ/djNtFhNyh1I/s220/174399_100002083652341_828117_q.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7425907362171725677.post-1015249187616240636</id><published>2011-03-29T01:14:00.000-07:00</published><updated>2011-03-29T01:14:13.263-07:00</updated><title type='text'>Activity 的四種不同工作模式</title><content type='html'>&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp; Activity 在同一個”task&quot; 是以堆疊的方式排放在一起，一般來若沒特別指定”模式”的話，新的Activity 會疊在前一個的上面，當最上面的Activity call finish() or 按下back key 時，該Activity 會被Destroy 掉，疊在下面的那一個會被ReStart.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 其模式可以被分為四種，&lt;a href=&quot;http://peterisgood2002.wordpress.com/2011/01/22/android-%E5%9B%9B%E5%80%8Blaunch-mode%E7%B8%BD%E6%95%B4%E7%90%86/&quot; rel=&quot;nofollow&quot; style=&quot;color: #8a8c50; text-decoration: underline;&quot;&gt;Standard( 沒特別指定）、Single top 、Single task and Single instance.&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: #274e13; font-size: small;&quot;&gt;多個相同的Activity實体:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;1. Standard mode &lt;/b&gt;:&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;新產生的會疊在最上頭, 最上面&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;舊OnPause&lt;/span&gt;&amp;nbsp;&lt;/b&gt;-&amp;gt; 新onCreate -&amp;gt; 新onStart -&amp;gt; 新onRescume－＞&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;舊OnStop&lt;/b&gt;&amp;nbsp;&lt;/span&gt;。&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;　　&lt;b&gt;2. Single top mode: &amp;nbsp;&lt;/b&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp; &amp;nbsp; 若設定Single top mode 的那個Activity 不在最top 的堆疊，那start 該個Activity 時，結果與Standard mode 相同。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 若該Activity 在top ，當Start 該Activity時，會在看到同一個Activity&amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt;OnPause&lt;/span&gt;&amp;nbsp;, 接著同一個Activity 就會執行&amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt;OnResume&lt;/span&gt;。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #274e13; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #274e13; font-size: small;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;只有一個Activity的實体:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #274e13; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;　由於只有一個實体的產生，那重點是在它被疊在stack裡時候，如果有intent 傳來要start 該Activity ，那堆疊會有什麼樣的變化？是不是已經疊在上面的Activity 都會被清除，讓該個Activity 浮上來？&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1. Single Task Mode:(該Activity 只產生在該task 內一個實体，不同task 可存在另一個實体）&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;　　　當該Activity 被叫到的時候，在它上面疊著的其它Activity 都會被清掉。&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2. Single Instance Mode:（該Activity 產生的時候，只在產生一個新的task，該task 也僅有它這一個Activity，系統中僅這一個實体） &amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;　　　當該Activity 被叫到的時候，由於它是獨立的task，所以，在它上面疊著的其它Activity會保留，&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;不會被影響到，因為它們是不同的task&lt;/b&gt;&lt;/span&gt;。但也因為這樣，所以當我們按back key一路退回去的時候，不會看到該instance 出現在退出的堆疊中。&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lormann-pilot.blogspot.com/feeds/1015249187616240636/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://lormann-pilot.blogspot.com/2011/03/activity.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/1015249187616240636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/1015249187616240636'/><link rel='alternate' type='text/html' href='http://lormann-pilot.blogspot.com/2011/03/activity.html' title='Activity 的四種不同工作模式'/><author><name>Lormann Chen</name><uri>http://www.blogger.com/profile/12034610919718116745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-VgPr5wGbjmw/TZGSys7EBUI/AAAAAAAAAAQ/djNtFhNyh1I/s220/174399_100002083652341_828117_q.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7425907362171725677.post-3488034473069059616</id><published>2011-03-29T00:10:00.000-07:00</published><updated>2011-03-29T01:01:35.721-07:00</updated><title type='text'>Monolithic kernel and Microkernel</title><content type='html'>&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Linux 屬於Monolithic , 而NT / XP 之類則屬於MicroKernel, 兩者的差別比較：&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;&amp;nbsp; &amp;nbsp;Monolithic Kernel:&lt;/b&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; implemented entirely as a single process running in a single address space. Then kernel can invoke functions directly, as a user-space application might.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;b&gt; &amp;nbsp; &amp;nbsp; Microkernel:&lt;/b&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;the functionality of the kernel is broken into separated processes, usually called servers which are running in privileged execution mode. (other servers that don&#39;t need privileged execution mode are running under user space). So it&#39;s not possible for direct invoking function between servers, and instead, microkernels communicate via message passing.&lt;br /&gt;
&lt;br /&gt;
The separation of the various servers prevents a failure in one server from&amp;nbsp;bringing down another.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13;&quot;&gt;(from&amp;nbsp;Linux.Kernel.Development.3rd.Edition -Robert Love)&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;至於兩者好壞，各有說法，可參考&lt;a href=&quot;http://www.eettaiwan.com/ART_8800540392_676964_NT_517c9050.HTM&quot;&gt;重新審視微核心法則&lt;/a&gt;, 其中強調Microkernel 最大的特色是&quot; &lt;b&gt;可靠性 &lt;/b&gt;&quot;，&lt;b&gt;而Linux 是monolithic kernel ，但它也引用了Microkernel Modular 設計的概念，可以動態的載入不同的modules.&lt;/b&gt;</content><link rel='replies' type='application/atom+xml' href='http://lormann-pilot.blogspot.com/feeds/3488034473069059616/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://lormann-pilot.blogspot.com/2011/03/monolithic-kernel-and-microkernel.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/3488034473069059616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/3488034473069059616'/><link rel='alternate' type='text/html' href='http://lormann-pilot.blogspot.com/2011/03/monolithic-kernel-and-microkernel.html' title='Monolithic kernel and Microkernel'/><author><name>Lormann Chen</name><uri>http://www.blogger.com/profile/12034610919718116745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-VgPr5wGbjmw/TZGSys7EBUI/AAAAAAAAAAQ/djNtFhNyh1I/s220/174399_100002083652341_828117_q.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7425907362171725677.post-8140344755256474635</id><published>2011-03-28T23:50:00.000-07:00</published><updated>2011-03-28T23:50:53.131-07:00</updated><title type='text'>Linux Kernel 在任何時刻都處於三種狀況之一</title><content type='html'>&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Linux Kernel 在任何時刻都處於三種狀況之一:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1。In user space, executing user code in a process&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2。In kernel-space , in process context, executing on behalf of a specific process&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3。In kernel-space , in interrupt context, no associated with a process, handling an interrupt&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 就算是在系統idle 時，&lt;b&gt;kernel is executing an idle process in process context.&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13;&quot;&gt; (from&amp;nbsp;Linux.Kernel.Development.3rd.Edition -Robert Love)&lt;/span&gt;&lt;/b&gt;</content><link rel='replies' type='application/atom+xml' href='http://lormann-pilot.blogspot.com/feeds/8140344755256474635/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://lormann-pilot.blogspot.com/2011/03/linux-kernel.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/8140344755256474635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7425907362171725677/posts/default/8140344755256474635'/><link rel='alternate' type='text/html' href='http://lormann-pilot.blogspot.com/2011/03/linux-kernel.html' title='Linux Kernel 在任何時刻都處於三種狀況之一'/><author><name>Lormann Chen</name><uri>http://www.blogger.com/profile/12034610919718116745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/-VgPr5wGbjmw/TZGSys7EBUI/AAAAAAAAAAQ/djNtFhNyh1I/s220/174399_100002083652341_828117_q.jpg'/></author><thr:total>0</thr:total></entry></feed>