Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

I have measuered the time interval between invocations of the clock handler and its more than the value of PERIOD defined in clock.h. Whats going on?

0
Posted

I have measuered the time interval between invocations of the clock handler and its more than the value of PERIOD defined in clock.h. Whats going on?

0

A clock interrupt is only raised when it’s “safe” to do so. When the clock timer goes off, indicating a clock interrupt should be raised, a check is made to make sure the currently running thread is executing safe code, which is not part of an NT-supplied library. Since we have no control over what a thread might do in a library, it’s risky to interrupt it. For instance, a thread could be interrupted in the middle of a printf(), when it’s holding an NT lock. The context-switch might start another thread which also calls printf(), cannot get the lock, and blocks, causing a deadlock.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123