Chapter 7: Multithreading and Asynchronous Processing Flashcards
Name some threads that all .net applications have.
Garbage Collector Thread
Finalizer thread
Main thread
UI Thread
TPL stands for
Task Parallel Library
A .net application ends when all of the following kind of threads stop executing.
nonbackground.
What is the difference between many core and multi-core?
Multi-Cor has more than one core that are all the same type.
Many core can have more than one of different type.s
Disadvantages of multithreaded applications
1) Resource intensive (1 MB of memory per thread, overhead of scheduler swtiching between threads)
2) creation and destroying threads takes time.
Method that causes current thread to wait on another
Join()
Differences between manually created threads and thread pool threads
all threads from the ThreadPool are background threads
you can’t abort or interrupt a ThreadPool thread.
you can’t join a thread from the ThreadPool
Threads are reused from the threadppol
can’t control priority of threads from the ThreadPool
technologies built on top of ThreadPool
Task Parallel Library (TPL)
Asynchronous Pattern Model (APM)
Event-based Asynchronous Pattern (EPA)
Task-based Asynchronous Pattern Model (TAP)
new async/await keywords
Events of the Background worker class
DoWork (e.Result to hold the result)
RunWorkerCompleted
TPL: ways to create a task (there are 4)
1) create an instance and call start()
2) static TaskFactory.StartNew
3) static Task.Run
4) Task continuation methods: Task.WhenAll, Task.WhenAny, TaskFactory.ContinueWhenAll, TaskFactory.ContinueWhenAny
Hyperthreading
means that every core has two intruction pipelines, but only one execution engine.
What was the only reason to use the TaskScheduler (given by the book)?
To force a task to be done by the current UI thread. TaskScheduler.FromCurrentSynchronizationContext().
the three static methods of the Parallel class
For
ForEach
Invoke
Three Continuation methods from Task and Task.Factory
Task.ContinueWith
Task.Factory.ContinueWhenAll
Task.Factory.ContinueWhenAny
the compiler generates a warning if your method marked async is missing what?
an await statement