section 3 threading and locking definitions what is a
play

+ Section 3 Threading and Locking + Definitions What is a thread? - PowerPoint PPT Presentation

+ Section 3 Threading and Locking + Definitions What is a thread? + Definitions What is a thread? A single flow of control with a process + Definitions What is a thread? A single flow of control with a process Why use threads? + Definitions


  1. + Section 3 Threading and Locking

  2. + Definitions What is a thread?

  3. + Definitions What is a thread? A single flow of control with a process

  4. + Definitions What is a thread? A single flow of control with a process Why use threads?

  5. + Definitions What is a thread? A single flow of control with a process Why use threads? Exploit latency, concurrency Event-driven software

  6. + Dangers What could go wrong?

  7. + Dangers What could go wrong? Race Conditions

  8. + Dangers What could go wrong? Race Conditions How do we fix this?

  9. + Dangers What could go wrong? Race Conditions How do we fix this? Locking

  10. + Definitions What is a lock?

  11. + Definitions What is a lock? Serializes access to some critical region of code or data Used to enforce mutual exclusion concurrency control

  12. + Definitions What is a lock? Serializes access to some critical region of code or data Used to enforce mutual exclusion concurrency control Locks need help from hardware

  13. + Definitions What is a lock? Serializes access to some critical region of code or data Used to enforce mutual exclusion concurrency control Locks need help from hardware Different kinds of locks

  14. + Dangers What could go wrong?

  15. + Dangers What could go wrong? Impacts Performance

  16. + Dangers What could go wrong? Impacts Performance Hard to debug

  17. + Dangers What could go wrong? Impacts Performance Hard to debug Deadlocks

  18. + Dangers What could go wrong? Impacts Performance Hard to debug Deadlocks How do we fix this?

  19. + Dangers What could go wrong? Impacts Performance Hard to debug Deadlocks How do we fix this? Punt (if collisions aren’t our problem)

  20. + Dangers What could go wrong? Impacts Performance Hard to debug Deadlocks How do we fix this? Punt (if collisions aren’t our problem) Resource hierarchy/Conductor/Chandy-Misra

  21. + Using Threads Creation Termination Detachment and Joining Self and Equal

  22. + Using Threads Thread (class) Runnable (interface) ForkJoin ThreadPools/Executor Services

  23. + Project 0 Review

  24. + Project 1 Suggestions John’s Suggestion One thread for listening (waiting for server probes) One thread for keyboard input that handles server communication initiated by keyboard input One thread for periodic re-registration

  25. + Project 1 Reminders John’s Suggestion One thread for listening (waiting for server probes) One thread for keyboard input that handles server communication initiated by keyboard input One thread for periodic re-registration Remember Terminate cleanly You need to re-register Modularity

  26. + Questions? Java: http://docs.oracle.com/javase/tutorial/essential/concurrency/index.html http://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/ thread_basics.html C/Unix: http://www.mit.edu/people/proven/IAP_2000/index.html http://www.yolinux.com/TUTORIALS/ LinuxTutorialPosixThreads.html

Recommend


More recommend