Save
OCR A-Level Computer Science
2.1 Elements of computational thinking
2.1.6 Thinking concurrently
Save
Share
Learn
Content
Leaderboard
Share
Learn
Cards (100)
Concurrent thinking handles multiple tasks at the same
time
In concurrency, tasks start, run, and complete in overlapping time
periods
Match the feature with its corresponding unit of execution in an operating system.
Memory Space ↔️ Process: Separate, Thread: Shared
Context Switching ↔️ Process: Higher overhead, Thread: Lower overhead
A web server can use multiple threads within a single process to handle concurrent client requests, improving
efficiency
Mutual exclusion uses locks or
semaphores
Concurrency optimizes resource utilization and reduces overall processing
time
Concurrency manages multiple tasks by interleaving their
execution
A process is a complete and independent unit of execution with its own memory
space
Threads share the same memory space and resources as their
parent process
.
True
Synchronization is the coordination of multiple threads to prevent race conditions and
deadlocks
.
True
Mutual exclusion protects shared resources from simultaneous access.
True
What type of communication occurs through message queues or mailboxes?
Message Passing
The Reader-Writer pattern allows multiple threads to read
concurrently
, but only one thread to write at a time.
True
Applying concurrency patterns and principles results in systems that are more robust, scalable, and easier to maintain.
True
Concurrent thinking is crucial for creating responsive and scalable computer systems.
True
What is the primary difference between concurrency and parallelism?
Parallelism executes tasks simultaneously
Processes have their own memory space and resources, whereas threads share the same
resources
Processes are complete and independent units of
execution
Concurrent thinking involves solving multiple problems or tasks
simultaneously
Concurrency allows systems to scale effectively by allocating additional resources to parallel tasks.
True
Parallelism involves the simultaneous execution of tasks on multiple cores or
processors
.
True
Threads within a process share the same
memory space
and resources.
True
What are the fundamental units of execution in an operating system?
Processes and Threads
Why do threads have lower overhead for context switching compared to processes?
They share memory space
What mechanism ensures only one thread can access a critical section at a time?
Mutual Exclusion
What are the two primary mechanisms for communication between concurrent components?
Shared Memory and Message Passing
Message passing achieves implicit synchronization through message
queues
What concurrency pattern models the challenge of avoiding deadlocks with limited resources?
Dining Philosophers
Immutable data structures are inherently thread-safe because they cannot be modified after
creation
.
True
The Producer-Consumer pattern helps manage the flow of data between concurrent components using a shared
buffer
Steps to avoid shared mutable state in concurrent programming
1️⃣ Minimize shared mutable state
2️⃣ Use immutable data
3️⃣ Pass copies of data
What strategy can prevent deadlocks in concurrent systems?
Acquire locks in order
Concurrent thinking requires dividing
problems
into parallel sub-tasks.
True
Match the concurrent and sequential approaches with their characteristics:
Concurrent ↔️ Handles multiple tasks through parallel execution
Sequential ↔️ Processes one task at a time in a step-by-step manner
Concurrency allows systems to respond promptly to inputs without blocking other
processes
.
True
Concurrency involves managing multiple tasks by interleaving their
execution
Which type of concurrency benefits from a single-core processor?
Improved responsiveness
Processes have their own separate memory space, while threads share the same memory space.
True
Threads have lower overhead for context
switching
Match the feature with its concept:
Synchronization ↔️ Maintain data consistency
Mutual Exclusion ↔️ Protect shared resources
See all 100 cards