Every Java program has at least one execution thread: the main thread.
Note 1: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
added
Note Type: Horvath Cloze
GUID:
B,F!;`RW7{
Previous
Note did not exist
New Note
Front
Back
Every Java program has at least one execution thread: the main thread.
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | Every Java program has at least one execution thread: the {{c1::main thread}}. |
Note 2: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
added
Note Type: Horvath Cloze
GUID:
C=gwL7E2$`
Previous
Note did not exist
New Note
Front
Threads can continue to run even if main() returns.
Back
Threads can continue to run even if main() returns.
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | Threads can continue to run even if {{c1::main() returns}}. |
Note 3: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
added
Note Type: Horvath Cloze
GUID:
EMMnFHzbri
Previous
Note did not exist
New Note
Front
The three levels of threads:
- User-level thread: Managed by the application using a thread library
- Kernel-level thread: Managed by the OS
- CPU-level thread
Back
The three levels of threads:
- User-level thread: Managed by the application using a thread library
- Kernel-level thread: Managed by the OS
- CPU-level thread

Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | The three levels of threads:<br><ol><li>{{c1::User-level thread: Managed by the application using a thread library}}</li><li>{{c2::Kernel-level thread: Managed by the OS}}</li><li>{{c3::CPU-level thread}}</li></ol> | |
| Extra | <img src="paste-1adc2248bf047faaf5b87d179c2ebfb245b29d9a.jpg"> |
Note 4: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
modified
Note Type: Horvath Cloze
GUID:
F@`C!Z*]zr
Before
Front
Context switch overhead refers to resources required to set up an operation. In terms of context switch, CPU needs to store/save the local data, program pointer etc. of the current thread/process, and load the local data, program pointer etc. of the next thread/process to execute.
Back
Context switch overhead refers to resources required to set up an operation. In terms of context switch, CPU needs to store/save the local data, program pointer etc. of the current thread/process, and load the local data, program pointer etc. of the next thread/process to execute.
After
Front
Context switch overhead refers to resources required to set up an operation.
Back
Context switch overhead refers to resources required to set up an operation.
In terms of context switch, CPU needs to store/save the local data, program pointer etc. of the current thread/process, and load the local data, program pointer etc. of the next thread/process to execute.


Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | {{c1::Context switch overhead}} refers to {{c2::resources required to set up an operation}}. |
{{c1::Context switch overhead}} refers to {{c2::resources required to set up an operation}}. |
| Extra | In terms of context switch, CPU needs to store/save the local data, program pointer etc. of the current thread/process, and load the local data, program pointer etc. of the next thread/process to execute.<br><br><img src="paste-9a41c86e1793928c6e3039e1c355b65150478627.jpg"> |
Note 5: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
modified
Note Type: Horvath Cloze
GUID:
Fn?QX?wZyt
Before
Front
A context switch denotes the action of switching a computation unit from one computation to another. Typically refers to switching between processes, but can also refer to switching between threads. Depending on the size of the context, a context switch might be computationally expensive.
Back
A context switch denotes the action of switching a computation unit from one computation to another. Typically refers to switching between processes, but can also refer to switching between threads. Depending on the size of the context, a context switch might be computationally expensive.
After
Front
A context switch denotes {c2::the action of {switching a computation unit from one computation to another}}.
Back
A context switch denotes {c2::the action of {switching a computation unit from one computation to another}}.
Typically refers to switching between processes, but can also refer to switching between threads.
Depending on the size of the context, a context switch might be computationally expensive.

Depending on the size of the context, a context switch might be computationally expensive.

Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | A {{c1::context switch}} denotes the action of { |
A {{c1::context switch}} denotes {c2::the action of {switching a computation unit from one computation to another}}. |
| Extra | Typically refers to switching between processes, but can also refer to switching between threads. <br><br>Depending on the size of the context, a context switch might be computationally expensive.<br><br><img src="paste-9a41c86e1793928c6e3039e1c355b65150478627.jpg"> |
Note 6: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Classic
GUID:
added
Note Type: Horvath Classic
GUID:
Gs9Uu}>>{P
Previous
Note did not exist
New Note
Front
Concurrent, parallel, switching?


Back
Concurrent, parallel, switching?


- concurrent,
- not parallel,
- switching
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Front | Concurrent, parallel, switching?<br><br><img src="paste-2f0e90e9481d46bd5efa8e9441e343c1803ae11f.jpg"> | |
| Back | <ol><li>concurrent,</li><li>not parallel,</li><li>switching</li></ol> |
Note 7: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
added
Note Type: Horvath Cloze
GUID:
Ic;lq9kS_C
Previous
Note did not exist
New Note
Front
Context switching between threads is efficient.
Back
Context switching between threads is efficient.
- No change of address space
- No automatic scheduling
- No saving / (re-)loading of PCB (OS process) state
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | Context switching between threads is {{c1::efficient::cost?}}. | |
| Extra | <ul><li>No change of address space</li><li>No automatic scheduling</li><li>No saving / (re-)loading of PCB (OS process) state</li></ul> |
Note 8: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
modified
Note Type: Horvath Cloze
GUID:
J$-<~zgXtb
Before
Front
A process is an independently running instance of a program/application, typically on the operating system level. Similar to a thread, but usually more heavy-weight (since a whole program) and encapsulated in memory.
Back
A process is an independently running instance of a program/application, typically on the operating system level. Similar to a thread, but usually more heavy-weight (since a whole program) and encapsulated in memory.
After
Front
A process is an independently running instance of a program/application, typically on the operating system level.
Back
A process is an independently running instance of a program/application, typically on the operating system level.
Similar to a thread, but usually more heavy-weight (since a whole program) and encapsulated in memory.
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | A {{c1::process}} is an independently running instance of a |
A {{c1::process}} is {{c2::an independently running instance of a program/application, typically on the operating system level}}. |
| Extra | Similar to a thread, but usually more heavy-weight (since a whole program) and encapsulated in memory. |
Note 9: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
added
Note Type: Horvath Cloze
GUID:
N@^o[bG_R$
Previous
Note did not exist
New Note
Front
A process can have multiple user-level threads, that act as units of computation within the process.
Back
A process can have multiple user-level threads, that act as units of computation within the process.

These threads are managed by a user-space library.
E.g., a JVM process can have Java threads managed by the JVM using Java Thread library.
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | A process can have multiple {{c1::user-level threads, that act as units of computation within the process.}} | |
| Extra | <img src="paste-aa47ae645ed6d8c3b487fbbc8784304524688f2a.jpg"><br><br>These threads are managed by a user-space library.<br><br>E.g., a JVM process can have Java threads managed by the JVM using Java Thread library. |
Note 10: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
added
Note Type: Horvath Cloze
GUID:
NihlTsO@_n
Previous
Note did not exist
New Note
Front
Each call to start() method of a Thread object creates an actual execution thread.
Back
Each call to start() method of a Thread object creates an actual execution thread.
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | Each call to start() method of a Thread object creates {{c1::an actual execution thread}}. |
Note 11: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
added
Note Type: Horvath Cloze
GUID:
O1SVw#rq!=
Previous
Note did not exist
New Note
Front
Parallelism implies concurrency, but concurrency does not imply parallelism.
Back
Parallelism implies concurrency, but concurrency does not imply parallelism.
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | Parallelism implies concurrency, but {{c1::concurrency does not imply parallelism}}. |
Note 12: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
added
Note Type: Horvath Cloze
GUID:
O`leY5B0X&
Previous
Note did not exist
New Note
Front
Each thread has its own execution stack (method calls, local variables) and instruction stream (independent execution units within a process).
Back
Each thread has its own execution stack (method calls, local variables) and instruction stream (independent execution units within a process).
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | Each thread has its own {{c1::execution stack (method calls, local variables)}} and {{c2::instruction stream (independent execution units within a process)}}. |
Note 13: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
added
Note Type: Horvath Cloze
GUID:
b})FhBdptm
Previous
Note did not exist
New Note
Front
Creating a Thread object does not start a thread.
Back
Creating a Thread object does not start a thread.
Calling run() doesn't start thread either (need to call start()!).
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | Creating a Thread object does not {{c1::start}} a thread. | |
| Extra | Calling run() doesn't start thread either (need to call start()!). |
Note 14: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
modified
Note Type: Horvath Cloze
GUID:
e]#wx>XL,0
Before
Front
Thread mapping describes how a Java/JVM thread is related to an operating system thread. In native threading (most common), each JVM thread is mapped to a dedicated operating system thread. In green threading, the JVM maps several threads to a single operating system thread.
Back
Thread mapping describes how a Java/JVM thread is related to an operating system thread. In native threading (most common), each JVM thread is mapped to a dedicated operating system thread. In green threading, the JVM maps several threads to a single operating system thread.
After
Front
Thread mapping describes how a Java/JVM thread is related to an operating system thread.
Back
Thread mapping describes how a Java/JVM thread is related to an operating system thread.
In native threading (most common), each JVM thread is mapped to a dedicated operating system thread.
In green threading, the JVM maps several threads to a single operating system thread.
In green threading, the JVM maps several threads to a single operating system thread.
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | {{c1::Thread mapping}} describes how a Java/JVM thread is related to an operating system thread |
{{c1::Thread mapping}} describes {{c2::how a Java/JVM thread is related to an operating system thread}}. |
| Extra | In native threading (most common), each JVM thread is mapped to a dedicated operating system thread. <br><br>In green threading, the JVM maps several threads to a single operating system thread. |
Note 15: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Classic
GUID:
added
Note Type: Horvath Classic
GUID:
g8DF#qTsS}
Previous
Note did not exist
New Note
Front
Concurrent, parallel, switching?


Back
Concurrent, parallel, switching?


- concurrent,
- parallel,
- switching
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Front | Concurrent, parallel, switching?<br><br><img src="paste-2c26729cb1029f8fc1dd202e9abcc6a984c7f654.jpg"> | |
| Back | <ol><li>concurrent,</li><li>parallel,</li><li>switching</li></ol> |
Note 16: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Classic
GUID:
added
Note Type: Horvath Classic
GUID:
gpn7je{,@G
Previous
Note did not exist
New Note
Front
Concurrent, parallel, switching?


Back
Concurrent, parallel, switching?


- concurrent,
- parallel,
- no switching
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Front | Concurrent, parallel, switching?<br><br><img src="paste-97590326f01fa929fd2aeca9446b23398fd28697.jpg"> | |
| Back | <ol><li>concurrent,</li><li>parallel,</li><li>no switching</li></ol> |
Note 17: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
modified
Note Type: Horvath Cloze
GUID:
hxi*,8Kfw7
Before
Front
A thread is an independent (i.e. capable of running in parallel) unit of computation that executes a piece of code. The concept of threads exists on various levels: hardware (CPU), operating systems, programming languages. In Java, thread also refers to an instance of the
Thread class.Back
A thread is an independent (i.e. capable of running in parallel) unit of computation that executes a piece of code. The concept of threads exists on various levels: hardware (CPU), operating systems, programming languages. In Java, thread also refers to an instance of the
Thread class.After
Front
A thread is an independent (i.e. capable of running in parallel) unit of computation that executes a piece of code.
Back
A thread is an independent (i.e. capable of running in parallel) unit of computation that executes a piece of code.
The concept of threads exists on various levels:
In Java, thread also refers to an instance of the
- hardware (CPU),
- operating systems,
- programming languages.
In Java, thread also refers to an instance of the
Thread class.Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | A {{c1::thread}} is |
A {{c1::thread}} is {{c2::an independent (i.e. capable of running in parallel) unit of computation that executes a piece of code}}. |
| Extra | The concept of threads exists on various levels: <br><ol><li>hardware (CPU), </li><li>operating systems, </li><li>programming languages. </li></ol><br>In Java, thread also refers to an instance of the <code>Thread</code> class.<br> |
Note 18: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Occlusio
GUID:
added
Note Type: Horvath Occlusio
GUID:
lQ[1h#sJ<~
Previous
Note did not exist
New Note
Front
Life cycle of a Thread
Back
Life cycle of a Thread
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Occlusion | {{c1::image-occlusion:rect:left=.3945:top=.0588:width=.1655:height=.1476:oi=1}}<br>{{c2::image-occlusion:rect:left=.3918:top=.4158:width=.1734:height=.1534:oi=1}}<br>{{c3::image-occlusion:rect:left=.3945:top=.7551:width=.1629:height=.1475:oi=1}}<br> | |
| Image | <img src="paste-fc0d617e24e1faa63e16e457143ff3ee257f9ff2.jpg"> | |
| Header | Life cycle of a Thread |
Note 19: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Classic
GUID:
added
Note Type: Horvath Classic
GUID:
m}
Previous
Note did not exist
New Note
Front
Concurrent, parallel, switching?


Back
Concurrent, parallel, switching?


- not concurrent,
- not parallel,
- no switching
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Front | Concurrent, parallel, switching?<br><br><img src="paste-ec68a0ea016fa4aaeec82423922d746a441b8794.jpg"> | |
| Back | <ol><li>not concurrent,</li><li>not parallel,</li><li>no switching</li></ol> |
Note 20: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
modified
Note Type: Horvath Cloze
GUID:
nYv?sVRA/U
Before
Front
Concurrency means dealing with multiple things at the same time (as opposed to parallelism: doing multiple things at the same time). Involves managing shared resources and their interactions. Often used interchangeably with parallelism.
Back
Concurrency means dealing with multiple things at the same time (as opposed to parallelism: doing multiple things at the same time). Involves managing shared resources and their interactions. Often used interchangeably with parallelism.
After
Front
Concurrency means dealing with multiple things at the same time.
Back
Concurrency means dealing with multiple things at the same time.
(As opposed to parallelism: doing multiple things at the same time.)
Involves managing shared resources and their interactions.
Often used interchangeably with parallelism.
Involves managing shared resources and their interactions.
Often used interchangeably with parallelism.
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | {{c1::Concurrency}} means {{c2::dealing with multiple things at the same time}} |
{{c1::Concurrency}} means {{c2::dealing with multiple things at the same time}}. |
| Extra | (As opposed to parallelism: doing multiple things at the same time.)<br><br>Involves managing shared resources and their interactions. <br><br>Often used interchangeably with parallelism. |
Note 21: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
modified
Note Type: Horvath Cloze
GUID:
t,$m]=w>7t
Before
Front
Process context is all state associated with a process, including CPU state (registers, program counter), program state (stack, heap, resource handles), and additional management information.
Back
Process context is all state associated with a process, including CPU state (registers, program counter), program state (stack, heap, resource handles), and additional management information.
A thread also has a context, but it is typically much smaller.
After
Front
Process context is all state associated with a process, including CPU state (registers, program counter), program state (stack, heap, resource handles), and additional management information.
Back
Process context is all state associated with a process, including CPU state (registers, program counter), program state (stack, heap, resource handles), and additional management information.
A thread also has a context, but it is typically much smaller.
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | {{c1::Process context}} is all state associated with a process, including |
{{c1::Process context}} is {{c2::all state associated with a process, including CPU state (registers, program counter), program state (stack, heap, resource handles), and additional management information}}. |
Note 22: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Occlusio
GUID:
added
Note Type: Horvath Occlusio
GUID:
uzNFPB755~
Previous
Note did not exist
New Note
Front
Back
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Occlusion | {{c1::image-occlusion:rect:left=.5507:top=.2774:width=.1165:height=.0841:oi=1}}<br>{{c2::image-occlusion:rect:left=.315:top=.5032:width=.1086:height=.0819:oi=1}}<br>{{c2::image-occlusion:rect:left=.2422:top=.7402:width=.2555:height=.0798:oi=1}}<br>{{c3::image-occlusion:rect:left=.7731:top=.5032:width=.1205:height=.0775:oi=1}}<br>{{c3::image-occlusion:rect:left=.699:top=.7357:width=.2582:height=.0797:oi=1}}<br> | |
| Image | <img src="paste-c867da314e48899cf8269e7d445c3a926a79492a.jpg"> |
Note 23: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
added
Note Type: Horvath Cloze
GUID:
vMa?Kjh/Dg
Previous
Note did not exist
New Note
Front
Multiple threads share the same address space.
Back
Multiple threads share the same address space.
Threads are not shielded from each other. Threads share resources and can communicate more easily.


Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | Multiple threads share {{c1::the same address space}}. | |
| Extra | Threads are not shielded from each other. Threads share resources and can communicate more easily.<br><img src="paste-efe3db36972082793c65469a62d3859c3e90c7cf.jpg"> |
Note 24: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID:
modified
Note Type: Horvath Cloze
GUID:
x^m3<2iQiI
Before
Front
A scheduler is a management process, e.g. on the operating system level, that performs context switches. I.e. it interrupts/pauses/sends to sleep the currently running process (or thread), performs a context switch, and selects the next process (or thread) to run.
Back
A scheduler is a management process, e.g. on the operating system level, that performs context switches. I.e. it interrupts/pauses/sends to sleep the currently running process (or thread), performs a context switch, and selects the next process (or thread) to run.
After
Front
A scheduler is a management process, e.g. on the operating system level, that performs context switches.
Back
A scheduler is a management process, e.g. on the operating system level, that performs context switches.
I.e. it interrupts/pauses/sends to sleep the currently running process (or thread), performs a context switch, and selects the next process (or thread) to run.
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | A {{c1::scheduler}} is |
A {{c1::scheduler}} is {{c2::a management process, e.g. on the operating system level, that performs context switches}}. |
| Extra | I.e. it interrupts/pauses/sends to sleep the currently running process (or thread), performs a context switch, and selects the next process (or thread) to run. |