--

I left that out because in many scenarios it is not important at all. The most important to me was to explain the algorithm, not the concurrency.

But, if you are interested, if used concurrently, the access to the victim cache does not require any kind of lock, but the active does need it. However, you can choose one of the hundreds of possible implementations for that. That's nothing new.

And about the swap of caches, there are atomic instructions in virtually all the CPUs able to do that swap, so, no mutex needed also.

So, as you can see, it is not so complicated to have this cache with a high level of concurrency. :-)

--

--

David Rodenas PhD
David Rodenas PhD

Written by David Rodenas PhD

Passionate software engineer & storyteller. Sharing knowledge to advance our skills. Join me on a journey of discovery in the world of software engineering.

Responses (1)