Week 12 - Concurrency Flashcards
At how many levels can concurrency occur?
Concurrency can occur at four levels: machine instruction level, high-level language statement level, unit level, and program level.
What is the primary goal of developing concurrent software?
The primary goal is to produce scalable and portable concurrent algorithms to make use of increasing numbers of processors.
What are the categories of concurrency?
Physical concurrency (involving multiple independent processors), logical concurrency (achieved by time-sharing one processor), and coroutines (single-threaded concurrency).
What role does a scheduler play in concurrent systems?
The scheduler delays task execution and maps task execution onto available processors, ensuring fair allocation of resources and efficient task execution.
Describe the possible states of task execution.
The possible states include new (created but not started), ready (waiting for execution), running, blocked (waiting for an event), and dead (completed execution).
Why is concurrency widely used in modern computing?
Concurrency allows for faster execution, even on single processors, and enables efficient utilization of multiprocessor systems. It also facilitates the design of software for real-world situations involving concurrency.
How do tasks differ from ordinary subprograms in subprogram-level concurrency?
Tasks may be implicitly started, can execute concurrently with other program units, and may not return control to the caller immediately upon completion.
Explain the need for competition synchronization with an example.
Competition synchronization ensures the correct outcome when multiple tasks compete for shared resources. For example, without proper synchronization, race conditions can lead to unpredictable results.
What is task synchronization, and why is it necessary?
Task synchronization is a mechanism controlling the order of task execution, essential for ensuring correct and coordinated access to shared data among concurrent tasks.
Define liveness and deadlock in the context of concurrency.
Liveness refers to the property of a program unit to eventually complete its execution. Deadlock occurs when all tasks lose liveness, resulting in a situation where no progress can be made.
What are the key design issues to consider in concurrent systems?
Design issues include competition and cooperation synchronization, task scheduling control, task lifecycle management, and task creation and termination.
Name three methods for providing synchronization in concurrent systems.
Semaphores, monitors, and message passing are three methods used for providing synchronization in concurrent systems.
Describe the purpose of semaphores in concurrent systems.
Semaphores are used to manage access to shared resources and synchronize the execution of concurrent processes or threads.
Explain the typical operations performed using semaphores in concurrent systems.
The DEPOSIT operation is used to indicate the availability of resources or space, while the FETCH operation is used to indicate the need for resources or data.
What are the fundamental operations associated with semaphores?
The wait operation is used to decrement the semaphore’s value and potentially block a process, while the release operation is used to increment the semaphore’s value and potentially wake up a blocked process.