.. role:: blue :class: blue Thread-Safety of Kernel Objects =============================== .. _Thread-safety_of_kernel_objects_: .. версия ядра: Thread-safety of the kernel objects is implemented with the special mechanism – multithreaded caching which provides a thread-safe access to an object data and enables effective parallel calculations in case if the object is processed in several threads simultaneously. Each thread works with its own copy of cached data that prevents data contention between threads. The cache manager controls the multithreaded caches and is responsible for creating, storing and providing cached data for the current thread. It is important to note that multithreaded caching works effectively for both parallel and sequential calculations. The definite plus is that migration to using multithreaded caches requires minimal code refactoring. Although side effects of using multithreaded caches should be taken into account: - Some increase in memory usage. - Some small time overhead for retrieving cached data. If there is no parallelism, it may make some value. Multithreaded caching could be switched on or off by changing the kernel multithreading mode.