1. Singleton Design Pattern
check null after get lock to avoid instantiate multiple times (other thread passed first null check and are waiting for the lock)
2. Producer and Consumer problem is not like Read and Write, it doesn’t allow multiple consumers consume at same time like reader read, because reading doesn’t change resources, but consuming does (decrease resource number) .
3. Constant pool and thread pool are designed to improve performance (it takes time to create and destroy thread) and security (easy to manage and schedule threads).
4. newCachedThreadPool() is better for short and async tasks like DB access, newFixedThreadPool(int nThread) is better for long and stable tasks like file I/O.
6. Override (same name, same signature, different implementation) vs Overload (same name, different signature, different implementation)
7. Interview is not exam, transfer from inactive side (don’t know) to active one (what I have done, what I learned. Confident, happy, enjoy, bold).
8. Executor Thread Pool vs Fork Join Framework (Pool) — Divide & Conquer, Recursion, CPU intensive
Work stealing algorithm: definite processes handle indefinite tasks.
fork(): arrange to execute this task asynchronously in the pool.
join(): return the result of the computation when it’s done.
9. Optimization: Java Program -> Java Compiler -> JVM -> OS -> Hardware
Do one (your own) thing, do it well. Trust others.
10. Big Data problems:
Big data skills: Scala, Map/Reduce, Hadoop
11. Small / Mid-size company – Family environment, PHD leader, talk and learn everything
Big / Giant company, streamline, nobody
12. System design: load balancer (consistent hashing), CAP
13. Intellij IDEA, jconsole, jstat, jmap