20165301 2017-2018-2 "Java Programming" Eighth Week Learning Summary
Textbook learning content summary
Chapter 12: Java Multithreading Mechanism
- process and thread
- Operating system and process: A process is a dynamic execution of a program.
- process and thread
- A thread is a smaller unit of execution than a process.
- A process can spawn multiple threads during its execution.
- Threads in Java
- main thread (main thread)
- Thread state and life cycle
- new
- run
- interrupt
- die
- Thread scheduling and priority
- Thread class and thread creation
- Use a subclass of Thread
- Use the Thread class
- The relationship between the target object and the thread
- The target object and the thread are completely decoupled
String name=Thread.currentThread().getName();
- Target object composition thread (weak coupling)
Thread.currentThread();
- The target object and the thread are completely decoupled
- About the number of times the run method starts
- Common methods of threading
- start()
- run()
- sleep (int millsecond)
isAlive
Thread thread = new Thread(target); thread.start();
- currentThread()
- interrupt()
- thread synchronization
- coordinating synchronized threads
- thread union
B.join();
- GUI thread
- timer thread
Daemon thread
thread.setDaemon(true);
code hosting
Screenshot of the code submission process:
Screenshot of code amount:
Screenshot of the running result of the statistics.sh script
learning progress bar
Lines of code (added/accumulated) | Blog volume (new/cumulative) | Study time (added/accumulated) | important growth | |
---|---|---|---|---|
Target | 5000 lines | 30 articles | 400 hours | |
the first week | 11/11 | 1/1 | 4/4 | |
the second week | 286/297 | 2/3 | 6/10 | |
The third week | 722/1004 | 1/4 | 10/20 | |
the fourth week | 421/1425 | 1/5 | 10/30 | |
fifth week | 829/2283 | 3/8 | 10/40 | |
Week 6 | 943/3326 | 2/10 | 10/50 | |
Week 7 | 497/3823 | 1/11 | 10/60 | |
eighth week | 703/4527 | 3/14 | 15/75 |