Java Multi Thread Basics

c82-java-prog-logo

1. Textbook questions (Summary – Divide – Summary)

Process (application, program) vs Thread (share memory)

Concurrency(progress at same time, some fast and others slow, single core) vs Parallelism (execute at same time, multi-core)

Runnable (interface) vs Threads (class)

 

2. Classic function interface: runnable, comparator

 

3. Class {

 Data field (property)

 Behavior (method)

}

 

4. Runnable is more flexible since it is a interface and can extend another class or implement other interfaces (Java has no multiple inheritance to avoid diamond problem)

 

5. Join: manage execution schedule (suspend parent thread)

 

6. notify() / notifyAll() -> ready

 

7. Synchronize – lock (class and instance level)

 

8. Reentry case (object lock for set and get methods, get / set can call set / get method)

 

9. System.out.println() and Debugger don’t help multi-thread problem debugging (it only prints relative order, print() is a thread, Debugger will hang all threads, need experience, small block)

 

10. Producer Consumer problem

BlockQueue

 

11. JVM

Heap: 1 (x 1), shared public resource, object

Stack: multiple (x N), thread – stack, method – stack frame, object reference

Method Area: constant pool

 

12. Garbage Collection (GC)

What, how, why?

Advantage vs Disadvantages

Memory Leak (example, algorithm)

 

 

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.
Resources:

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

Advertisements

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:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s