0

I was watching a presentation on high performance computing and starting at 24:55 one of the presenter states that synchronization by acquiring a lock requires a context switch down to the kernel of the OS (not even the one of the virtual machine, if the application runs in one). I would appreciate a brief explanation of why that is the case and why it cannot be handled inside the JVM (in case of Java apps).

wishihadabettername
  • 14,231
  • 21
  • 68
  • 85

1 Answers1

0

From a brief look at the video around 24:55 it appears they are discussing the "acquire mutex-enter critical section-release mutex".

Synchronisation relies on the fact that acquiring the mutex is an atomic operation. As pre-emption occurs in the kernel, it is necessary for the kernel to handle the mutex so as to guarantee its atomicity when multiple processes attempt to acquire/release the mutex.

See here for more information: Are mutexes really slower?

Community
  • 1
  • 1
ose
  • 4,065
  • 2
  • 24
  • 40