2011年9月13日 星期二

Mutli OS in one disk by using GRUB boot list

為了工作上的需要
因此最近開始研究

安裝多重OS 在同一顆硬碟上
首先測試的組合為
Rhel4 + Rhel5 x86 + Rhel5 x64 +Sles 10 x64
再加上其kernel & Xen 的模式
所以GRUB的開機選單為9個







1.先規劃好硬碟切割的空間
SWAP 一個讓每個OS 共用即可
/           每個OS 擁有自己的根目錄
/boot    這個是最重要的地方! 每個OS 都必須要擁有自己獨立的boot folder


2.我安裝的順序分別為 Rhel5 > Rhel4 >Sles10


3.再來就是到預設的boot folder 底下去編輯
grub.conf 這個檔案
將其他的OS 的grub.conf 參數加入即可


下面為 rhel4 + rhel5 為範例 



# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,4)
#          kernel /vmlinuz-version ro root=/dev/sda6
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,4)/grub/splash.xpm.gz
hiddenmenu
title Rhel4 AS (2.6.9-89.ELsmp)
root (hd0,4)
kernel /vmlinuz-2.6.9-89.ELsmp ro root=LABEL=/1 rhgb quiet
initrd /initrd-2.6.9-89.ELsmp.img
title Rhel4 AS-up (2.6.9-89.EL)
root (hd0,4)
kernel /vmlinuz-2.6.9-89.EL ro root=LABEL=/1 rhgb quiet
initrd /initrd-2.6.9-89.EL.img
title Rhel5 (2.6.18-238.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-238.el5 
module /vmlinuz-2.6.18-238.el5xen ro root=LABEL=/ rhgb quiet
module /initrd-2.6.18-238.el5xen.img
title Rhel5-base (2.6.18-238.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-238.el5 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.18-238.el5.img

2011年9月6日 星期二

Xcode 學習筆記(三)iphone Application Developer(2009~2010 winter) 之二



因為這堂課要講解的東西比較多 所以把它分成多次筆記來寫囉!


==================================================
Time = 15:08
Object Lifecycle




Time = 23:08
Reference Counting
• Every object has a retain count
這邊提到 每個object 都有一個 retain 值
初始值為0


■ Defined on NSObject
■ As long as retain count is > 0, object is alive and valid
• alloc and copy create objects with retain count == 1
使用 alloccopy 方法去建立objects 會使得 retain 值為 1


• retain increments retain count
retain 會增加 1
• release decrements retain count
release 則會減少 1
• When retain count reaches 0, object is destroyed
當 retain 值為0 的時候 , object 就會毀滅


• dealloc method invoked automatically
dealloc 這個方法就會自動被呼叫
■ One-way street, once you’re in -dealloc there’s no turning back
這是單行道 當呼叫 dealloc 後,記憶體就會被釋放


這個投影片就可以清楚看到 
Retain 透過 alloc , retain 增加1
release 則是減少1 
當Retain 為0時,dealloc 會自動被呼叫收回記憶體(釋放記憶體)。


所以關於Object Lifecycle 總整理如下

Object Lifecycle Recap
Objects begin with a retain count of 1
Increase and decrease with -retain and -release
When retain count reaches 0, object deallocated automatically
You never call dealloc explicitly in your code 
      ■ Exception is calling -[super dealloc]
      ■ You only deal with alloc, copy, retain, release