Многопоточность в .net: Дьявол в деталях

Download Многопоточность в .NET: Дьявол в деталях

If you can't read please download the document

Upload: mikhail-shcherbakov

Post on 14-Aug-2015

109 views

Category:

Technology


0 download

TRANSCRIPT

  1. 1. .NET: , JetBrains
  2. 2. vs vs (Processes), (Threads), (Tasks)
  3. 3. lock(), Monitor, [Synchronized] EventWaitHandle: Manual, Auto Mutex Barrier, CountDownEvent, Semaphore Slim, SpinWait WaitHandle, Kernel32Dll
  4. 4. ReaderWriterLock
  5. 5. ReadWriteLock Slim ( =) Upgradable Fairness, starvation using try... finally TryEnterReadLock, TryEnterWriteLock
  6. 6. Memory model
  7. 7. Memory barriers , Store buffer, Write Combining buffer Instruction reordering : mfence, lfence, sfence Thread.MemoryBarrier(), volatile, Volatile.Read(), Volatile.Write()
  8. 8. Double-checked locking
  9. 9. : cmpxchg xadd, lock Interloked: Read(Int64), Increment, Exchange, CompareExchange : =) , !!!
  10. 10. BlockingQueue
  11. 11. BlockingQueue
  12. 12. Immutable state no locking Commit/Rollback RwLock Read- , COM
  13. 13. COM- Appartments: STA, MTA, Neutral COM object creating ... =( GC Other thread STA-thread
  14. 14. ReSharper Main thread AcquireWrite Upgrade AcquireRead Pool thread TryAcquireRead CheckForInterrupt (