Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One source of multithreading bugs comes from failing to lock data that is used from multiple threads. Stress testing your app is a one technique to reveal some of these issues. The more threads that are contending with higher frequency for data the greater the chance of spotting a problem.</p> <p>Spotting that your data has been corrupted by unprotected access can be tricky. Your app might limp on for some while before showing symptoms of being sick. Assertions can help with this. They give you an improved chance of spotting corruption very soon after it occurred.</p> <p>The other main type of multithreading bug is the deadlock. One technique you can use to see if your app is flirting with deadlocks is to use lock level checking. Lock level checking does not wait to spot a deadlock. It alerts you at runtime that there is the possibility of a deadlock.</p> <p>Lock level checking works like this: Suppose you have 3 locks - A, B and C. You give them levels 1, 2 and 3 respectively. If a thread always claims a lower level lock before a higher level lock then you'll never get into a situation where one thread can claim A then B whilst the other claims B then A. To implement lock level checking, give each of your lock objects a level. Use thread local storage so that a thread knows what lock level it last claimed. In fact have a stack object in thread local storage, so that when a lock is released you know the level of the previous lock. Some apps claim locks that they already own. That is safe. To allow for that in the thread lock checker you'll need to scan the stack of locks to see if it has already been claimed.</p> <p>All this lock level checking does impose a performance penalty. So it is likely to be appropriate just for a debug or special build.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload