Solaris ????????????????
- by Homma
????
???????????? CPU ??????????????????????????????????
OS ??????????????????????????????????????????????CPU ??????????????????? CPU ???????????????????????????????????????????????????????????????????????????? CPU ??????????????????????????????????? CPU ???????????????????????? CPU ????????????????????????? CPU ?????????????????????????????????????????????????????????????????????????????DTrace ?????????????????
??
????????????????????????????????????????????? CPU ?????????????????
# cat prog01.c
int main() { while(1) {}; }
# gcc prog01.c -o prog01
?????????????????????pbind ?????????? CPU 1 ??????psradm ????????? CPU 1 ?????????????????????????? CPU 1 ??????????????
# ./prog01 &
[1] 3247
# pbind -b 1 3247
process id 3247: was not bound, now 1
# psradm -i 1
# psrinfo 1
1 no-intr since 09/24/2012 05:46:25
????????? Solaris 10 8/11 ?????????
# cat /etc/release
Oracle Solaris 10 8/11 s10x_u10wos_17b X86
Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved.
Assembled 23 August 2011
?????????????????????????
DTrace ??????????????(??????)???????????????????????????? preempt ???????????????????
DTrace ?????????????????????????????????????????????????????????????????????????????
# dtrace -qn 'BEGIN{ ts = timestamp; } sched:::preempt/pid == $target/ { printf("%d\n",timestamp - ts); ts = timestamp }' -p 3247
?????????????????????? 200 ?????????????????????
# dtrace -qn 'BEGIN{ ts = timestamp; } sched:::preempt/pid == $target/ { printf("%d\n",timestamp - ts); ts = timestamp }' -p 3247
3547836
199976558
200030610
199964001
200001048
199999666
200021432
???????????? 200 ????? CPU ????????????? CPU ?????????????????????
??????? CPU 1 ????????????? prog01 ?????????????????????????????????? prog01 ?????????????????????????????????????????????????????????? 200 ???????????????
?????????????????????????
?????????????????????????????? DTrace ????????DTrace ????????????????????????????????????????????????????????????????????
# dtrace -qn 'sched:::preempt/pid == $target/ { printf("%d\n", ((tsproc_t*)curthread->t_cldata)->ts_timeleft); }' -p 3247
??????????????????????????????? 1/100 ???????? 200 ?????????????????
# dtrace -qn 'sched:::preempt/pid == $target/ { printf("%d\n", ((tsproc_t*)curthread->t_cldata)->ts_timeleft); }' -p 3247
20
20
20
20
20
20
????????? 200 ????????????????????
???????? 200 ??????????????????????????????????????????????????????????????????????????????? DTrace ???????DTrace ???????????????
# dtrace -qn 'sched:::preempt/pid == $target/ { printf("%d\n", ((tsproc_t*)curthread->t_cldata)->ts_cpupri); }' -p 3247
????????????????????????????
# dtrace -qn 'sched:::preempt/pid == $target/ { printf("%d\n", ((tsproc_t*)curthread->t_cldata)->ts_cpupri); }' -p 3247
0
0
0
0
0
0
????????????????? 0 ???????? 0 ?????????????????????? dispadmin ????????????????
# dispadmin -c TS -g | head
# Time Sharing Dispatcher Configuration
RES=1000
# ts_quantum ts_tqexp ts_slpret ts_maxwait ts_lwait PRIORITY LEVEL
200 0 50 0 50 # 0
200 0 50 0 50 # 1
200 0 50 0 50 # 2
200 0 50 0 50 # 3
200 0 50 0 50 # 4
200 0 50 0 50 # 5
???????PRIORITY LEVEL 0 ???????? ts_quantum ? 200 ??????????? 0 ???? 200 ???????????????????????????(RES ??? 1000 ????ts_quantum ???? 1/1000 ?)?
?????????
????????????????????? mpstat ????????????????????????????icsw ??? 5 ???????????200 ?????????????????????????????????????????????????????? CPU ??? 200 ?????????????
# mpstat 1 | egrep '^ 1|csw'
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
1 0 0 347 196 1 42 1 3 0 0 2 9 1 0 90
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
1 0 0 0 16 0 0 5 0 0 0 0 100 0 0 0
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
1 0 0 0 7 0 0 5 0 0 0 0 100 0 0 0
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
1 0 0 0 8 0 0 5 0 0 0 0 100 0 0 0
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
1 0 0 0 18 1 0 5 0 0 0 0 100 0 0 0
????????????
Solaris ????????????????????????????????????????????? priocntl ???????????????? 1 ??????????
# priocntl -s -c FX -t 1000 -i pid `pgrep prog01`
??????? mpstat ?????????CPU ??????? 1 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????
# mpstat 1 | egrep '^ 1|csw'
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
1 0 0 346 196 1 42 1 3 0 0 2 9 1 0 90
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
1 0 0 0 2 0 0 1 0 0 0 0 100 0 0 0
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
1 0 0 0 2 0 0 1 0 0 0 0 100 0 0 0
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
1 0 0 0 13 0 0 2 0 0 0 0 100 0 0 0
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
1 0 0 0 2 0 0 1 0 0 0 0 100 0 0 0
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
1 0 0 0 5 1 0 1 0 0 0 0 100 0 0 0
????DTrace ?????????????????????????????
# dtrace -qn 'sched:::preempt/pid == $target/ { printf("%d\n", ((fxproc_t*)curthread->t_cldata)->fx_timeleft); }' -p `pgrep prog01`
100
100
100
100
100
100
???
Solaris ???????????????????????????????????????????????????????????????? 200 ????????????????????????????????????????????????
??????????????????????????????????????????????????????????????? CPU ?????????I/O ??????????????????????????????????????????????????????????
?????????????????????????? http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/disp/ ?????????
???????????????????