2dbi
Home/HPE/Implement a Thread-Safe Singleton / Bounded Cache
HHPE·DSASDE-2Onsite – Coding 1

Implement a Thread-Safe Singleton / Bounded Cache

Problem

Implement a thread-safe lazily-initialized singleton, then a thread-safe bounded LRU cache.

Example

Double-checked locking or static init; LRU with a lock

Constraints

  • Correct under concurrency

What HPE looks for

Correct synchronization and reasoning about memory visibility.

added 6 days ago
LeadersAccount