Concurrent Processing
Computer Science: OCR A Level, topic 6.5.1
Thinking Concurrently
Thinking concurrently involves solving different parts of a problem at the same time to improve efficiency.

Determining concurrent parts of a problem
- When solving a problem, sometimes it can be split into smaller tasks that can be done at the same time.
- This is called concurrency.
- For example, imagine you are building a computer program to process customer orders.
- One part of the program can handle the payment while another part checks the stock.
- These two tasks do not need to wait for each other.
- Both tasks can happen at the same time.

Benefits of concurrent processing
- One benefit of concurrent processing is speed.
- If multiple tasks are done at the same time, the job can be finished faster.
- This is especially useful when tasks are independent of each other.
- For example, when loading a web page, the browser can download images and text at the same time.
- This makes the web page appear faster.

Trade-offs of concurrent processing
- However, there are trade-offs when using concurrency.
- If the tasks depend on each other, it can be tricky to manage them.
- For example, if two parts of a program try to change the same file at the same time, there could be problems.
- This is called a race condition.
- Solving these problems can make the program more complicated.

Choosing when to use concurrency
- To decide if concurrency is a good idea, you must think about the problem.
- If the tasks can be done at the same time without interfering with each other, concurrency will probably improve performance.
- However, if the tasks depend on each other, concurrency might cause more problems than it solves.
Test yourself on Concurrent Processing
What is one primary benefit of using concurrent processing?
Name two tasks in a computer program that could be processed concurrently when handling customer orders.