1

Based on this it's clear that the framework is dynamic with it's thread timeslice based on # of processors, OS etc.

The length of the time slice depends on the operating system and the processor.

However, what's a way to get the actual thread timeslice on a given system?

We dynamically switch between Sleeping and Thread.SpinWait(x) for keeping certain timing sensitive code accurate in the sub-ms range; but need to keep that switch programmable based on the thread timeslice of the underlying system so we don't SpinWait(xxx) for too long.

So, how does one get the thread timeslice in C# (5ms, 10ms or 20ms etc)?

DeepSpace101
  • 13,110
  • 9
  • 77
  • 127
  • I don't think it is possible... I've looked around, and there doesn't seem to be an API or a WMI that tells you the timeslice (or quanta) length. – xanatos Jun 25 '15 at 06:53

1 Answers1

1

The default is around 15ms, but it can be changed. You may which to take a look at the following SO question: why-are-net-timers-limited-to-15-ms-resolution

Community
  • 1
  • 1
Dweeberly
  • 4,668
  • 2
  • 22
  • 41