Context Switching

I know that this is a relative question but can someone give me an idea of what would be considered a high number of context switches?

I am running vmstat and show a cs value of between 5000 and 6000 on a 4 processor system. How can I deduce if this number is high or not?

Also, the timeslice kernel parameter set to 1 when I know the HP default is 10. What would be the benefits or detriments to changing this value?

You need to spend time looking at these numbers. Then you can compare one system to the others. And you can see how the number change over time. This is how you deduce whether or not a number is normal.

5000-6000 is high and I'm not sure that I have ever seen a higher value. We have a very powerful and busy 4 cpu server whose cs's are in the 800 to 1200 range...which is high but not unusual for this server during a busy day.

Looking at stats is especially important if you are perforance tuning. You really want to know cs'es before and after the timeslice was tweaked. I have never tweaked the timeslice, but I would expect the the involuntary context switches would go way up and scheduling latency to drop somewhat. Why was this change made? Unless you were having some real-time scheduling problems or something, we might want to consider putting it back.

Someone has reset the timeslice from 10 to 1. You should inquire why this has been done first of all, and maybe other settings has been changed as well that you need to be aware of.

If your througput is low - reset the timeslice to the default. If not - then it seems to be ok. You have approx 1000 cs / CPU which is high for an old system, but nothing to be concerned about for a new highperforming system, even with a timeslice of 10.

In general a timeslice of 1 millisecond is to short and the processes get timed out too soon, not that HPUX is a Unix kernel with pre-emptive multitasking and when higher priority processes/threads are available, processes and threads with lower priority will be pre-empted. Also when performing I/O the process/thread will be "put aside" until the I/O is completed and then it will rejoin. This is of course a very simplified description.