Stop The World

I was watching an excellent technical session about Java GC. When the speaker said “Pause is inevitable no matter which collector you use”, a thought suddenly came to my mind that this is also true for living a life.

We all has so many things to think about these days in the modern world that time is the most precious resource.  College students are struggling in allocate self-study time for each subjects in hope of graduating with excellent record. Junior staff are willing to put up with routine tasks with expectation to get some chances to work on more important things in the future.  Senior staff care carefully prioritise projects to maximise benefit in career path.  Even CEO still need to think hard in balancing work with family life.

We all try to make good plan. But life is not that easy to plan. It is unpredictable and sometimes unfair. There will be times in life that the system you have laid out just can’t proceed no matter how many backup plans you have. And that is fine.

Garbage collector is on of the most complex area in Java system. It comprise of complex algorithms and data structures for handling automatic memory management. It is extremely smart in precisely detect unused objects and rearrange them while maintaining overhead as low as possible. Despite its robustness, there will be situation that it could not proceed with its planed calculation. May be object allocation rates is to overwhelming or object life-span pattern doesn’t suit the running GC algorithm. At thins point, GC will turn to good old mechanism as the last resource; stop-the-world full memory collection. Every other threads will be halt. Let alone the GC thread to do its work. No incoming object request, no collision with users thread , don’t need to think too much on many constraint, just clean up things, arrange things nicely and resume.

Isn’t our life the same?  Your plan will sometimes fail no matter how smart you are. Those life hack techniques doesn’t work anymore (or at lease at this particular bad time). You keep prioritising , arranging things or even try to change your behaviour to suit the overwhelming requests in life. But the room in your brain and your heart keep shrinking smaller and smaller. You are at risk of going system shutdown.

Why don’t you try stop your world. Let the external real world spin without you for a while. Lets not care about about those noise that were interfering with your inner mechanism. It is alright if you will be perceived by others as underperform. It is not a time to please external expectation. It is a time for yourself to figure out survival strategy.  Stop the world until you feel alright then resume with your plan.

Note: GC also do short period stop-the-world in some minor steps. I just want to focus with the full GC one to make the metaphor.