Slide 1

Slide 1 text

🐻💬

Slide 2

Slide 2 text

2 ▪ 🐻💬 ▪ ▪ ▪ ▪ ▪ ▪ ▪ ▪ Twitter: Deep Dive in async/await

Slide 3

Slide 3 text

3 ▪ ▪ ▪ ▪ ▪ Deep Dive in async/await

Slide 4

Slide 4 text

4 ▪ ▪ ▪ ▪ ▪ ▪ Deep Dive in async/await

Slide 5

Slide 5 text

5 Nein, aber (viel) effizienter! Deep Dive in async/await

Slide 6

Slide 6 text

6 Deep Dive in async/await

Slide 7

Slide 7 text

7 ▪ ▪ ▪ ▪ ▪ ▪ ▪ Deep Dive in async/await

Slide 8

Slide 8 text

9 • • • ▪ ▪ ▪ ▪ ▪ * Zahlen für Windows, Quelle: “Windows Internals“, Solomin, Russinovich et al. Jeffrey Richter sagt hingegen: 30 ms in Windows, Linux hat andere Zeiten… Deep Dive in async/await

Slide 9

Slide 9 text

10 • • • • • • • • • • Deep Dive in async/await

Slide 10

Slide 10 text

11 Kern 1 Kern 2 Kern 3 Kern 4 P2 T1 P2 T2 P3 T1 P1 T1 P3 T2 P1 T2 Kontext- Wechsel Kontext- & Prozess- Wechsel Deep Dive in async/await

Slide 11

Slide 11 text

12 • • • • • • • • • Deep Dive in async/await

Slide 12

Slide 12 text

13 ALU & FPU Registers 0 Registers 1 CPU Core with Hyper-Threading Classic CPU Core Deep Dive in async/await

Slide 13

Slide 13 text

14 Kern 1 Kern 2 Kern 3 Kern 4 P2 T1 P2 T2 MyProc T1 P1 T2 P1 T1 MyProc T2 MyProc T3 MyProc T4 MyProc T5 MyProc T7 MyProc T6 Deep Dive in async/await

Slide 14

Slide 14 text

15 • • • Quelle: “Systems Performance: Enterprise and the Cloud“, 2013, Brendan Gregg, Pearson Verlag Deep Dive in async/await

Slide 15

Slide 15 text

16 • • • • • • Deep Dive in async/await

Slide 16

Slide 16 text

17 Deep Dive in async/await

Slide 17

Slide 17 text

18 ▪ ▪ ▪ ▪ ▪ ▪ ⏳ ▪ ▪ ▪ ReadFile API: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile Deep Dive in async/await

Slide 18

Slide 18 text

19 ▪ ▪ ▪ ▪ ▪ ▪ ⏳ ▪ ReadFile API: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile Deep Dive in async/await

Slide 19

Slide 19 text

20 Deep Dive in async/await

Slide 20

Slide 20 text

21 • • IAsyncResult BeginSomething() • EndSomething(result) • • DoSomethingAsync() • event SomethingCompleted • • Task[] DoSomethingAsync() Deep Dive in async/await

Slide 21

Slide 21 text

22 Deep Dive in async/await

Slide 22

Slide 22 text

23 • • • • • • .ContinueWith() • Deep Dive in async/await

Slide 23

Slide 23 text

24 Task Task-Liste Threadpool T1 Threadpool T2 Kern 1 Kern 3 Kern 2 Kern 4 Threadpool T3 Threadpool T4 Threadpool Management Jeder Pool-Thread arbeitet Tasks in einer Endlosschleife ab Completed Tasks Deep Dive in async/await

Slide 24

Slide 24 text

25 • • • • • 🤯 • • Deep Dive in async/await

Slide 25

Slide 25 text

26 Deep Dive in async/await

Slide 26

Slide 26 text

27 • • async Task<> MyMethodAsync() • • • await OtherMethodAsync() • • await • • • • Deep Dive in async/await

Slide 27

Slide 27 text

28 Deep Dive in async/await

Slide 28

Slide 28 text

29 Deep Dive in async/await

Slide 29

Slide 29 text

30 • • task.GetAwaiter().GetResult() → ❌ • Thread.Sleep() → ❌ • await Task.Delay() → ✔ • Thread.SpinWait() • → ❌ • → ✔ Deep Dive in async/await

Slide 30

Slide 30 text

31 • • var task1 = DoSomethingAsync(); var task2 = DoSomethingElseAsync(); await Task.WhenAll(task1, task2); • • • Task.Factory.StartNew(…, TaskCreationOptions.LongRunning); • • • Deep Dive in async/await

Slide 31

Slide 31 text

32 • • • • Deep Dive in async/await

Slide 32

Slide 32 text

33 Deep Dive in async/await

Slide 33

Slide 33 text

34 ▪ ▪ ▪ ▪ ▪ ▪ ▪ Deep Dive in async/await

Slide 34

Slide 34 text

35 ▪ ▪ ▪ ▪ ▪ 😉 P Deep Dive in async/await

Slide 35

Slide 35 text

🐻💬