Please enable JavaScript.
Coggle requires JavaScript to display documents.
Concurrency - Coggle Diagram
Concurrency
Multi thread
Must sync data access
when shared data between threads
Mutex
Semaphore
Primary thread
Worker thread
To implement: use
Parallel
For scale code
Task Parallel Library (TPL)
Parallel LINQ (PLINQ)
Concurrency
Problem
safe operater => called Atomic
Switch context
General defination of Multi thread
Khái niệm tổng quát hơn, bao gồm cả: async + multi thread
Advance
Make app responsive
Scale code
Async Await
None blocking programming
handle blocking I/O and concurrent operations
Task/Task<T>
Task.Run to execute on separate thread
is one of three patterns to perform async
suffix: Async
Task.WhenAll, Task.WhenAny
DON'T Blocking on tasks with .Result or .Wait
--> deadlock
unable catch exception without await
Process
OS uses processes to separate the applications that executed
A process is an executing program
1 process may run multi threads