All Multithreading Terms
  • Green threads scheduled by User-Level Process
  • Native threads scheduled by the Kernel
  • Lightweight process (LWP): Threads that execute kernel code and system calls
  • Bound threads: Threads that are permanently bound to LWP
  • Unbound threads: Solaris thread that context switches quickly without Kernel support
Intrinsic Locking, Extrinsic Locking (Client side Locking) lock jcp
Avoid Client side Locking: Calling class, will be affected, if any change in locking of class it used
All synchronized methods of a class use same Lock, which reduces throughput
Always avoid synchronized(this) and replace it with a lock on a private reference
Using Object as a Mutex (Java Monitor Pattern)
Useful to implement more than one Mutexes in your code latch
thread Green and Native threads in Java thread
Java CountDownLatch/CyclicBarrier example latch cb thread
Java Semaphore/Lock/Condition example spr thread
Exchanger example ex
Exchanger a kind of rendezvous point where two threads can exchange objects
Java threads using JNI thread thread
ThreadLocal and memory leaks tl thread
Fiber's Co-Operative Multitasking/Thread's Pre-Emptive Multitasking
Co-Routines/AddressSpace/Thread-local/Thread Models
Compare and Swap (CAS) Algorithm
Optimistic and Pessimistic Locking
Synchronization is coordinated access to mutable state of an object
AtomicLong performance implications cas
thread Reentrant locking mechanism thread Java synchronized keyword on .class thread
Race condition/Unlucky timing owing to compound actions
Compound Actions: (RPC)
  • Read-Modify-Write
  • Put-If-Absent
  • Check-Then-Act
ConcurrentHashMap uses Lock Stripping lsjb lsjb chm chms
  • Constructor (initialCapacity, loadFactor, concurrencyLevel) : (ILC)
  • To store elements: transient volatile Node[] table;
  • static class Node implements Map.Entry
  • To handle concurrency: static class Segment extends ReentrantLock
  • To avoid hash collision: private final void treeifyBin(Node[] tab, int index)
HashMap performance improvements in JDK 8
  • JEP 180: Handle Frequent HashMap Collisions with Balanced Trees
  • To store elements: transient volatile Node[] table;
  • static class Node implements Map.Entry
  • To avoid hash collision: final void treeify(Node[] tab)
thread Using JDK 9 Memory Order Modes : Doug Lea thread Collection of Best Java Practices lang Collection of JDK 9 features lang JDK8 docs collection lang
Reflection and MethodHandler comparision lang
Diamond Operator in JDK 7/8 do lang Keyword 'final' collection lang JDK 8 Nashorn lang JDK 5 varargs (String... args) lang
JDK 8 static and default methods in Interface lang
Java Memory Model(JMM) and threads specification revision JSR-133 jmm lang How static is different from volatile in Java example lang How hashCode works lang Oracle Coding Standard for Java lang Purpose of jpi lang System.arraycopy is efficient owing to JIT optimization lang
Read-Eval-Print-Loop (REPL) for Java lang
Java String/PermGen/Metaspace lang
Java Reference Objects: Soft, Weak, Phantom
Example of Guava MapMaker and WeakHashMap
lang jlink explained in 5 minutes lang
System.arraycopy is native and uses 'memcpy/memmove'
Native source code of arraycopy
lang Reactive Programming with JDK 9 Flow API (Reactive Streams) lang
Java 8 Lambda JSR-335 collection collection
An expression with parameter variables has been called a Lambda
JVM instruction set for Lambdas
Translation of Lambda Expressions (Brian Goetz) using DeSugaring
Comparision of Lambdas/Reflection/MethodHandle
Functional programming in Java lambda JDK 8 all functional interfaces
It provides target types for lambda expressions and method references
lambda JDK 8 double colon (::) operator lambda JDK 7 underscore in numeric literals(int num = 999_333) lambda Difference between a closure and lambda lambda Usage of Predicate in JDK 8 Streaming pdct lambda
JDK 8 Streaming stream Purpose of Eager and Lazy operations in JDK 8 Streaming egr stream
ConcurrentSkipListSet/ConcurrentSkipListMap in Java sl sls
These Java classes are based on Skip List
Blocking Queue (Default methods: Put and Take) in Java bq
  • ArrayBlockingQueue
  • DelayQueue
  • LinkedBlockingQueue
  • PriorityBlockingQueue
  • SynchronousQueue
Class CopyOnWriteArrayList (COWAL) cowal
Copy underlying Array with every Mutation Operation(add/set)
utils Why is ArrayDeque better than LinkedList utils Java collection hierarchy collection utils Lower(super) and Upper(extends) bound Generics: (PECS: Producer Extends, Consumer Super) library Example of Java ANTLR: generate interpreter for any language library Java API for JSON Binding : JSR 367 library DZone scalability/microservices articles dzone DZone functional programming articles dzone