Stop-The-World

The so-called Stop the World mechanism, referred to as STW, that is, in the implementation of garbage collection algorithms, in addition to all the other garbage collection collector threads of threaded Java applications are pending.

In this case, the system only allows the GC threads running, all other threads will pause, waiting to run again after the GC thread is finished.

These efforts are initiated automatically by the virtual machine in the background and automatically, without the user thread is not visible to the user to stop all work, which for many applications, especially those for high real-time requirements the program is unacceptable.


In addition to garbage collection, there are some other action will trigger STW.


Concurrent (CMS) collector: (- XX: + UseConcMarkSweepGC) : for recycling old generation.

Serial and parallel collecting garbage collected during the work necessary to suspend the entire operating environment, therefore, the system will have a significant pause when garbage collection and heap pause time because of the greater and longer.

Concurrent collector can guarantee that most of the work concurrent execution, the application is not suspended, the garbage collector is suitable for minimizing the dwell time of the application, reducing the chance of full gc occurs , use and application thread concurrent garbage collection thread to mark clear old generation, suitable priority than the response time of the system (more commonly used for larger systems).

CMS is not without pause, but with a short pause twice to replace long pause serial tags to organize algorithm.

Guess you like

Origin blog.51cto.com/11009785/2401604