Lecture 8 Flashcards
What is eager evaluation?
Arguments are evaluated before their procedure is called
What is the declarative concurrent model of computation DCKL?
An extension of DSKL
Can be extended using data-driven or demand driven concurrency
What is data-driven concurrency?
A thread of computation can execute when it has all its data
What is demand-driven concurrency?
A thread of computation can be executed no sooner than when the result of its execution is needed by another thread.
What does it mean to consume elements of a list while it is being created?
If we use threads to generate a list, and call browse on the list from another thread, it will display the elements as they are being created.
Browse consumes these elements.
What is the syntax for threads?
<statement> ::= thread <s> end
</s></statement>
What does a concurrent abstract machine contain?
Semantic stacks for each thread.
One single assignment store, shared across threads.
What does a scheduler do?
Chooses what executable semantic stack to run. The top most statement is poped and executed.
A stack is executable when the topmost statement is not frozen.
What is a fair scheduler?
Each semantic stack (thread) is eventually chosen.
Stacks are chosen with equal frequency.
In a concurrent system, when is computation finished?
When all semantic stacks are removed.
A stack is removed when it is empty.
What is the semantics of a thread?
(thread <s> end, E)</s>
Create a new stack
Push (<s>, E) on this stack</s>
When is a data-driven model of computation declarative?
One of these are true:
All executions of the program must have the same result (logical equivalent)
All executions must fail
What can make concurrent programs non-declarative?
If there is a unification error where two threads binds the same variable to different non-unifiable values. The program will always fail, however, the variable will take one of the bindings. If the variable is part of the result, it is not declarative. If it is not part of the result, it is declarative.
Introdusing exceptions
What are the operations of the thread module?
Thread.this
Thread.suspend T (need to be explicitly resumed)
Thread.resume T
Thread.preempt T (can be scheduled again by scheduler)
Thread.terminate T (can no longer be run)
These are not part of the declarative model
What is a stream?
Potentially infinite datastructure.
Elements can be added to end, and read from beginning.
These to operations can be performed concurrently.
Producer process: Adds elements
Consumer process: Reads elements