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
This section represents the memory space allocated to a process, which is divided into different segments.
Process Memory
26
Contains the executable code of the process
Text
27
(Process Memory) Stores the data used by the process
Data
28
Used for storing local variables, function arguments, and return addresses during function calls.
Stack
29
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.
Multithreading
30
needed for multithreading
Fast central processing unit
31
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.
Processor Handling
32
Each thread is like a separate task within a program. They share resources and work together smoothly, ensuring programs run efficiently.
Thread Synchronization
33
Threads in a program can run independently or wait for their turn to process, making programs faster and more responsive.
Efficient Execution
34
Programmers need to be careful about managing threads to avoid problems like conflicts or situations where threads get stuck waiting for each other.
Programming Considerations
35
Multithreading vs. Multiprocessing
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.
36
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.
Multithreading
37
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.
Fork–join parallelism
38
provides a high performance, parallel, fine-grained task execution framework for Java programs
ForkJoinPool
39
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).
ForkJoin Pool
40
is a feature of Java 8 and higher, meant for utilizing multiple cores of the processor.
Java Parallel Streams
41
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)
parralel stream
42
is a flow of objects that supports various functions and is intended to produce a reliable output.
parallel stream (flow)
43
is simply a wrapper around a data source, allowing us to perform bulk operations on the data in a convenient way.
Stream in Java
44
make use of the fork-join framework and its common pool of worker threads.
Parallel streams
45
was added to java.util.concurrent in Java 7 to handle task management between multiple threads.
the fork-join framework
46
is an executor service implementation
Fork-join pool
47
is the basis for Java Executor framework class
Executor Service
48
is a construct that allows you to pass a task to be executed by a thread asychronously.
The java executor service
49
creates and maintains a reusable pool of threads for executing submitted tasks.
The java executor service
50
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
The java executor service
51
a program is broken down to a large number of small tasks.
Fine-grained parralelism
52
is lighter weight than a java thread
ForkJoinTask
53
To maximize core utilization, idle worker threads _ work from the tail of busy threads.
steal
54
Tasks are stolen in _ order since an older stolen task may provide a larger unit of work.
FIFO (First in First Out)
55
implements work-stealing minimizes locking contention
Workqueue
56
is used for asynchronous programming
CompletableFuture
57
means writing non-blocking code
Asynchronous programming
58
✓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.
CompletableFuture
59
* 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.
fork/join framework
60
used for computations that do not return results
RecursiveAction
61
used for computations that do return results
RecursiveTask
62
used for computations in which completed actions trigger other actions
CountedCompleter
63
enables a non-ForkJoinTask client to process ForkJoinTasks
ForkJoinPool
64
is to maximize processor core utilization
work-stealing
65
The Fork-Join Framework Internal
* 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
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.
deck
67
The _ deque that implements workstealing minimizes locking contention
WorkQueue
68
are called by the owning worker thread
push() & pop()
69
use wait-free “compareand-swap (CAS) operations
push() & pop()
70
may be called from another worker thread to “steal” a (sub-)task
poll()
71
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.
fork-join Pool
72
Is a cellular automaton that is played on a 2d square grid
Conways Game of Life
73
Who created conways game of life
John Horton Conway
74
a brilliant British Mathematician fascinated by the exploration of Mathematics in its purest form
John Horton Conway
75
what type of game is conways game of life?
A zero player game
76
Are there any winners in conways game of life
No
77
What is conways game of life fully determined by?
The initial configuration of the pieces on the board
78
Every piece surrounded by two or three other pieces survives for the next turn.
Survival
79
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
Death
80
Each square adjacent to exactly thee pieces gives birth to a new piece
Birth
81
Rules for conways game of life
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
patterns that do not change overtime
Class I: still life
83
they repeat over a certain number of generations.
Class II : Oscillators
84
They are classified based on their period.
Class II : Oscillators
85
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**.
Class III
86
is an oscillator that every 30 generations spawns a new glider.
Class IV (or Gosper GLider Gun)
87
patterns behave seemingly erractically chaotic until they eventually collapse to one of the classes above.
Class V
88
patterns are doomed to a different fate: remaining in a perpetual state of chaos, forever evolving, yet never stabilizing onto something predictable.
Class VI
89
conways game of life (python enterpretation)
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
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
Turing-complete
91
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.
Conways game of life
92
points to the thread’s stack in the process.
Stack
93
contains the local variables under the thread’s scope.
Stack
94
Each worker thread in a fork-join pool maintains its own _ also called a deque.
double-ended queue
95
Other implementations of Executor Service execute _ and _.
runnable and callable
96