I was given a student task on the topic of multithreading, it sounds like this: "Demonstrate problems when using the jcstress library.

I started to google, and realized that this is a library for testing concurrent algorithms that solve the loss problem when processing shared resources in multithreading. And they decide it by creating a temporary copy of the shared object for each stream, and then merging the result into the original. And if all this is so, then it turns out that this library is not needed by anyone except the creators of the concurrent collections ?

Or does it have other uses, I just do not understand?

Please help me figure it out.

    1 answer 1

    For example, you write code that processes the image in parallel in some way (for example, it translates into gray). This code can always work correctly, but one day there will be such an alternation that you will overwrite the same pixel twice and eventually it will turn into red. You can avoid this error by running a stress test many times, which is likely to reveal an error.