Java multithreading and concurrent programming

Java multithreading and concurrent programming

multi-Progress

The program is no longer performed sequentially, alternately up and down two while loop operation

 

Multithreading can only open a program, but the program is run several functions can be performed alternately

Multiple processes can open several programs

Start method will automatically call the run method to the new process, the underlying use JNI to achieve

Start will be triggered automatically run method, which is a Thread own mechanism, it is equivalent to recognize start and run the two words

 

The class must implement Runnable can start to rely Thread

Multi-threaded operating rules

If you want to start, and then only new objects out of a thread

If the program inherits the Thread, the other can not inherit the class (single inheritance), if in the future the program to achieve what functions need to inherit another class, more trouble

Thread must use static variables to achieve shared variables, Runnable ordinary variables shared variables can be achieved

Multithreading information sharing

MPI parallel library is a C / C ++ library Parallel

 

 

Multithreading management

Published 400 original articles · won praise 174 · views 170 000 +

Guess you like

Origin blog.csdn.net/hxxjxw/article/details/104936424