1 / 14

Parallel Programming

Parallel Programming. (J)CSP. http://n.ethz.ch/~klauserc/FS10/PP/. Übersicht. Nachbesprechung Übung 6 Nachbesprechung Übung 7 Vorbesprechung Übung 8. Proofs. 1. Nachbesprechung Übung 6. Labels für Thread A. public void run() { while ( true ) { A1: // non-critical section

isra
Download Presentation

Parallel Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Parallel Programming (J)CSP http://n.ethz.ch/~klauserc/FS10/PP/

  2. Übersicht • NachbesprechungÜbung 6 • NachbesprechungÜbung 7 • VorbesprechungÜbung 8

  3. Proofs 1. NachbesprechungÜbung 6

  4. Labels für Thread A • publicvoid run() { • while (true) { • A1: // non-critical section • A2: turn0.request(); • A3: while (true) { • if (turn1.read() == 1) break; • A4: turn0.free(); • A5: turn0.request(); • } • A6:// critical section • A7: turn0.free(); • } • }

  5. publicvoid run() { • while (true) { • A1: // non-critical section • A2: turn0.request(); • A3: while (true) { • if (turn1.read() == 1) • break; • A4: turn0.free(); • A5: turn0.request(); • } • A6:// critical section • A7: turn0.free(); • } • } • publicvoid run() { • while (true) { • B1: // non-critical section • B2: turn1.request(); • B3: while (true) { • if (turn0.read() == 1) • break; • B4: turn1.free(); • B5: turn1.request(); • } • B6:// critical section • B7: turn1.free(); • } • } “turn0wirdausschliesslich von Thread A gesetzt.” Jeweilsentweder “turn0.flag == 0 weilgerade so gesetzt” oder “turn0.flag == 0 dank Induktionshypothese (weilnichtgeändert)”

  6. ReaderWriterLock 2. NachbesprechungÜbung 7

  7. Eclipse und so…

  8. JCSP 3. VorbesprechungÜbung 8

  9. CommunicatingSequentialProcesses Console Printer Broken Sensor Irregular Signal TimedPolling req out reg out res in

  10. CommunicatingSequentialProcesses Console Printer Broken Sensor Repeater pulse in assign in out TimedPolling req out reg out res in

  11. Nochmal Eclipse…

  12. Dining Philosophers • Locking mit JCSP implementieren • Monitor • ReaderWriterLock • Semaphore • Vorsicht Deadlocks!

  13. Mergesort II: Revengeof JCSP • Nein, das wird nur in der Theorie effizient sein ^^ • Arrays sind Privatsache; werden als Elementweise in einzelnen Nachrichten von Prozess zu Prozess geschickt • Länge des Arrays muss signalisiert werden: • 1. Nachricht enthält Länge • Spezielle Ende-des-Array-Nachricht • 2. Kanal für Kontrollnachrichten (via select)

  14. Fragen?

More Related