I would like to code a little program which visually illustrates the behavior of the 'volatile' keyword. Ideally, it should be a program which performs concurrent access to a non volatile static field and which get incorrect behavior because of that.
Adding the volatile keyword in the same program should fix the problem.
That something I didn't manage to achieve. Even trying several times, enabling optimization, etc., I always get a correct behavior without the 'volatile' keyword.
Do you have any idea about this topic ? Do you know how to simulate such a problem in a simple demo app ? Does it depend on hardware ?