Note 1: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID: G:Tv^LDF9E
added
Previous
Note did not exist
New Note
Front
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
Producer-Consumer
Producer puts items into a shared buffer, consumer takes them out.
Back
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
Producer-Consumer
Producer puts items into a shared buffer, consumer takes them out.

For simplicity, buffer is unbounded (has no capacity limit); producing is always possible. But consumption only possible if buffer isn't empty.
Field-by-field Comparison
| Field |
Before |
After |
| Text |
|
Producer-Consumer<br><br>Producer puts items into {{c1::a shared buffer}}, consumer takes them out. |
| Extra |
|
<img src="paste-c211fdbe1e74b12bcd5791600935a30934bf12b9.jpg"><br><br>For simplicity, buffer is unbounded (has no capacity limit); producing is always possible. But consumption only possible if buffer isn't empty. |
Tags:
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
Note 2: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID: b5{Xe*/ZF%
added
Previous
Note did not exist
New Note
Front
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
notify() wakes the highest-priority thread closest to front of object's internal queue.
Back
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
notify() wakes the highest-priority thread closest to front of object's internal queue.
Field-by-field Comparison
| Field |
Before |
After |
| Text |
|
{{c1::notify()}} wakes the highest-priority thread closest to front of object's internal queue. |
Tags:
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
Note 3: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID: bE5heetlg@
added
Previous
Note did not exist
New Note
Front
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
wait() releases object lock, thread waits on internal queue.
Back
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
wait() releases object lock, thread waits on internal queue.
Field-by-field Comparison
| Field |
Before |
After |
| Text |
|
{{c1::wait()}} releases object lock, thread waits on internal queue. |
Tags:
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
Note 4: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID: fn|<.%5[Cr
modified
Before
Front
ETH::2._Semester::PProg::Terminology
A liveness property is a property of a system: "something good eventually happens". Can only be violated in infinite time. Infinite loops and starvation are typical liveness properties.
Back
ETH::2._Semester::PProg::Terminology
A liveness property is a property of a system: "something good eventually happens". Can only be violated in infinite time. Infinite loops and starvation are typical liveness properties.
After
Front
ETH::2._Semester::PProg::05._Java_Threads ETH::2._Semester::PProg::Terminology
A liveness property is a property of a system: "something good eventually happens".
Back
ETH::2._Semester::PProg::05._Java_Threads ETH::2._Semester::PProg::Terminology
A liveness property is a property of a system: "something good eventually happens".
Can only be violated in infinite time.
Infinite loops and starvation are typical liveness properties.
Field-by-field Comparison
| Field |
Before |
After |
| Text |
A {{c1::liveness property}} is a property of a system: {{c2::"something good eventually happens"}}. Can only be violated in {{c3::infinite time}}. {{c4::Infinite loops and starvation}} are typical {{c1:: liveness properties}}. |
A {{c1::liveness property}} is {{c2::a property of a system: "something good eventually happens"}}. |
| Extra |
|
Can only be violated in infinite time. <br><br>Infinite loops and starvation are typical liveness properties. |
Tags:
ETH::2._Semester::PProg::Terminology
ETH::2._Semester::PProg::05._Java_Threads
Note 5: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID: h_KTBYg,v.
modified
Before
Front
ETH::2._Semester::PProg::Terminology
A program has a data race if, during any possible execution, a memory location could be written from one thread, while concurrently being read or written from another thread.
Back
ETH::2._Semester::PProg::Terminology
A program has a data race if, during any possible execution, a memory location could be written from one thread, while concurrently being read or written from another thread.
After
Front
ETH::2._Semester::PProg::05._Java_Threads ETH::2._Semester::PProg::Terminology
A program has a data race if, during any possible execution, a memory location could be written from one thread, while concurrently being read or written from another thread.
Back
ETH::2._Semester::PProg::05._Java_Threads ETH::2._Semester::PProg::Terminology
A program has a data race if, during any possible execution, a memory location could be written from one thread, while concurrently being read or written from another thread.
Field-by-field Comparison
| Field |
Before |
After |
| Text |
A program has a {{c1::data race}} if, during any possible execution, a memory location could be {{c2::written from one thread}}, while concurrently being {{c3::read or written from another thread}}. |
A program has a {{c1::data race}} if, {{c2::during any possible execution, a memory location could be written from one thread, while concurrently being read or written from another thread.}} |
Tags:
ETH::2._Semester::PProg::Terminology
ETH::2._Semester::PProg::05._Java_Threads
Note 6: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID: kaCb;PSfJ_
modified
Before
Front
ETH::2._Semester::PProg::Terminology
A safety property is a property of a system: "nothing bad ever happens". Can be violated in finite time.
Back
ETH::2._Semester::PProg::Terminology
A safety property is a property of a system: "nothing bad ever happens". Can be violated in finite time.
After
Front
ETH::2._Semester::PProg::05._Java_Threads ETH::2._Semester::PProg::Terminology
A safety property is a property of a system: nothing bad ever happens".
Back
ETH::2._Semester::PProg::05._Java_Threads ETH::2._Semester::PProg::Terminology
A safety property is a property of a system: nothing bad ever happens".
Can be violated in finite time.
Field-by-field Comparison
| Field |
Before |
After |
| Text |
A {{c1::safety property}} is a property of a system: {{c2::"nothing bad ever happens"}}. Can be violated in {{c3::finite time}}. |
A {{c1::safety property}} is {{c2::a property of a system: nothing bad ever happens"}}. |
| Extra |
|
Can be violated in finite time. |
Tags:
ETH::2._Semester::PProg::Terminology
ETH::2._Semester::PProg::05._Java_Threads
Note 7: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID: l%8{J|0P|E
added
Previous
Note did not exist
New Note
Front
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
Wait, Notify, NotifyAll may only be called when object is locked.
Back
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
Wait, Notify, NotifyAll may only be called when object is locked.
(e.g. inside synchronize)
Field-by-field Comparison
| Field |
Before |
After |
| Text |
|
Wait, Notify, NotifyAll may only be called when {{c1::object is locked}}. |
| Extra |
|
(e.g. inside synchronize) |
Tags:
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
Note 8: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID: oG)e}QN;XP
modified
Before
Front
ETH::2._Semester::PProg::Terminology
A program has a race condition if, during any possible execution with the same inputs, its observable behaviour (results, output, ...) may change if .
Back
ETH::2._Semester::PProg::Terminology
A program has a race condition if, during any possible execution with the same inputs, its observable behaviour (results, output, ...) may change if .
events: e.g. scheduler interactions causing different interleavings, changing network latency
After
Front
ETH::2._Semester::PProg::05._Java_Threads ETH::2._Semester::PProg::Terminology
A program has a race condition if, during any possible execution with the same inputs, its observable behaviour (results, output, ...) may change if events happen in different order.
Back
ETH::2._Semester::PProg::05._Java_Threads ETH::2._Semester::PProg::Terminology
A program has a race condition if, during any possible execution with the same inputs, its observable behaviour (results, output, ...) may change if events happen in different order.
E.g. scheduler interactions causing different interleavings, changing network latency
Field-by-field Comparison
| Field |
Before |
After |
| Text |
A program has a {{c1::race condition}} if, during any possible execution with the same inputs, its observable behaviour (results, output, ...) may change if {{2::events happen in different order}}. |
A program has a {{c1::race condition}} if, {{c2::during any possible execution with the same inputs, its observable behaviour (results, output, ...) may change if events happen in different order}}. |
| Extra |
events: e.g. scheduler interactions causing different interleavings, changing network latency |
E.g. scheduler interactions causing different interleavings, changing network latency |
Tags:
ETH::2._Semester::PProg::Terminology
ETH::2._Semester::PProg::05._Java_Threads
Note 9: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID: pZS(nkpCvj
added
Previous
Note did not exist
New Note
Front
ETH::2._Semester::PProg::05._Java_Threads::2._synchronized
In the context of synchronized, atomicity means that a critical section (protected by synchronized) is executed as an indivisible unit, preventing other threads from interrupting or seeing partial updates.
Back
ETH::2._Semester::PProg::05._Java_Threads::2._synchronized
In the context of synchronized, atomicity means that a critical section (protected by synchronized) is executed as an indivisible unit, preventing other threads from interrupting or seeing partial updates.
Field-by-field Comparison
| Field |
Before |
After |
| Text |
|
In the context of synchronized, {{c1::atomicity}} means that {{c2::a critical section (protected by synchronized) is executed as an indivisible unit, preventing other threads from interrupting or seeing partial updates}}. |
Tags:
ETH::2._Semester::PProg::05._Java_Threads::2._synchronized
Note 10: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID: sBK>tE5G:l
modified
Before
Front
ETH::2._Semester::PProg::Terminology
A shared resource is any resource (memory location, input source, output sink) shared by more than one thread.
Back
ETH::2._Semester::PProg::Terminology
A shared resource is any resource (memory location, input source, output sink) shared by more than one thread.
After
Front
ETH::2._Semester::PProg::05._Java_Threads ETH::2._Semester::PProg::Terminology
A shared resource is any resource (memory location, input source, output sink) shared by more than one thread.
Back
ETH::2._Semester::PProg::05._Java_Threads ETH::2._Semester::PProg::Terminology
A shared resource is any resource (memory location, input source, output sink) shared by more than one thread.
Field-by-field Comparison
| Field |
Before |
After |
| Text |
A {{c1::shared resource}} is any resource ({{c2::memory location, input source, output sink}}) shared by {{c3::more than one thread}}. |
A {{c1::shared resource}} is {{c2::any resource (memory location, input source, output sink) shared by more than one thread}}. |
Tags:
ETH::2._Semester::PProg::Terminology
ETH::2._Semester::PProg::05._Java_Threads
Note 11: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID: tBjjagui?P
added
Previous
Note did not exist
New Note
Front
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
If a thread calls the wait method in an Object or calls the join method in another thread object, the thread becomes "not runnable" and is no longer eligible for execution.
Back
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
If a thread calls the wait method in an Object or calls the join method in another thread object, the thread becomes "not runnable" and is no longer eligible for execution.
It becomes executable as a result of an associated notify method being called by another thread, or if the thread with which it has requested a join, becomes terminated.
Field-by-field Comparison
| Field |
Before |
After |
| Text |
|
If a thread calls the wait method in an Object or calls the join method in another thread object, the {{c1::thread becomes "not runnable" and is no longer eligible for execution}}. |
| Extra |
|
It becomes executable as a result of an associated <b>notify </b>method being called by another thread, or if the thread with which it has requested a join, becomes terminated. |
Tags:
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
Note 12: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID: vCXsSM!V2~
modified
Before
Front
ETH::2._Semester::PProg::Terminology
A critical section is a piece of code that, in order to guarantee correct program execution, may only be executed by one thread at a time.
Back
ETH::2._Semester::PProg::Terminology
A critical section is a piece of code that, in order to guarantee correct program execution, may only be executed by one thread at a time.
After
Front
ETH::2._Semester::PProg::05._Java_Threads ETH::2._Semester::PProg::Terminology
A critical section is a piece of code that, in order to guarantee correct program execution, may only be executed by one thread at a time.
Back
ETH::2._Semester::PProg::05._Java_Threads ETH::2._Semester::PProg::Terminology
A critical section is a piece of code that, in order to guarantee correct program execution, may only be executed by one thread at a time.
Field-by-field Comparison
| Field |
Before |
After |
| Text |
A {{c1::critical section}} is a piece of code that, in order to guarantee correct program execution, may only be {{c2::executed by one thread at a time}}. |
A {{c1::critical section}} is {{c2::a piece of code that, in order to guarantee correct program execution, may only be executed by one thread at a time}}. |
Tags:
ETH::2._Semester::PProg::Terminology
ETH::2._Semester::PProg::05._Java_Threads
Note 13: ETH::2. Semester::PProg
Deck: ETH::2. Semester::PProg
Note Type: Horvath Cloze
GUID: yTv{~xe6}n
added
Previous
Note did not exist
New Note
Front
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
notifyAll() wakes up all waiting threads.
Back
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll
notifyAll() wakes up all waiting threads.
Threads non-deterministically compete for access to object.
May not be fair (low-priority threads may never get access).
Field-by-field Comparison
| Field |
Before |
After |
| Text |
|
{{c1::notifyAll()}} wakes up all waiting threads. |
| Extra |
|
Threads non-deterministically compete for access to object.<br><br>May not be fair (low-priority threads may never get access). |
Tags:
ETH::2._Semester::PProg::05._Java_Threads::3._Wait,_Notify,_NotifyAll