Java Multi Thread Basics 2


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.

5. There is no absolute right answer for Relational DB or NoSQL, Object Oriented Programming or Functional Programming. The trend is to converge, like Java adds lambda and async features, JavaScript adds collection and class.

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

Multi-Thread, Java

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

Donate $5 to me for a coffee with PayPal and read more professional and interesting technical blog articles about web and mobile development. Feel free to visit my web app, WhizWallet, to apply for credit, store or gift cards, DealsPlus to browse daily deals and store coupons to save money.
Follow me @Yaoli0615 at Twitter to get latest tech updates.

Core Java Volume I–Fundamentals (10th Edition) (Core Series)

Core Java, Volume II–Advanced Features (10th Edition) (Core Series)

Test-Driven Java Development

Java Concurrency in Practice

Java: An Introduction to Problem Solving and Programming (7th Edition)

Java 9 for Programmers (Deitel Developer Series)

Java SE8 for the Really Impatient: A Short Course on the Basics (Java Series)

Core Java for the Impatient

Java: The Beginners Guide for every non-programmer which will attend you trough your learning process

Java Deep Learning Essentials

Machine Learning in Java

Learning Reactive Programming With Java 8

Java 9 Programming By Example

Thinking in Java (4th Edition)

The Java EE Architect’s Handbook, Second Edition: How to be a successful application architect for Java EE applications

Java Artificial Intelligence: Made Easy, w/ Java Programming


About liyao13

Yao Li is a web and iOS developer, blogger and he has a passion for technology and business. In his blogs, he shares code snippets, tutorials, resources and notes to help people develop their skills. Donate $5 to him for a coffee with PayPal at About Me page and read more professional and interesting technical blog articles. Follow him @Yaoli0615 at Twitter to get latest tech updates.
This entry was posted in CS Research&Application, Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s