分類:Solaris

殘酷的 Unix

You now, unix is a cruel operating system, sometimes parent kills its children, and what it worse, it sometimes turns them into zombies.

Via pavelmachek

Technorati Tags:

廣告

Veritas CLI simplize to ZFS like

Veritas 和 ZFS 都具備 file system 不停止直接加硬碟直接放大縮小 file system 容量的能力,不用 growfs。

From Voronin:

Veritas 要建一個兩棵硬碟的檔案系統需要的指令 (Basic 版免費)

# vxdisksetup -i disk0
# vxdisksetup -i disk1
# vxdg init dg0 dm0=disk0 dm1=disk1
# vxassist -g dg0 maxsize dm:dm0
# vxassist -g dg0 maxsize dm:dm1
# vxassist -g dg0 make volume0 dm:dm0
# vxassist -g dg0 make volume1 dm:dm1
# vxvset -g dg0 make vset0 volume0
# mkfs -F vxfs /dev/vx/rdsk/dg0/vset0
# mkdir /mnt0
# mount -F vxfs /dev/vx/dsk/dg0/vset0 /mnt0
# vxvset -g dg0 addvol vset0 volume1
# fsvoladm add /mnt0 volume1

ZFS 的指令

# zpool create pool0 disk0 disk1
# zfs create pool0/fs0

新的 Veritas 指令

# sfop dg create dg0 disk0 disk1
# sfop fs create dg0:fs0

雖然 Veritas 指令簡化了, 但是免費版的有 4 volumes, and/or 4 file systems, and or 2 CPU sockets 限制,好處是已經實作在 AIX/Solaris/Linux 三種平台。

Technorati Tags: ,

Links for 2006-06-01

Solaris kernel is pre-emptible by default

Attempt is made to make Monta vista Linux kernel fully pre-emptible.

Beware: Solaris kernel programmers have to be careful while desigining the code because they should know the points where kernel should not be pre-empted. Where as Linux kernel progammer can be careless as far as pre-emption is concerned because they know that it is only they who can preempt the kernel. In 2.6 Linux kernel pre-emption points are designed such that pre-emption will happen only after critical code is executed. But Solaris kernel is better in the sense that a buggy driver(looping for ever kind of code) should not cause kernel to come down in case we have shell running with real time priority

WHEN TO (AND NOT TO) USE RAID-Z

When performance matters most, mirroring should be highly favored.  If
mirroring  is considered too   costly but performance  is nevertheless
required, one could proceed like this:

    Given N devices each capable of X IOPS. (Input/Output Per Second)

    Given a target of delivered  Y FS blocks per second
    for the storage pool.

    Build your storage using dynamically  striped RAID-Z groups of
    (Y / X) devices.

Minimizing Memory Usage for Creating Application Subprocesses

Minimizing Memory Usage for Creating Application Subprocesses 講解為甚麼要用 posix_spawn() 取代  fork() + exec() 跑外部程式,牽涉兩個問題。

第一個是 VM out of memory,舉例來說,一個 6G 的 process 要跑 /bin/ls,fork() 時也要用到 6G VM,由於 Solaris 不像 Linux 會 memory over comit,swap 開的不夠大就會 out of memory。

第二個是效能問題, fork() 要 copy 一堆資料結構,這點 BSD 用 vfork() 解決,vfork() 不會 copy 那堆資料結構。然而在 multi-thread 時,vfork() 又會造成 parent 和 child 間 dead lock,詳情參照原文。

posix_spawn() 避免了 fork() 要另外佔用 VM 的問題,另外有個好處,就是傳統上發生在 fork() 和 exec() 間一些動作,posix_spawn() 可以做精細的設定,像是 change user and group ID, signal mask, scheduling class, file descripter, shell redirect, etc.

後面提到 Linux  memory over commit 的優缺點,主要的缺點是發生 out of memory 的時機不確定(因為你跟系統要多少,系統都跟你說有,根本無法檢查),等到 VM 真的用完 OOM killer  會隨機挑/試著選 一個 process 砍掉,這在企業系統上是不允許的。

Technorati Tags:

Multi-threaded Network Stack Lock Strategy, Solaris 10 & DragonFly BSD

多 CPU 的情況下, CPU 間同步的 overhead 很大,所以要讓相關的處理盡量留在同一棵 CPU 上,Solaris 採取的策略是一個稱為 squeue 的結構,一個 CPU 實體化一個 squeue, 從收到 network packet 開始,network driver -> IP Classfier > IP layer -> TCP Layer 都是對這個 squeue 做處理,從頭到尾只 lock 一次,並且把相關的 work thread 都 bind 在這棵 CPU 上. 參考 Solaris Networking – The Magic Revealed (Part I)

DragonFly BSD 最近也在 lock 方面做了類似的修改 [1][2],CPU locality 的部份沒提到