ch.3 Flashcards

concurrency

1
Q

what is the difference between concurrency and parallel processing

A
  • concurrency: the ability to handle multiple activities simultaneously
  • parallel processing: the ability to handle multiple activities concurrently. aims to shorten the completion time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what all concurrent activities should have and why it’s important?

A
  • All concurrent activities should have coordination and it’s very important because without it it could lead to deadlocks
  • they should have communication because that leads to enhancing the overall efficiency of the concurrent activities
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

give an example of a coordination (synchronization) problem.

A

Dining Philosophers problem

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

explain dining philosophers’ problem

A
  • Five philosophers want to eat on a table
  • Only five chopsticks are available on the table
  • Each philosopher needs two chopsticks to be able to eat
  • Without synchronization could lead to deadlock
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is the solution to the dining philosophers’ problem?

A

the solution is Dijkstra’s solution which is:
* assign the resources by order
* each philosopher will request chopsticks with an order
* philosophers will request the lower-numbered chopstick first and cannot order two at the same time
This solution avoids starvation

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

what is the speed-up in concurrency in the cloud

A

through concurrent execution to overcome the physical limitations of one computer so the process is divided into multiple processes to speed up the process

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

what are the two sides of concurrency

A
  • algorithmic or logical concurrency
  • physical concurrency
    For example: a compiler can optimize a sequential program, but a processor core can execute many programs concurrently
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is barrier synchronization?

A

when concurrently running tasks cannot continue to the next stage until all tasks finished

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

What do you know about?
communication and computation

A
  • communication is much slower than computation
  • intensive communication can drastically slow the computation of concurrent threads of applications
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is the difference between coarse-grained and fine-grained parallelism?

A
  • coarse-grained: execute large blocks of code before communication
  • fine-grained: execute small blocks of code before communication
    Fine-grained is not suitable for the cloud because it will slow it
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is the difference between data parallelism and task parallelism?

A
  • Data parallelism: data is distributed across different concurrent activities.
  • Task parallelism: tasks are distributed across multiple processors.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what is the difference between data-flow and control-flow

A

data-flow: threads start execution as soon as their input becomes available

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

what is better data-flow or control-flow and why?

A

data-flow is better because the word is divided automatically. and the execution also starts automatically when inputs are available. So, it’s better because it can have the highest benefit from concurrency

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

What do you know about?
BSP bulk synchronous parallel model

A
  • it manages the concurrent activities
  • it makes parameter tuning on every physical constraint
  • free the programmer from focusing on details and focus on the big picture and uses parallel slackness: add small tasks for each process until all finishes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what are the model components of BSP?

A
  1. processing units and memory
  2. router: for messaging between components
  3. synchronization mechanisms acting every L units of time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the computation steps for the BSP model?

A
  1. at the beginning of a superstep each component is assigned a task
  2. at the end of the time allotted to the superstep, a global check determines if the superstep is completed, goes to the next superstep, and if not, allocates another $L$ units of time to the super-step to allow it to continue execution
17
Q

not a question study petri-net and timing in this chapter

A

18
Q

Define what a communication protocol is.

A

a set of messages exchanged to help coordinate actions

19
Q

what is the implementation of communication protocol?

A
  • error control mechanisms: using error detection and error correction
  • flow control: provides feedback from the receiver, forces the sender to send an amount of data that the receiver can handle
  • congestion control: ensure that the offered load of the network doesn’t exceed network capacity
20
Q

Define Logical clock

A

an abstraction necessary to ensure the clock condition in the absence of the global clock

21
Q

Write the rules to update the logical clock:

A
  • Rule 1: LC(e) = LC + 1 if e is a local event
  • Rule 2: LC(e) = max (LC, (TS(m)+1)) if e is a receive event
22
Q
A