2.1.5 - Thinking Concurrently Flashcards
Component 2 (8 cards)
1
Q
What is concurrent processing?
A
- Carrying out more than one process at a time (overlapping)
- Where one process does not have to finish before the other starts
- Each process is given a slice of processor time
- Different processes can be executed by different cores
2
Q
What is parallel processing?
A
- Executing more than one instruction simultaneously
- Can be achieved through multiple processors or distributed across multiple cores in a single CPU or GPU.
3
Q
What are the benefits of concurrent processing?
A
- More efficient use of the processor
- Longer running tasks do not delay short running tasks
- User is able to interact with the computer while other tasks are running
4
Q
What are the trade-offs of concurrent processing?
A
- Locking will be needed meaning more complex programming (prevents two processes from updating the same thing)
- Not all the processes will be able to be done in parallel (parallelizable).
- Cannot be done when the current stage depends on the previous stage.
- X processors don’t mean it will run in 1/xth of the time of one processor.
5
Q
How might tree traversal use concurrent processing?
A
- Apply different searches simultaneously: perform breadth-first and depth-first searches simultaneously.
- Searching a tree: rather than going down 1 path, go down 2+
6
Q
How might a linear search use concurrent processing?
A
Can have multiple processors searching different areas at the same time.
7
Q
How might a binary search use concurrent processing?
A
It cannot - it is not parallelizable
- The next move depends on the outcome of checking the mid-point.
- This algorithm does not benefit from using multiple processors.
8
Q
How might a cinema booking system use concurrent processing?
A
- Multiple bookings happening at the same time.
- Record locking used to stop double bookings - could require more complex programming.