Feel the Java Foundation is too bad, look again, the way the mind map to record
Multithreading Beginner
Process Independence have independent resources a separate address no authorization other processes cannot access of Dynamic the difference from the program is that the process is a dynamic set of instructions, and the program is a static set of instructions . Add time Concept have their own life cycle and different states of concurrency multiple processes can be executed concurrently on a single core processor multiple processes do not affect and parallelism: parallelism is the same time multiple processes execute concurrently on multiple processors concurrency means that at the same time only one instruction can be executed, but the switch is rapid, the macroscopic view is to execute multiple instructions Threads line threads relative for processes as process relative to operating system Multiple threads sharing resources for the same process Lightweight Processes high performance, easy to create application: One browser downloads multiple pictures at the same time, one server handles multiple requests at the same time Java Multithreading Create Inherit thread implement Runnable Interface (recommended) Life cycle New New One thread Ready execute the Start method Run start executing the Run method Blocking Enter blocking call the Sleep method to actively discard processor resources want to get a sync detector, but the sync detector is occupied by other resources call a blocking Io method, and the thread blocks before the method returns waiting for a notify notification call suspend pending Lifting Blocking call sleep exceeds specified time Call Blocking IO method has returned succeeded in getting the Sync checker you were trying to get when waiting for a notification, other threads are alerted The resume method is called by a suspended thread Death Run method End The program throws an exception that is not caught calling the Stop method