COMPUTER SCIENCE CAFÉ
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY

COMPUTATIONAL THINKING | THINKING CONCURRENTLY

ON THIS PAGE
SECTION 1 | IDENTIFY THE PARTS OF A SOLUTION THAT COULD BE IMPLEMENTED CONCURRENTLY 
SECTION 2 | DESCRIBE HOW CONCURRENT PROCESSING CAN BE USED TO SOLVE A PROBLEM
SECTION 3 | EVALUATE THE DECISION TO USE CONCURRENT PROCESSING IN SOLVING A PROBLEM
ALSO IN THIS TOPIC
THINKING PROCEDURALLY
THINKING LOGICALLY
THINKING AHEAD
YOU ARE HERE | THINKING CONCURRENTLY​ 

THINKING ABSTRACTLY

 FLOWCHARTS
MORE COMING SOON

Picture
SECTION 1 | IDENTIFY THE PARTS OF A SOLUTION THAT COULD BE IMPLEMENTED CONCURRENTLY ​​
Concurrency refers to the ability of a system to handle multiple tasks at the same time. In the context of programming, it is related to the decomposition of a problem into parts that can be executed independently and potentially in parallel.

When discussing concurrency within a solution, you should identify which parts of a system can operate simultaneously without depending on the outputs or states of others. These parts can be executed in parallel (at the exact same time, e.g., in a multi-core processor) or pseudo-parallel via techniques like time-slicing in single-core processors.

Difference between Concurrency and Parallelism.
Benefits and Challenges of Concurrency:
  • Faster execution, better resource use, improved performance.
  • Complexity in design, potential for deadlocks, and race conditions.

When looking if your program requires the use of cuncurrency you should.
  • Identifying independent tasks: Tasks that do not depend on each other for data or resources.
  • Determining data dependencies: Understanding which processes require data from others to operate.

When applying concurrency to your program:
  • Use of threads, processes, and asynchronous executions.
  • Consider synchronisation: Ensuring data consistency and integrity during concurrent executions.

Example scenario:
Library management system:

Concurrent Part
  • User Management & Book Management: While one user is managing their account or borrowing books, another user can concurrently access and navigate through the available books.
  • Database Access: Multiple users should be able to access, read, and modify (if permitted) different parts of the database at the same time.

Non-concurrent Part
  • Payment Transaction: Often, payment gateways are not designed to handle concurrent transactions from the same user account to prevent fraud or data inconsistencies.
SECTION 2 | DESCRIBE HOW CONCURRENT PROCESSING CAN BE USED TO SOLVE A PROBLEM
Concurrency in computing refers to the ability of a system to handle multiple tasks at the same time. This doesn’t always imply that the tasks are being executed simultaneously. Instead, tasks can be distributed across available resources and managed in a way that allows them to make collective progress. Concurrent processing can boost efficiency, enhance performance, and sometimes simplify program structure. Executing multiple tasks or processes in overlapping time periods, either truly simultaneously (parallel processing) or seemingly simultaneously (as in multitasking). The methods below are popular methods used to achieve concurrency.

Threads: The smallest unit that can be scheduled in an operating system. Threads within a process share the same data space.
Parallelism: Truly simultaneous task execution, often achieved through multi-core processors.
Asynchrony: The state of not being synchronised, meaning tasks are executed independently and without waiting for other tasks to complete.

Imagine you program needs to perform a large calculation, with concurrent processing it can do this in the background while other tasks are still carried out or large data sets can be split and processed concurrently.
  • Parallel Data Processing: Utilise parallelism for large data set processing where data can be split and processed concurrently, reducing computation time.
  • Responsive User Interfaces: Manage UI interactions in one thread and process background tasks like data loading and computation in another, ensuring that the UI remains responsive.
This helps optimise the use of resources and enhance the user experience.

Some of the drawbacks and challenges of concurrent process are:
  • Synchronisation Issues: Manage shared resources and ensure that concurrent tasks don’t interfere with each other, avoiding data inconsistencies or corruption.
  • Deadlocks: Prevent scenarios where concurrent tasks wait for each other to release resources, leading to a system halt.
  • Task Coordination: Ensure that tasks are coordinated and managed efficiently to optimize resource utilization.

Concurrent processing is pivotal in optimising problem-solving strategies, especially in scenarios involving considerable computational load or the necessity of handling multiple tasks or requests simultaneously. Though it introduces complexity in task management and resource sharing, the resulting enhancement in performance and resource utilisation can be invaluable.
SECTION 3 | EVALUATE THE DECISION TO USE CONCURRENT PROCESSING IN SOLVING A PROBLEM
The evaluation to implement concurrent processing involves a meticulous analysis of the problem domain, anticipated benefits, associated challenges, and wider implications on the technical and non-technical aspects of project development. This holistic approach ensures that the solution derived is not only technically robust but also resource-efficient, scalable, and justifiable in the context of the associated development efforts and costs.

Key Considerations in Decision Making
  • Is the problem genuinely conducive to a concurrent solution?
  • Can tasks be broken down into smaller, independent sub-tasks?

Complexity vs. Gain
  • Does the performance gain or user experience enhancement justify the added complexity?
  • Will concurrency utilise system resources (CPU, memory) more efficiently?
  • Are the additional development time and potential increase in costs justified?
  • Will concurrency provide a scalable solution as the problem or user base grows?

Are the challenges of concurrency worth it
  • Concurrent programs often struggle with data dependencies. Evaluating how data is shared among tasks is crucial.
  • Frequent need for synchronisation, like locking shared resources to prevent concurrent modifications, can offset the gains of concurrent execution.
  • Concurrent programs are typically more challenging to test and debug. Thus, evaluating whether the team has the requisite skills and tools is pivotal.
Picture
Fill in the blanks
1: ____________ refers to the ability of a system to handle multiple tasks at the same time.

2: When discussing concurrency within a solution, the parts that can operate simultaneously without depending on the outputs or states of others can be executed in parallel or pseudo-parallel via ____________   ____________ ​in single-core processors.

3: In concurrent processing, ____________   ____________  within a process share the same data space and processed on the same core.

4: ____________ can boost efficiency, enhance performance by running sub tasks on separate cores, and sometimes simplify program structure.

5: When evaluating the decision to use concurrent processing, a meticulous analysis of the problem domain, anticipated benefits, associated challenges like ____________, synchronisation and wider implications on the technical and non-technical aspects must be considered.

Open-ended Questions
6: Explain the difference between concurrency and parallelism, providing examples for each.

7: Discuss the benefits and challenges of implementing concurrency in a software solution. Provide a scenario where implementing concurrency might introduce more challenges than solutions.

8: In the context of a library management system, illustrate how concurrent and non-concurrent parts can be identified and describe why certain tasks should not be executed concurrently.

9: When using concurrent processing to solve a problem, discuss how task synchronization issues can be resolved and provide an example where ignoring such issues might lead to data inconsistency.

10: How might a software engineer evaluate the decision to use concurrent processing, and what factors might they consider to decide if it is the most effective solution for a given problem?
Picture
NAVIGATION
COMING SOON
Picture
SUGGESTIONS
We would love to hear from you
SUBSCRIBE 
To enjoy more benefits
We hope you find this site useful. If you notice any errors or would like to contribute material then please contact us.