A process, like each of the console applications we have created, has resources allocated to it, such as memory and threads. A thread executes your code, statement by statement.
Windows uses pre-emptive multitasking, which simulates the parallel execution of tasks. It divides the processor time among the threads, allocating a "time slice" to each thread, one after another. The current thread is suspended when its time slice finishes. The processor allows another thread to run for a time slice.
When Windows switches from one thread to another, it saves the context of the thread and reloads the previously saved context of the next thread in the thread queue.
Most modern operating systems work the same as Windows, and are known as pre-emptive multitasking OSes.
By default, each process only has one thread, and this can cause problems when we need to do more than one thing at the same time.