I have a thread that naturally has a blocking function. Let’s say it is a message receive just to have an example. It should normally sit at that blocking function except when a message arrives, at which point it executes some code and goes back to waiting on for another message.
What if this thread was being starved of cpu? It would block, then a message would arrive that puts it in the ready state, then time would pass, then it would finally process that message. By the time it blocks again, there might already be another message watiing. If this happened regularly, then it would indicate that it is being starved of cpu, right?
My question is…how would I detect that situation? It doesn’t appear there is anything in the Thread class to say “what percentage of time am I spending in the ready state” - I’m sure that would be hard to implement. Ideas? Thanks.