Threading Concepts
When I ask someone what is a thread, someone tells me a lot of threads how to create, how to use and a number of threads of advanced issues, in fact, as a veteran rookie, I would like to ask, what is the thread, find some concepts in the book summed up, multi-threading and operating system multi-tasking (process) The environment has many similarities. Multitasking in the operating system allocates different time periods for the CPU to different processes, because each process is executed in a very short time (as opposed to the concept of a person's time), the process switches between processes quickly and executes multiple processes in a very short period of time, thus giving the senses a sense of concurrent execution of multiple processes ( Multi-core CPUs may implement concurrent execution), the thread is the concept of a program, a program executes a task that is a process, a program can perform multiple tasks concurrently, the program is a multithreaded program. Multi-threaded routines extend the multi-tasking concept at a lower level.
What is the difference between a process and a thread? The essential difference between the two is that the process has its own set of independent variables, while threads are shared data, and thread-sharing variables make communication between threads more efficient and easier.
Java Threading Learning