Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Threads, tasks and more talk proposal. #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
26 changes: 26 additions & 0 deletions threads-and-tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Threads, Tasks and More

### Talk overview
This presentation recaps some of the basics of writing code that makes use of threads, tasks and asynchronous features in C#. It is a modified version of a talk the author has given to his team at Microsoft.

This is an intermediate level talk aimed at developers still learning how to write parallel and async code in C#.

Material covered includes:

* What are threads?
* What are tasks?
* What are the rare cases you would want to use threads directly instead of tasks?
* What is asynchronous code?
* What actually happens when we await an async method?
* Common misconceptions about async code and parallelism.
* How continuations work.
* How to run multiple async methods in parallel.
* The perils of mixing sync and async code.
* The non-zero cost of making code async.
* Using Task.Yield to avoid blocking the caller.
* The purpose of the Thread Pool.

Finally, the talk concludes with a demonstration putting some of these conepts together by illustrating the thread pool thread creation algorithm, how high bursts of activity can lead to disaster when executing I/O bound tasks, and how using async solves this problem beautifully.

### Slides
The slides for this talk can be found under the /threads-and-tasks-slides folder, [here](./threads-and-tasks-slides)