Extra Credit Challenge: Which process on which CPU?


We haven't started talking about multiprocessor systems yet nor the analysis work involved with MP system postmortem files. However, if we were to give you the exact pointers, you already have the knowledge needed to write a set of macros that will print the names of the processes running on each CPU of an MP system.

Since we are giving you exact pointers, this exercise is for Solaris 2.3 systems only. To do the same for other versions of Solaris 2, you'll first need to look at the header files to verify the offsets in the structures you'll be traversing.

Task:

Write a set of macros that print the names of the processes running on each CPU. For more of a challenge, try to have your macros state if the CPU was idle.

Givens:

  • The 3rd full 32-bit word of the cpu structure points to the executing thread's thread structure.

  • The 4th word of the cpu structure points to the idle thread. If the executing thread and the idle thread are the same, that CPU was idle.

  • The 41st (decimal) word of the thread structure points to the process or proc structure.

  • The 152nd (decimal) word of the proc structure points to where the process name is kept as a string. (Use the 154th word for Solaris 2.4 systems.)

Hints:

Use the cpu* macros as a guide. However, use the cpu_next value to change the current address instead of trying to calculate an offset into the next cpu structure. If you use the offset method, as done in the cpu macro, you risk driving yourself crazy, as the offset for your macro will be quite different from the one used at the bottom of the cpu macro.

In /usr/include/sys , you'll find cpuvar.h , thread.h , and proc.h of interest should you wish to learn more about the structures your macro will be wandering through.

An example of output to aim for:

 Hiya...  adb -k unix.6 vmcore.6  physmem bd90  $<proconcpu  ncpus:  ncpus:          Number of CPUS:  4  cpu0+8:         e1313ec0        Thread address  0xe1313f60:     e00ed880        Proc address  p0+0x260:       sched                  This CPU was idle                  Next CPU...  0xf5692408:     e134dec0        Thread address  0xe134df60:     e00ed880        Proc address  p0+0x260:       sched                  This CPU was idle                  Next CPU...  0xf5692008:     f5a31600        Thread address  0xf5a316a0:     f6be3800        Proc address  0xf6be3a60:     find /export/local -name core -exec rm {} ;                  Next CPU...  0xf5682c08:     f6a7fc00        Thread address  0xf6a7fca0:     f6685000        Proc address  0xf6685260:     /opt/SUNWpop2/sbin/popd  $q  Hiya... 

Note that in this example we did not specify a macro directory. Why not? Instead, we copied our macros to the savecore directory where the crashes are located. adb looks in the current directory for macros before going to the default adb macro directory.



PANIC. UNIX System Crash Dump Analysis Handbook
PANIC! UNIX System Crash Dump Analysis Handbook (Bk/CD-ROM)
ISBN: 0131493868
EAN: 2147483647
Year: 1994
Pages: 289
Authors: Chris Drake

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net