2.1.5 - Thinking Concurrently Flashcards
Component 2
What is concurrent processing?
- 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 in parallel
What are the benefits of concurrent processing?
- 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
What are the trade-offs of concurrent processing?
- 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.
How might tree traversal use concurrent processing?
Apply different searches simultaneously: perform breadth-first and depth-first searches simultaneously.
Searching a tree: rather than going down 1 path, go down 2+
How might a linear search use concurrent processing?
Can have multiple processors searching different areas at the same time.
How might a binary search use concurrent processing?
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.
How might a cinema booking system use concurrent processing?
Multiple orders happening at the same time.
Record locking used to stop double bookings