Multithreading allows a program to run multiple threads concurrently, which can improve responsiveness and efficiency by doing several tasks at once. However, it does not guarantee fixed order execution, requires synchronization, and each thread has its own stack.
When multiple threads access shared resources, conflicts like race conditions can occur. Proper synchronization is needed to manage access and avoid errors.
If threads spend a lot of time waiting due to synchronization, the overhead can reduce or negate performance gains from multithreading.
Multiprocessing runs separate processes each with its own memory space, while multithreading runs multiple threads within the same process sharing memory.
Deadlock occurs when two or more threads wait indefinitely for resources held by each other, causing the program to freeze.