餱ȥƥȤͫݵ

⤷ƤȤɽεϿøȽ񤯡

2009ǯ07

NPTLɸ2.6kernelLinuxThreadsȤ

Linux kernelˤϡFreeBSDKSE䡢NetBSDSolarisLWPΤ褦ʡץ٤ƥȥåñ̤ʤޤǥץƥȥåκǾñ̤ǡåɤfork()ΥѡåȤǤclone()ȤLinuxȼΥƥॳǺ줿ץȤư롣

פϥ꥽ƥץȶͭޤ(ҥץѤΥ֤򥳥ԡ)줿ץʤΤºݤΥƥȥåκݤˤϡ꥽ڤؤȯʤΤǡ̾ΥץƥȤڤؤξǤ®ϤŪLWPȻ褦ʰդˤʤäƤ롣

kernelΥץƥȤФơɤΤ褦˥åɤƤ뤫glibc(libc,libthread)äƤơkernel2.4ϤκLinuxThreadsȤǹԤäƤåɤˤϤ줾̤pid(ץid)ʧФ졢줾Υץ(å)̤Υޥ͡㥹å(ץ)롣ȥåɴ֤(ºݤˤϥץ֤)ʥʤɤ꤬Ф뤳Ȥ(䤳ʤץȥåɤ)ޤpid̤˾񤹤뷹ꡢ̤Υåɤץ̤˵ưꤹpidȤ̤Ƥޤǽ⤢롣ǡkernel¦ä˽ɬפʤơkernelϥץȤƸƤΤ򥳥ƥȥåоݤˤФ褤ΤưϥץFreeBSDǤrfork()clone()˻ȤäLinuxThreadsߴμäʤ󤫤ơkseule塼餬ꤹˤϤ褯Ȥ줿ꤷ

2.6ϤkernelǤLinuxThreadsѤäNPTL(Native POSIX Thread Library)Ƥ롣kernelglibcξѹääƤơLinuxThreads⥹åɤ䤿®餷åɤˤѤ餺clone()ȤȤ䡢kernel鸫ݤΥƥȥåñ̤ϥץǤ뤳ȤʤɤѤʤܤ礭ѲȤơĤΥץˤϰĤpidҤԤ(åpidѤʤ)åidʿ򰷤뤳Ȥʤɤΰ㤤롣ޤPOSIX Thread(ɸŪʥåɼ)ؤνٹ礤⤤դ˸LinuxThreadsPOSIX Threadߴʬ¿ȸ롣

ԹˤLinuxThreadsPOSIXߴʬ˰¸ץबä硢2.4ϤǤäΤ2.6ϤͽʤưˤʤȤᤷ̤ˤʤ礬롣ʤȤΤˡ2.6kernelǤLinuxThreads¹ԤФ褤(LinuxThreadsˤkernelüʻųݤɬפʤΤǡglibcѰդʤ)

饤֥ڤؤϰ츫ƥѥ뤬ɬפʤ褦˴뤬libpthreadlibcưŪ󥯤ƤСldLinuxThradsǤɸNPTLǤ򤷤ƥ󥯤ƤȤߤʤΤǡѥѤߥХʥǤⵯưڤؤ뤳ȤǤ롣

ŪˤϴĶѿ LD_ASSUME_KERNEL kernelСɤĶѿƤʤХǥեȤNPTLglibc󥯤졢2.4.19ʤɤȤLinuxThreadsǤglibc󥯤롣

λȤ߼Τϡshared libraryɬפȤkernelСФơߤμkernelС񤭤뤿ΤΤĶѿ LD_ASSUME_KERNEL оݤkernelСȡld¹ԻˤkernelС˱shared library󥯤Ȥˡ(ΥС礭СɬפȤshared library󥯤ʤ)NPTLglibckernelС2.4.20˰¸Ƥ뤿ᡢLD_ASSUME_KERNELˤ̤οäƤȡΥСǥ󥯲ǽglibc(LinuxThreads)󥯤뤿ᤳʵưˤʤ롣

ʤߤưCentOS4ϤdzǧCentOS5ϤκǾ󥹥ȡȡLinuxThreadsߴglibcϥ󥹥ȡ뤵ʤ褦

åɼγǧΤ˰ʲΥޥɤѰդƤ롣

% getconf GNU_LIBPTHREAD_VERSION

ʲºݤưưǧΥץǷν꤫ޤ

% getconf GNU_LIBPTHREAD_VERSION
NPTL 2.3.4
% ldd ./mt
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00504000)
        libc.so.6 => /lib/tls/libc.so.6 (0x00353000)
        /lib/ld-linux.so.2 (0x00339000)
% ./mt
[2758]start
[2758]thread_id1=-1208775776
[2758]thread_id2=-1219265632
[2758][-1208775776]0
[2758][-1219265632]0
[2758][-1208775776]1
[2758][-1219265632]1
[2758][-1208775776]2
[2758][-1219265632]2
[2758][-1208775776]3
[2758][-1219265632]3
[2758][-1208775776]4
[2758][-1219265632]4
[2758][-1208775776]5
[2758][-1219265632]5
[2758][-1208775776]6
[2758][-1219265632]6
[2758][-1208775776]7
[2758][-1219265632]7
[2758][-1208775776]8
[2758][-1219265632]8
[2758][-1208775776]9
[2758][-1219265632]9
[2758]thread_id1 = -1208775776 end
[2758]thread_id2 = -1219265632 end
[2758]end
zsh: exit 10    ./mt
%

줬̾NPTLư̡줾̡ΥåidʧФƤ뤬pidϤɤ2758Ƕ̡

LinuxThreadsȡ

% export LD_ASSUME_KERNEL=2.4.19
% getconf GNU_LIBPTHREAD_VERSION
linuxthreads-0.10
LinuxThreadsˤʤä
% ldd ./mt
        libpthread.so.0 => /lib/i686/libpthread.so.0 (0x0069d000)
        libc.so.6 => /lib/i686/libc.so.6 (0x00ae9000)
        /lib/ld-linux.so.2 (0x00339000)
/lib/tls/ʲshared library/lib/i686/ʲΤΤ֤äƥ󥯤
% ./mt
[2854]start
[2854]thread_id1=16386
[2854]thread_id2=32771
[2856][16386]0
[2857][32771]0
[2856][16386]1
[2857][32771]1
[2856][16386]2
[2857][32771]2
[2856][16386]3
[2857][32771]3
[2856][16386]4
[2857][32771]4
[2856][16386]5
[2857][32771]5
[2856][16386]6
[2857][32771]6
[2856][16386]7
[2857][32771]7
[2856][16386]8
[2857][32771]8
[2856][16386]9
[2857][32771]9
[2854]thread_id1 = 16386 end
[2854]thread_id2 = 32771 end
[2854]end
zsh: exit 10    ./mt
%
åid̤ʤС줾Υåɤpid̡åidκ֥롼餫˰㤦

Ȥ櫓ǡ2.6kernelǤLinuxThreadsȤȤϤǤ2.6kernelǤϥ塼ʤɤ㤦Τǡ٤ưΤΤ2.4ϤȰˤʤ櫓ǤϤʤLinuxThreads˰¸Хʥ¹ԤˤϽʬǽΥ٥ޡϼäƤʤɤ⡢LinuxThreadsNPTL®ͳʤΤǡǽͳLinuxThreaadsȤȤʤȻפ

ܤpthreads(7)

VMWareۥޥΥͥåȥ󥿡եˡ

VMwareۥޥǤϺΤȤ3NIC(Network Interface Card)Υߥ졼ȤǤ롣

vlance
¯˸AMD PCnet32 10Mbps ٤
e1000
¯˸Intel PRO1000 1000Mbps ®
vmxnet
VMwareȼNIC 1000Mbps ®

vlancee1000ϡOS˳ϡɥѤΥɥ饤ФѰդƤФΥɥ饤ФѤ뤳Ȥ롣

ºݤΥϡɥȴʸߴݤɬפ뤿ᡢۥOS(ESXʤvmkernel)ǤCPU٤礭ͥåȥ٤ȼäơCPU꥽ɤɤ󿩤뷹ˤ롣

ѤΤvmxnetǡϥOSѤΥǥХɥ饤ФɬפϡɥȴߴݤɬפʤNICȤƤɬ׽ʬʵǽƤΡ۲Фơಾ۲(para-virtualization)ʤɤȸ

vmxnet¾ˤVGAɥ饤Фޥɥ饤Ф˽ಾ۲ɥ饤ФѰդƤơϳƥOSѤvmware-tools˴ޤޤƤ롣

VGAޥɥ饤Фϡಾ۲ɥ饤Ф򥤥󥹥ȡ뤷ʤ¤ꡢOSϴŪʵǽʤ۲ǥХȤưಾ۲ɥ饤Ф򥤥󥹥ȡ뤷ǡಾ۲ǥХȤѤǤ褦ˤʤ롣

NICξǥեȤǤflexibleȸäơ̾vlanceȤưಾ۲ɥ饤Ф򥤥󥹥ȡ뤹vmxnetνಾ۲ǥХȤư褦ˤʤ롣

LinuxǤvmware-tools˴ޤޤvmxnet.ko(ಾ۲ɥ饤)insmodƤ⡢flexibleǥХvmxnetȤǧvlanceȤƤưʤäꡢǥХǧ礬ѤäƤޤʤɤ꤬Ф뤳Ȥ롣

ξˤϡNICŪ˻ꤹ뤳ȤǤ뤬VMware InfrastructureVMware ServerǤGUIѰդƤʤ(vSphereWorkstation̤ǧ)

ޤˤϳۥޥβۥޥե(ĥҤ.vmxΥե)򹹿ΤESXVirtual CenterΥ٥ȥɲäƤ֤ǤϡľܥեԽ뤳ȤǤʤ(եԽƤξ֤Ǿ񤭤Ƥޤ)

ΤᡢESXVirtual CenterʤСü٥ȥ꤫ƺȤԤɬפ롣VMWare ServerʤץʤꥵӥʤߤƤȤɤ

ESXVirtual CenterΥ٥ȥ꤫ˡġ

  • ۥޥ򱦥åơ֥٥ȥ꤫פ򤹤ˡ
  • ۥޥƥץ졼ȤѴˡ

٥ȥ꤫ϸäƥǥʤȡۥޥƥץ졼ȤѴȡۥޥե(ĥ.vmx)ϲۥޥƥץ졼ե(ĥ.vmtx)˥͡वΤա

ۥޥ(ƥץ졼)եɵƤϰʲΤȤꡣ

ethernet0.virtualDev = "vmxnet"
ethernet0.virtualDev = "vlance"
ethernet0.virtualDev = "e1000"

Τ줫ꤹɤ2ĤʹߤNICethernet1,ethernet2ĤȤ롣

եԽˡϡESXVMFSǡȥʤСservice consolesshʤꥳ󥽡ʤǥ󤹤ȡ/vmfs/volumes/[ǡȥ̾]/ǥǡȥ˥Ǥ뤿᤽Խɤ(service consoleΤʤESXiμʤ)VMware ServerWorkstationʤۥOSľܥǥdzƤޤΤɤ

ESXVirtual CenterǡԽäΥ٥ȥؤκɲˡϡΥǡȥ򻲾ȤǤESXΥǡȥ򱦥åơ֥ǡȥ򻲾ȡסvmxեõƱå֥٥ȥɲáפ롣ä饹꥽סɲäǤ롣ƥץ졼Ȥ᤹ˤϡֲۥޥ󤪤ӥƥץ졼ȡפΥ٥ȥ꤫顢Υƥץ졼Ȥ򱦥åֲۥޥѴפɤƱͤ˸ä饹꥽סɲä롣ƥץ졼Ȥ٥ȥ˸Ĥʤϡ嵭vmxƱͤ˥ǡȥ饤٥ȥɲäɤ

ɤNICѤ٤ϡǽδϴְ㤤ʤvmxnetLinuxʤɤOSξ硢vmxnetvmware-toolsˤäLKM(vmxnet.ko)Ȥ󶡤롣Τᡢ¾ΥɥѡƥLKMƱͤˡkernelupdate٤˥ɥ饤Ф򤽤kernel version˹äǥ쥯ȥβ˺֤֤ȯ롣

vmware-toolsǤvmware-config-tools.plȤץȤΤؤνޤȤƤäƤ뤬󤻤kernelupdateľ(NICΥɥ饤ФäƤʤƥͥåȤȤʤΤ)󥽡ǥ󤷤ƤΥץȤ¹ԤȤΤݤʾ̤롣ФʤɤȤˤʤ⤷ˤkernelupdateͽꤷƤΤǤe1000ɥ饤ФѤΤɤǥ⤷ʤ(ǽäȻƸǤϸۤCPU꥽򿩤櫓ǤʤäŪʿϼǰ)

ʤ64bitۥޥǤNICe1000ˤʤ롣ǽʤΤϤޤ32bitۥޥξ

SPARCALOM(sc)Υѥɤ˺줿Ȥнˡ

  1. ȤꤢSolarisΩ夲
  2. ΥޥɤǺ
# /usr/platform/`uname -i`/sbin/scadm userpassword admin

adminʳΥ桼̾ΤȤˤadminΤȤ򤽤Υ桼̾

scsiХΥꥹˡ

٥󶡤ѤΥޥɤѰդƤȤˤϤäȤäμ

ŪLinuxΰŪscsiǥХξ
# echo "scsi add-single-device 0 0 1 0" > /proc/scsi/scsi
rescanȤtargetǧΤˤ롣οϤ줾졢host bus target(id) lun

Solarisξ
# drvconfig

SPARCokץץȤξ
ok probe-scsiޤ
ok probe-scsi-all

VMware ESXservice consoleξ
# esxcfg-rescan [vmhbaΥǥХ̾]

ñۤȺƳ

饤󥿡ͥåȤΥ󥿥륵ФǼǹۤMovableTypelivedoor Blog˰ñۤޤ

ñۤƤƵŤɡ2ǯε

ñۤʤƤ褫ä⡣