threads external processes sledgehammer
play

Threads, External Processes, Sledgehammer Fabian Immler August 15, - PowerPoint PPT Presentation

Threads, External Processes, Sledgehammer Fabian Immler August 15, 2009 1 Sledgehammer 2 Threads in ML 3 Synchronization pthreads primitives 4 Thread Attributes pthreads primitives Isabelle/ML combinators 5 External Processes 6 End


  1. Threads, External Processes, Sledgehammer Fabian Immler August 15, 2009

  2. 1 Sledgehammer 2 Threads in ML 3 Synchronization pthreads primitives 4 Thread Attributes pthreads primitives Isabelle/ML combinators 5 External Processes 6 End

  3. Sledgehammer • Current goal → External ATP • In background • Response: metis commands

  4. Demo: sledgehammer

  5. Prerequisites • Isabelle 2009 • PolyML ≥ 5.2.1

  6. Threads in ML • modelled on pthread package • simplified

  7. Threads in Isabelle/ML • structure SimpleThread • structure Synchronized

  8. Demo: creating Threads

  9. Mutual Exclusion • Mutex ↔ Shared memory • One lock • Caution: interaction of lock and interrupt

  10. Communication • Via Shared Memory (eg Mailbox) • No busy waiting! • Notification

  11. Communication with Condition Variables • Condition Variable ↔ Mutex • Wait • Release Lock • Condition Variable signal • Wake up with Lock aquired

  12. Demo: pthreads primitives

  13. Communication Example Sledgehammer: • global list of active threads • changes invoke action

  14. Common Communication Begin Lock Signal wake up no State? Release Lock Wait yes Change State Signal Release Lock End

  15. Synchronized State Variable • Global, mutable state • Synchronized access • Exclusive locking • Notification • Without taking care of mutexes, condition variables, ...

  16. Demo: Isabelle/ML combinators

  17. Thread Attributes • Thread is able to modify • Control delivery of interrupt exceptions

  18. Thread Attributes • EnableBroadcastInterrupt • InterruptState • InterruptDefer • InterruptSynch • InterruptAsynch • InterruptAsynchOnce

  19. Isabelle/ML combinators • interruptible • uninterruptible • restore attributes inside

  20. Demo: Thread attributes

  21. system out • working with threads • propagation of interrupts • NOT OS.Process.system

  22. system out • bash Script • use File.shell path

  23. Demo: system out

  24. Further Information • PolyML basis (http://www.polyml.org/docs/Threads.html) • ˜˜/Pure/Concurrent • simple thread.ML • synchronized.ML • mailbox.ML • ˜˜/Pure/ML-Systems/multithreading polyml.ML • ˜˜/HOL/Tools/atp manager.ML

  25. What you need • SimpleThread.fork • Thread.broadcastInterrupt :-) • Synchronized.var • system out

  26. Thank you!

Recommend


More recommend