pt1.

Cards (34)

  • Sequential computation: single thread
  • Race condition: Outcome is made incorrect by a thread executing before another one
  • Race conditions mean concurrent program is non deterministic and depends on lucky timing
  • FSP: Final State Process, algebra to describe how system function
  • Generalisation: A is generalisation of B if every instance of B is A (not necessarily every A = B)
  • Model - abstract and simplified representation
  • Process: execution of a sequential program
  • Processes have states (described by variables) and actions (executed to transform its state)
  • LTS: Labelled Transition System, graph
  • FSP: Finite State Process, algebraic description
  • Modelling workflow: 1) Deconstruct scenario into processes with attributes (states) and sequences of actions. 2) Model - translate to Process Alphabets; describe with FSP; generate LTS 3) Implement with Java
  • Find actions in verbs in a scenario, and states in the situation at any time
  • Rules for description syntax. Process: starts with upper, State: starts with upper, Action: starts with lower. x -> P describes process of action x leading to P. Definitions are terminated with . and split by ,
  • Define a process with its starting state, then define the rest as you go donw
  • Very simple systems can be modelled in a single line
  • Threads in java, 1 thread = 1 thread of control, created and deleted dynamically (garbagecollector), sleep pauses the thread for a specific period of time
  • Extending thread is bad as: task may have thread behaviour but not need all the bells and whistles of a thread. there is not multiple inheritance so cannot inherit fromanything else
  • Should implement runnable - just forces run() method as implementation (more memory efficient)
  • (x -> P | y ->Q) | is used as or for actions
  • Always give back control to the main application after an interruptedexception
  • Object.interrupt() - send an interrupt signal from the controller
  • Join - wait for thread to finish (rejoin main task) before proceeding
  • generate thread from runnable: Thread t = new Thread(new ClassRunnableXIDK());
  • (x -> P | y -> Q) describes a process that initially participates in either x or y
  • Non-deterministic behaviour can lead to a deadlock (eg, toss could be heads or tails)
  • Safe system: nothing bad happens/can happen during execution (mutual exclusion & absence of deadlock)
  • Thread lifecycle: NEW (has not begun), RUNNABLE (running), BLOCKED (blocked as a result of a monitor lock (waiting for resources)), WAITING (waiting for another thread to do something), TIMED_WAITING (waiting for up to a set amount of time (includes sleep)), TERMINATED (has previously existed but is finished)
  • Monitor: object with synchronisation methods (wait(), notify() etc.)
  • STOP is a special keyword
  • Indexing: kinda like in an array but not, the same as creating multiple states with the exact same functionality
  • generate indexes by using stateName[i:0..x] (and then state2[i]). Can also combine with created constants to do PROCESS(N=x) = (state[i:0..N] -> y[i] -> PROCESS)
  • const is an FSP keyword for defining a constant
  • Guarded actions: think haskell, basically if statements. Take form (when ([comparison condition]) x -> P | when ( a < b) y -> Q)
  • ranges can also be defined independently like consts by range X = 0 .. N