UNIX processes are designed to support a multi-user computing environment. In particular they provide address spaces, open file tables, etc. on a per/process basis. Support, through mechanisms such as pipes, is also provided for cooperating processes that support a single application.
It quickly becomes clear that cooperating processes are not an efficient way to support applications. For example, processes supporting single applications usually share common files. Moreover, communications between processes could be facilitated if processes shared memory.
Threads can be though of a processes that share common file tables and address spaces. A corrollary is that Threads are easier to set up than processes.
A difficulty with shared resources:
Consider the the following version of the update synchronization problem. A banks account update application has two threads.
In both cases the update consists of retreaving the present balance, adding the deposit or subtracting the withdrawn, finally writing the new balance back into the database. Now consider the following sequence of events.
Problem - Electronic's update is lost.