20040721 Wednesday July 21, 2004

Solaris quiz


OK,
Here's a quick quiz and it's something that stumped me for a while. On the same system (SunOS 5.10, SPARC, Ultra10 - not that it matters) I run the same script under two different shells. When I use vmstat to monitor the system I seem to get totally different results. Under a ksh I get this
 kthr      memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr dd f0 s1 --   in   sy   cs us sy id
 0 0 15 480384 121968 6  22  1  0  0  0  0  0  0  0  0  419  292  233  4  3 94
 0 0 29 322856 35840  0   0  0  0  0  0  0  0  0  0  0  407  573  302 76  1 23
 0 0 29 322856 35840  0   0  0  0  0  0  0  0  0  0  0  401  564  291 99  1  0
 0 0 29 322856 35840  0   0  0  0  0  0  0  0  0  0  0  402  582  286 99  1  0
 0 0 29 322856 35840  0   0  0  0  0  0  0  2  0  0  0  417  583  293 98  2  0

but under bourne shell (sh) I get this - hint look at the sys Vs usr column
 kthr      memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr dd f0 s1 --   in   sy   cs us sy id
 0 0 15 480384 121968 6  22  1  0  0  0  0  0  0  0  0  419  292  233  4  3 94
 0 0 29 322576 35536 251 2636 0 0  0  0  0  0  0  0  0 1072 6707 1052 19 69 12
 3 0 29 322704 35576 187 2007 13 0 0  0  0  1  0  0  0  938 5470  849 17 74  9
 0 0 29 322888 35736 238 2531 0 0  0  0  0  4  0  0  0 1067 6520 1044 17 72 11
 0 0 29 322880 35728 244 2606 0 0  0  0  0  0  0  0  0 1072 6673 1038 17 72 11
The vmstat was collected using vmstat 5. The script is very simple
garyli@arches[/home/garyli] $while true
> do
> :
> done
Why is that? What is happening here? The first correct answer will get a Sun Blueprints CD. ( Jul 21 2004, 10:12:47 AM BST ) Permalink Comments [3]
Comments:

[Trackback] Gary Little has posted a a question on his blog with a prize of a blueprints cd. It's not a difficult one and should not take a lot of thinking to work it out. Good luck.

Posted by Alan Hargreaves' Weblog on July 21, 2004 at 10:23 AM BST #

true is built in to the Korn shell (ksh) whereas sh calls /usr/bin/true

Posted by davey on July 21, 2004 at 10:26 AM BST #

true is built in to the Korn shell (ksh) whereas sh calls /usr/bin/true

Posted by davey on July 21, 2004 at 10:27 AM BST #

Post a Comment:

Comments are closed for this entry.