Finals Flashcards

1
Q

splits the task into smaller subtasks and these tasks are executed concurrently.

A

Fork

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

After the execution of the subtasks, the task may join all the results into one result.

A

Join

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

is a programming model that allows tasks to be split into subtasks (forking) and later combined (joining) after execution.

A

FORK JOIN PARALLELISM

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

useful in scenarios where a problem can be broken down into subproblems that can be solved independedtly

A

fork-join Parallelism

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

style of parralel programming that solves problems by “Divide and Conquer”

A

fork-join Parallelism

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

Three (3) key components to achieve parallel processing

A

*Fork-Join Pool
*ForkJoinTasks
*Worker Threads

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

Two main types of task

A

Recursive Task
Recursive Action

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

An abstract class that defines a task that runs within ForkJoinPool

A

ForkJoinTasks

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

There are the workhorses that execute that tasks. They continuously check the queue for available tasks. Once they receive a task, they follow the instructions effectively completing their assigned part of the overall job.

A

Worker Threads

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

The fork/join framework uses a cool trick called work-stealing.

A

Work-sharing

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

Real-life examples of Fork-Join Parallelism

A

Weather Forecasting
Big Data Processing

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

is a path that is followed during a program’s execution.

A

Thread

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

The majority of programs written nowadays run as a

A

single thread

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

example of a multithreaded program

A

word processor

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

is the smallest unit of processing that can be performed in an OS (operating system)

A

thread

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

simply a subset process

A

thread

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

A thread contains all the information in a

A

Thread Control Block (TCB)

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

Is a unique identifier assigned by the operating system to the thread when it is being created

A

Thread ID

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

These are the states of the thread which changes as the thread progresses through the system

A

Thread states

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

It includes everything that the OS needs to know about, such as how far the thread has progressed and what data is being used

A

CPU Information

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

It indicates the weight (or priority) of the thread over other threads which helps the thread scheduler to determine which thread should be selected next from the ready queue

A

Thread Priority

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

points to the process which triggered the creation of a thread

A

Pointer

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

This block stores information about a process, including its process ID (PID), state, counter, registers, memory limits, and list of open files.

A

Process Control Block

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

This block stores information about a thread, including its parent process pointer, thread ID (TID), state, program counter, register set, and stack pointer.

A

Thread Control Block (TCB)

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

This section represents the memory space allocated to a process, which is divided into different segments.

A

Process Memory

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

Contains the executable code of the process

A

Text

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

(Process Memory)
Stores the data used by the process

A

Data

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

Used for storing local variables, function arguments, and return addresses during function calls.

A

Stack

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

is the ability of a program or an operating system to enable more than one user at a time without requiring multiple copies of the program running on the computer.

A

Multithreading

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

needed for multithreading

A

Fast central processing unit

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

The processor can execute only one instruction at a time, but it switches between different threads so fast that it gives the illusion of simultaneous execution.

A

Processor Handling

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

Each thread is like a separate task within a program. They share resources and work together smoothly, ensuring programs run efficiently.

A

Thread Synchronization

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

Threads in a program can run independently or wait for their turn to process, making programs faster and more responsive.

A

Efficient Execution

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

Programmers need to be careful about managing threads to avoid problems like conflicts or situations where threads get stuck waiting for each other.

A

Programming Considerations

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

Multithreading vs. Multiprocessing

A

Multithreading – refers to the ability of a processor to execute multiple threads concurrently, where each thread runs a process.

Multiprocessing – refers to the ability of a system to run multiple processors concurrently, where each processor can run one or more threads.

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

is a CPU feature that allows programmers to split processes into smaller subtasks called threads that can be executed concurrently. These threads may be run asynchronously, concurrently, or parallelly across one or more processors to improve the performance of the application. The ability to run tasks concurrently also makes multithreaded applications and APIs more responsive to the end user.

A

Multithreading

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

delineates a set of tasks that can be executed simultaneously, beginning at the same starting point, the fork, and continuing until all concurrent tasks are finished having reached the joining point. Only when all the concurrent tasks defined by the fork-join have been completed will the succeeding computation proceed.

A

Fork–join parallelism

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

provides a high performance, parallel, fine-grained task execution framework for Java programs

A

ForkJoinPool

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

distinguishes itself from other types of ExecutorService primarily through its use of work-stealing: every thread in the pool seeks to locate and perform tasks that have been submitted to the pool or generated by other currently active tasks (ultimately blocking and waiting for work if none is available).

A

ForkJoin Pool

40
Q

is a feature of Java 8 and higher, meant for utilizing multiple cores of the processor.

A

Java Parallel Streams

41
Q

Using the ________, we can divide chunks of code into streams that execute in parallel on multiple cores. The final result is the grouping of the different results (outcomes)

A

parralel stream

42
Q

is a flow of objects that supports various functions and is intended to produce a reliable output.

A

parallel stream (flow)

43
Q

is simply a wrapper around a data source, allowing us to perform bulk operations on the data in a convenient way.

A

Stream in Java

44
Q

make use of the fork-join framework and its common pool of worker threads.

A

Parallel streams

45
Q

was added to java.util.concurrent in Java 7 to
handle task management between multiple threads.

A

the fork-join framework

46
Q

is an executor service implementation

A

Fork-join pool

47
Q

is the basis for Java Executor framework class

A

Executor Service

48
Q

is a construct that allows you to pass a task to be executed by a thread asychronously.

A

The java executor service

49
Q

creates and maintains a reusable pool of threads for executing submitted tasks.

A

The java executor service

50
Q

also manages a queue, which is used when there are more tasks than the number of threads in the pool and there is a need to queue up tasks until there is a free thread available to execute the task

A

The java executor service

51
Q

a program is broken down to a large number of small tasks.

A

Fine-grained parralelism

52
Q

is lighter weight than a java thread

A

ForkJoinTask

53
Q

To maximize core utilization, idle worker threads _ work from the tail of busy threads.

A

steal

54
Q

Tasks are stolen in _ order since an older stolen task may provide a larger unit of work.

A

FIFO (First in First Out)

55
Q

implements work-stealing minimizes locking contention

A

Workqueue

56
Q

is used for asynchronous programming

A

CompletableFuture

57
Q

means writing non-blocking code

A

Asynchronous programming

58
Q

✓It runs a task on a separate thread from the main application thread and notifies the main thread about its progress, completion, or failure.
✓ the main thread does not block or wait for the completion of the task.
✓ Other tasks are executed in parallel.
✓ Parallelism improves the performance of the program.

A

CompletableFuture

59
Q
  • can speed up the processing of large tasks, but to achieve this outcome, we should follow some guidelines:
  • Use as few thread pools as possible. In most cases, the best decision is to use one thread pool per application or system.
  • Use the default common thread pool if no specific tuning is needed.
  • Use a reasonable threshold for splitting ForkJoinTask into subtasks.
  • Avoid any blocking in ForkJoinTasks.
A

fork/join framework

60
Q

used for computations that
do not return results

A

RecursiveAction

61
Q

used for computations that
do return results

A

RecursiveTask

62
Q

used for computations in which completed actions trigger other actions

A

CountedCompleter

63
Q

enables a non-ForkJoinTask client to process ForkJoinTasks

A

ForkJoinPool

64
Q

is to maximize processor core utilization

A

work-stealing

65
Q

The Fork-Join Framework Internal

A
  • Each worker thread in a forkjoinpool runs a loop that scans from (sub-tasks to
    execute
  • The goal for the work thread is to keep as busy as possible.
  • The worker threads only block waiting for work if no (sub-) tasks are available to
  • run therefore, the working thread checks multi-input sources for (sub-) tasks to
    execute.
66
Q

Under the hood each worker thread in the fork-join pool manages its separate work queue which is called a _ which is short for a double-ended queue and called a work queue this is the main source of input for the working thread to process.

A

deck

67
Q

The _ deque that implements workstealing minimizes locking contention

A

WorkQueue

68
Q

are called by the owning worker
thread

A

push() & pop()

69
Q

use wait-free “compareand-swap (CAS) operations

A

push() & pop()

70
Q

may be called from another worker
thread to “steal” a (sub-)task

A

poll()

71
Q

computation model is a valuable tool for
parallelizing tasks, particularly those that can be divided into
independent subtasks the Fork-Join framework’s internal workings are
carefully designed to maximize performance and scalability in parallel
programming. Its work-stealing algorithm, efficient task management,
and high-level abstraction make it a valuable tool for tackling complex
computational problems.

A

fork-join Pool

72
Q

Is a cellular automaton that is played on a 2d square grid

A

Conways Game of Life

73
Q

Who created conways game of life

A

John Horton Conway

74
Q

a brilliant British Mathematician fascinated by the exploration of Mathematics in its purest form

A

John Horton Conway

75
Q

what type of game is conways game of life?

A

A zero player game

76
Q

Are there any winners in conways game of life

A

No

77
Q

What is conways game of life fully determined by?

A

The initial configuration of the pieces on the board

78
Q

Every piece surrounded by two or three other pieces survives for the next turn.

A

Survival

79
Q

Each piece surrounded by four or more pieces dies from overpopulation. Likewise, every piece next to one or no pieces at all dies from isolation

A

Death

80
Q

Each square adjacent to exactly thee pieces gives birth to a new piece

A

Birth

81
Q

Rules for conways game of life

A

For a space that is populated:
* Each cell with one or no neighbors dies, as if by solitude.
* Each cell with four or more neighbors dies, as if by overpopulation.
* Each cell with two or three neighbors survives.

For a space that is empty or unpopulated:
* Each cell with three neighbors becomes populated.

82
Q

patterns that do not change overtime

A

Class I: still life

83
Q

they repeat over a certain number of generations.

A

Class II : Oscillators

84
Q

They are classified based on their period.

A

Class II : Oscillators

85
Q

These are oscillators that at the end of their cycle somewhow find themselves in a different position. They effectively move! The most well known and loved is the glider.

A

Class III

86
Q

is an oscillator that every 30 generations spawns a new glider.

A

Class IV (or Gosper GLider Gun)

87
Q

patterns behave seemingly erractically chaotic until they eventually collapse to one of the classes above.

A

Class V

88
Q

patterns are doomed to a different fate: remaining in a perpetual state of chaos, forever evolving, yet never stabilizing onto something predictable.

A

Class VI

89
Q

conways game of life (python enterpretation)

A
  1. If a cell is ON and has fewer than two neighbors that are ON, it
    turns OFF
  2. If a cell is ON and has either two or three neighbors that are ON, it remains ON.
  3. If a cell is ON and has more than three neighbors that are ON,
    it turns OFF.
  4. If a cell is OFF and has exactly three neighbors that are ON, it turns ON.
90
Q

Conway’s Game of Life is _, meaning it can simulate any computer program. This implies that even with a simple set of rules, the game can exhibit the full range of computational capabilities

A

Turing-complete

91
Q

is a powerful example of how complex systems can emerge from simple rules. It continues to fascinate mathematicians, computer scientists, and anyone interested like complexity and emergent behavior.

A

Conways game of life

92
Q

points to the thread’s stack in the process.

A

Stack

93
Q

contains the local variables under
the thread’s scope.

A

Stack

94
Q

Each worker thread in a fork-join pool maintains its own _ also called a
deque.

A

double-ended queue

95
Q

Other implementations of Executor Service execute _ and _.

A

runnable and callable

96
Q
A