Week 12 - Concurrency Flashcards

1
Q

At how many levels can concurrency occur?

A

Concurrency can occur at four levels: machine instruction level, high-level language statement level, unit level, and program level.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the primary goal of developing concurrent software?

A

The primary goal is to produce scalable and portable concurrent algorithms to make use of increasing numbers of processors.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the categories of concurrency?

A

Physical concurrency (involving multiple independent processors), logical concurrency (achieved by time-sharing one processor), and coroutines (single-threaded concurrency).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What role does a scheduler play in concurrent systems?

A

The scheduler delays task execution and maps task execution onto available processors, ensuring fair allocation of resources and efficient task execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe the possible states of task execution.

A

The possible states include new (created but not started), ready (waiting for execution), running, blocked (waiting for an event), and dead (completed execution).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why is concurrency widely used in modern computing?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do tasks differ from ordinary subprograms in subprogram-level concurrency?

A

Tasks may be implicitly started, can execute concurrently with other program units, and may not return control to the caller immediately upon completion.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain the need for competition synchronization with an example.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is task synchronization, and why is it necessary?

A

Task synchronization is a mechanism controlling the order of task execution, essential for ensuring correct and coordinated access to shared data among concurrent tasks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Define liveness and deadlock in the context of concurrency.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the key design issues to consider in concurrent systems?

A

Design issues include competition and cooperation synchronization, task scheduling control, task lifecycle management, and task creation and termination.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Name three methods for providing synchronization in concurrent systems.

A

Semaphores, monitors, and message passing are three methods used for providing synchronization in concurrent systems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Describe the purpose of semaphores in concurrent systems.

A

Semaphores are used to manage access to shared resources and synchronize the execution of concurrent processes or threads.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Explain the typical operations performed using semaphores in concurrent systems.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the fundamental operations associated with semaphores?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How are producer and consumer tasks synchronized using semaphores?

A

Producers wait for available space before depositing data, while consumers wait for available data before fetching it. Semaphores are used to control access to shared buffers or resources.

14
Q

What is competition synchronization, and how is it achieved using semaphores?

A

Competition synchronization ensures that only one process or thread can access a shared resource at a time. This is typically achieved using binary semaphores, where access to the resource is controlled by acquiring and releasing the semaphore.

15
Q

What are the potential consequences of misusing semaphores?

A

Misuse of semaphores can lead to synchronization issues such as deadlock or livelock, where processes or threads become unable to make progress due to improper resource management or synchronization mechanisms.

16
Q

What asymmetry exists in task communication regarding message passing?

A

While a task sending a message needs to know the entry name in the receiving task, the receiving task’s entry name does not need to know the sender’s name.

17
Q

What happens when a task has multiple accept clauses with nonempty entry queues?

A

If more than one entry queue is nonempty, the system chooses one nondeterministically to accept a message.

18
Q

How can tasks have more than one entry point?

A

Tasks can define multiple entry points, each specified with its own entry clause.

19
Q

How does the system support cooperation synchronization with message passing using guarded accept clauses?

A

Guarded accept clauses allow specifying conditions under which a task can accept messages, enabling cooperation synchronization.

20
Q

What are protected objects, and how do they enhance concurrency?

A

Protected objects offer a more efficient way to implement shared data structures, providing mutually exclusive access to shared objects.

20
Q

How does the system model mutually exclusive access to shared data using message passing?

A

Shared data operations within tasks are encapsulated, and competition synchronization is implicitly ensured through the semantics of accept clauses.