1. Parallelism≠Concurrency, concurrency can occur on a single processor, parallelism require more than one processor.
2. Properites of concurrent system: safety (nothing bad will ever happen) and liveness (something good eventually happens).
3. Java calls a process a "thread"
4. Thread states: (created)->runnable, non-runnable, running->(dead).
5. Java thread primitives: start(), run(), sleep(), stop(), interrupt(), isAlive(), join(), yield(), wait(), setPriority()[1-10]...
6. join() method suspends the execution of the calling thread until the object called finishees its excution, 通常用在main中,等待其他线程完成后再继续main()的程序。
7. thread.sleep()可以休眠线程,例如thread.sleep(1000)可以休眠线程1秒,但是可以被thread.interrupt()打断。
8. thread.setPriority() 可以设置线程优先级,主线程优先级为5,然而并非优先级高就可以先执行,仍旧取决于CPU资源分配。
9. thread.yield()可以让线程暂停,从running状态变为runnable状态,能让通优先级的thread有执行机会,但具体哪个线程执行取决于CPU。