You think you can multitask, but you can’t. The human brain can really only concentrate on one thing at a time. You might be surprised to know that computers aren’t great multitaskers either. Or sure, it might look like they’re doing a bunch of stuff all at the same time, but they’re really just slicing up their time really fine; doing one task for a few milliseconds and then switching to another (dual processor/core computers are another story…).
When you’re programming, and your application needs to do two things at the same time, you can instruct it to start running multiple tasks at the same time. You’ve probably heard the terms thrown around: thread and process. But what is the difference between process and thread.
A process is the execution of a program. You start it up and it runs until it reaches the end and halts. During its execution, a process can start up threads. These will execute a specific sub-task and then and be killed once its task is complete. Threads can be paused or put to sleep.
You get into problems with threads when multiple programs are attempting to interact with one set of data. Threads will lock up access to an object, preventing any other threads from proceeding. This leads to situation called deadlocking, where no thread can move any further, and the program freezes.
So, the short answer is that a process is the execution of a program, and each process can contain and control multiple threads.