Can some one give me simple examples between both
A thread is a stream of instructions within a process. Each thread has its own instruction pointer, set of registers and stack memory. The virtual address space is process specific, or common to all threads within a process. So, data on the heap can be readily accessed by all threads, for good or ill.
Multi-threading is a more “light weight” form of concurrency: there is less context per thread than per process. As a result thread lifetime, context switching and synchronisation costs are lower. The shared address space (noted above) means data sharing requires no extra work.
Multi-processing has the opposite benefits. Since processes are insulated from each other by the OS, an error in one process cannot bring down another process. Contrast this with multi-threading, in which an error in one thread can bring down all the threads in the process. Further, individual processes may run as different users and have different permissions.
*In multiprocessing processes are executed concurrently, and in multithreading threads of a single process are executed concurrently.
- Multiprocessing has more CPUs whereas multithreading creates a number of threads of the process allowing its simultaneous execution for increasing computing power.
- Multi threading creates multiple thread of a single process to increase computing power.
- Multiple threads of a single process are executed concurrently.
- Creation of a thread is economical in both sense time and resource.
- Multi threading is not classified.
- Multi processing adds CPUs to increase computing power.
- Multi processes are executed concurrently.
- creation of process is time consuming and resourse intensive.
- Multi processing can be symmetric or asymmetric.