Chapter 13 - Concurrency Flashcards Preview

Advanced Topics in Programming Languages > Chapter 13 - Concurrency > Flashcards

Flashcards in Chapter 13 - Concurrency Deck (25):
1

what are the 4 different levels of concurrency

machine instruction level

statement level

unit level

program level

2

what is machine instruction level concurrency

executing two more machine instructions concurrently

3

what is statement level concurrency?

executing two or more high-level language statements simultaneously

4

what is unit level concurrency?

executing two or more subprogram units simultaneously

5

6 motivations for concurrency

-speed up execution

-increase program flexibility

-resource management in OS

-task management in OS

-solving large-scale problems

-simulates actual physical systems that consist of multiple concurrent subsystems

6

what is a scalable concurrent algorithm?

an algorithm with which the speed of execution increases when more processors are available

7

what is a thread of control?

a sequence of program points reached as control flows through the program

8

what is physical concurrency?

multiple independent processors (multiple threads of control)

9

what is logical concurrency?

the appearance of physical concurrency is presented by time-sharing one processor

10

what is hidden concurrency and what are 3 kinds of it?

-concurrency that is built into processor architectures


-pipelining of instruction (run instruction A, while preparing instruction B, while fetching instruction C)

-separate lines (buses) for instructions and data

-prefetching of instruction and data

11

3 differences between a task (aka a process) and a subprogram

Tasks are:

-implicitly started

-invoking unit need not wait for the task to finish to resume itself

-upon completion of the task, control may or may not return to the invoker

12

what is a lightweight vs a heavyweight task?

lightweight tasks all run in a single address space and heavyweight tasks each run in their own address space

13

what is a program "guard"

a linguistic device that allows the guarded code to be executed only when a specified condition is true

14

what is a task descriptor?

-a data structure that stores all of the relevant information about the execution state of a task

15

what is cooperation synchronization

when two processes must perform their work in some mandated order

16

what competition synchronization

when two processes need to access some resource but must not do it at the same time

17

what is the Ada "accept" statement (3 things)

-its represents the entry point for a task using "Rendevous" for synchronization

each accept statement has an associated process queue

-the "server" waits when the accept statement is reached until a process meets the "when" statement requirements and is in one of its process queues

18

rendezvous actor task vs server task

server task - a task with accept clauses

actor task - a task without accept clauses

19

what is the Rendevous "pragma" keyword?

-assigns priority to tasks in the specification

20

what is the Java "synchronized" keyword

when applied to methods within an object it disallows those methods from being run concurrently on different threads

when to applied to set of statements then those statements cannot be run concurrently by different threads

21

4 java thread class methods

start- call the run method implemented in whatever runnable object

yield- a hint to the scheduler that the current thread is willing to yield its current use of the processor if needed. Moves thread to ready state

sleep- moves the thread into the blocked state

join- forces a method to delay its execution until the run method of another thread has completed its execution

22

What is the equivalent of P and V for Java semaphores?

s = new Semaphore(0) --> constructor with initial value of zero
f = new Semaphore(MAX)

s.acquire() //same as P
[blah, blah, blah]
f.release() //same as V

23

2 ways to define a Java class with run() for threads

-create a class that extends the Thread class and override run (only if the class has no parents)

-create a that implements Runnable interface and define the functionality of run()

24

what is the Java "notifyAll" method?

-it tells all other threads that some event that a thread may have been waiting for has possibly occurred

25

what are atomic Integer, Boolean, and Long types?

-they are just like Integer, Boolean, and Long classes but their operations are non-interruptible