April 2018
Intermediate to advanced
300 pages
7h 41m
English
In concurrent programming, many objects may access the same resource at the same time, and keeping them thread-safe is the primary objective. In .NET Core, we can use locks to provide synchronized access. However, there are cases where a thread has to wait for a longer time to get access to resources, and this makes applications unresponsive.
The best practice is to apply for synchronized access only for those specific lines of code where the actual resource needs to be thread-safe, for example, where the locks can be used, which are the database operations, file handling, bank account access, and many other critical sections in the application. These need synchronized access so that they can be handled one thread at a time.