1. API
    1. java.io
    2. Java.network
    3. java.lang
      1. ThreadGroup
      2. Runnable
        1. implement run()
        2. thread pooling
        3. task schedule
        4. timing
      3. Thread
        1. name
        2. target
        3. group
        4. stack size
        5. Life Cycle
          1. start()
          2. run()
          3. This is only method to terminated thread expect system.exit()
          4. flag
          5. interrupt Thread
          6. call interrupt()
          7. isAlive()
          8. interrupt()
          9. non-blocking
          10. while(!isInterrupt()){}
          11. done if out of range
          12. done after go out of range if in the range
          13. blocking
          14. InterruptedExceptioin
          15. isInterrupted()
        6. blocking method
          1. sleep()
          2. wait()
          3. join()
          4. java io
        7. currentThread()
  2. Nonblocking-IO
    1. I/O Multiplexing
    2. Polling
    3. Signal
  3. Threads
    1. type
      1. Main Thread
        1. main()
      2. Garbage Collection
      3. Java bytecode complier
      4. System Events
      5. User customize
  4. Issue
    1. 平行化演算法
    2. Can't Interrupt immediately
    3. Race condition
      1. data sharing
        1. synchronized (mutex lock)
          1. handle instance token
          2. all method hang on ?
          3. control method call order because objec is lock by mehod scope
      2. thread local memory
        1. volatile
          1. atomic type (except:long, double)
          2. setter/getter (atomic operation)
      3. thread execute order
  5. classification
    1. atomic
      1. 不會有中途狀態的程式碼(bytecode level)
  6. Synchronized
    1. synchoronized modifier/method
      1. Instance Lock
        1. synchronized method
      2. Class Lock
        1. static synchronized method
      3. Block Lock
        1. synchronized(this){} in code block 某程度上說會比Lock api簡易, 免try{}finally{},new lock instance
      4. wait(), notify(), notifyAll() on purpose for usability
        1. 當Thread執行Wait會Pending且釋放鎖 其它Thread可呼叫Instance Method 當Thread被notify/notifyall會acitve且取回鎖 wait / notifyall / notifyall 要放至於synchoronized method 中避免 race condition
    2. ReentrantLock
      1. ReentrantLock() (經由變數命名會較容易表示用途)
        1. getQueueLength();
        2. isLocketd();
      2. Condition cv = lock.newCondition();
        1. cv.await(), cv.signal()
    3. Nested Lock
      1. Lock包含Lock JVM識為同一個Lock
  7. Atomic (能讓多個operation 當atomic看待)
    1. AtomicInteger
    2. AtomicLong
    3. AtomicBoolean
    4. AtomicReference
  8. Questions