Which mechanism is used to prevent multiple threads from accessing shared resources simultaneously?

  • Encapsulation
  • Inheritance
  • Mutex
  • Polymorphism
The mutex (mutual exclusion) mechanism is employed to prevent multiple threads from simultaneously accessing shared resources, ensuring that only one thread can access the resource at a time, thus avoiding conflicts and data corruption.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *