Multi-core architecture


Possible problems:

  • deadlocks (happen under Coffman conditions): processes wait for each other
  • livelock: processes loop in useless work
  • starvation: processes don’t get to use some resource
  • race conditions: operations must be done in proper sequence

Race conditions

Leading to non-deterministic results
Solution - low-level synchronization mechanisms:

  • monitor: ability of waiting/blocking based on condition
  • semaphore: counting variable controlling access to resource
  • atomic operations: program operations that cannot be preemptied

Dynamic threads

New constructs: Parallel, Spawn, Sync

Computational complexity analysis of multithreaded model

Assuming constant time for thread spawning and scheduling

  • complexity (total time) ~ span: critical/longest path in execution graph
  • work (time of parallel threads) ~ of all calls

… number of processors
… time using processors ( … time of sequential processing, … time using unlimited number of processors)
… speedup, … speedup using processors

(Same work, but only max() of times)

Fibonnaci








Limits of parallelization

Amdahl’s law

Viewing single problem
… speedup

… proportion of parallelizable code

Gustafson’s law

View more/larger problems with more available processors
; … sequential time, … parallel time
… sequential share of work, … share of parallel work