Process is a running program.
Independent & Cooperating Processes.
Processes can be either independent or cooperating.
Processes are independent if they are not affecting each other.
Processes are cooperating if they can affect each other by sharing data - either temporary or persistent.
How data can be shared?
Data can be shared in many ways.
- via Shared Memory,
- via Queue,
- by sending a Inter-Process Communication Message (IPC Message).
- via a file written on a pendrive.
It's important to synchronize timing of read/write operations done by processes - so the data is not read before being written, for example.
For example: perhaps we do not want to check amount of money in our bank account before it arrives on that account then make automated decision based on that amount.
Concurrent Programming is that part of Computer Sciences that explains how to synchronize Processes.
Why split tasks among multiple processes?
- to share data among multiple users or to use the same data for different tasks.
- to speed up the computation, for example to allow for effective use of multiprocessor or multicore machines.
- code quality, modularity. single responsibility per process so they can be reused and combined together.
- practical reasons, for example: so we can type data at the same time as music is played and partial computations are done.
See also: , , Petri Nets, Distributed Shared Memory.