Concurrency
Concurrency is the execution of the multiple instruction sequences at the same time. It happens in the operating system when there are several process threads running in
parallel. The running process threads always communicate with each other through shared memory or message passing.
Process
A process is a program in execution. Process is not the same as program. A process is an active entity as opposed to program which is considered to be a passive entity.
When a program is loaded into the memory and it becomes a process, it can be divided into four sections stack, heap, text and data.
Process Layout.
We know that when a program is loaded into the memory to be executed, it will become a process. This created process can then be divided into 4 different sections, each with
their distinct roles.
Process Scheduling
The process scheduling is the activity of the process manager that handles the removal of the running process from
the CPU and the selection of another process on the basis of a particular strategy.
This allow more than one process to be loaded into the executable memory at a time and the loaded process shares the CPU using time multiplexing.
Inter-Process Communication
Interprocess communication is the mechanism provided by the operating system that allows processes to communicate with each other.
This communication could involve a process letting another process know that some event has occurred or the transferring of data from one process to another.
Thread
A thread is a path of execution within a process. A process can contain multiple threads. The idea is to achieve parallelism by dividing a process into multiple threads.
For example, in a browser, multiple tabs can be different threads.
MS Word uses multiple threads: one thread to format the text, another thread to process inputs, etc.
Thread
A thread is an independent set of values for the processor registers. It controls the execution orders of a process. It also includes the stack pointer, which had better point
to a unique area of memory for each thread or else they will interfere with each other.
Single Threaded Process
Single threaded processes contain the execution of instructions in a single sequence. Which means each command is processed one at a time.
Multithreaded Process
Multithreaded processes allow the execution of multiple parts of a program at the same time. These are lightweight processes available within the process.
Difference between Process and Thread