The main difference between processes and threads is that they are different ways to manage operating system resources .
The process has a separate address space , and after a process crashes, it does not affect other processes in protected mode . threads are just a different execution path in a process.
threads have their own stacks and local variables, but there is no separate address space between the threads . the death of a thread is tantamount to the entire process dying,
so a multi-process program is more robust than a multithreaded program, However, in the process of switching, the cost of large resources, the efficiency is worse.
but for some concurrent operations that require simultaneous and some variables to be shared, only threads can be used, and processes cannot be used.
A program has at least one process, and a process has at least one thread.
The thread's dividing scale is smaller than the process, which makes the multi-thread procedure high concurrency.
In addition, the process has a separate memory unit during execution, and multiple threads share memory, which greatly improves the efficiency of the program operation.
Threads are still different from the process during execution. Each separate thread has a program run entry, sequence of sequence execution, and exit of the program.
However, threads cannot be executed independently, and must be dependent on the application, which provides multiple threads of execution control.
From a logical point of view, the meaning of multithreading is that in an application, multiple execution parts can be executed concurrently.
However, the operating system does not consider multiple threads as separate applications to implement scheduling and management of processes and resource allocation. This is the important difference between processes and threads.
A process is a program with a certain independent function about a single run activity on a data set, a process that is an independent unit of the system's resource allocation and scheduling.
A thread is an entity of a process that is the basic unit of CPU dispatch and dispatch, which is a smaller unit that can run independently than a process. The thread itself basically does not own the system resources, only has a point in the operation of the necessary resources (such as program counters, a set of registers and stacks), However, it can share all of the resources owned by the process with other threads that belong to one process.
One thread can create and revoke another thread, and can execute concurrently between multiple threads in the same process.
The difference between iOS development----operating system----processes and threads