Jar Packaging
---------------
Jar CVF xxx.jar-c classes/.
Process
-----------------
Memory-isolated between processes. Memory is not shared.
Thread
-----------------
A code snippet that executes concurrently during the execution of a program.
Memory can be shared between threads.
Thread: Threading class.
Start ()//Notifies the CPU that the thread can start executing.
Run () //thread specifically executes the code snippet.
Thread t = new thread ();
T.start ();
Thread.CurrentThread ()//Gets the current execution thread.
Yield ()//Let the thread discard the CPU preemption.
Sleep (int mils)//lets the current thread hibernate for the specified number of milliseconds.
Thread safety: Added synchronous processing. Make sure that only one thread executes the synchronization code at the same time.
The synchronization method uses the current object as the synchronization object.
Static methods can be processed synchronously, using class as the synchronization object.
Methods in multi-threading
-----------------------
Yield ()//Let the thread discard the CPU preemption. Humility.
Join ()// main thread waits for the termination of the child thread
Sleep (int ms); /lets the current thread hibernate for the specified number of milliseconds.
Setdaemon (TRUE); //thread pre-boot settings
Isdaemon (); //Specifies whether the thread is daemon thread daemon
Start (); //Start thread
Run (); //thread-specific code snippet execution
Notify ()//Select a monitor object to wait for a thread in the queue to be notified.
Notifyall ()//Select all monitor objects to wait for a thread in the queue to be notified.
Wait ()//puts the current thread in the monitor's wait queue.
Wait (int n)//thread enters wait queue, waits up to n long time, once, automatically wakes up.
TIPS: Call the Sleep () method to catch the exception.
This article is from the "Yehomlab" blog, make sure to keep this source http://yehom.blog.51cto.com/5159116/1784242
"DAY8" Learning notes on multithreading