Enviar pesquisa
Carregar
rioinfo2012
•
0 gostou
•
900 visualizações
Juan Lopes
Seguir
PROGRAMAÇÃO ASSÍNCRONA EM .NET 4.5
Leia menos
Leia mais
Tecnologia
Notícias e política
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 53
Baixar agora
Baixar para ler offline
Recomendados
Release with confidence
Release with confidence
John Congdon
SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)
Robert Swisher
Cse 241
Cse 241
vaminorc
WebSockets with PHP: Mission impossible
WebSockets with PHP: Mission impossible
Yoan-Alexander Grigorov
Controlling multiple VMs with the power of Python
Controlling multiple VMs with the power of Python
Yurii Vasylenko
Fixing 403 Forbidden Nginx Errors
Fixing 403 Forbidden Nginx Errors
VEXXHOST Private Cloud
Real Time Web Applications and Merb
Real Time Web Applications and Merb
Collin Miller
Socket programming with php
Socket programming with php
Elizabeth Smith
Recomendados
Release with confidence
Release with confidence
John Congdon
SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)
Robert Swisher
Cse 241
Cse 241
vaminorc
WebSockets with PHP: Mission impossible
WebSockets with PHP: Mission impossible
Yoan-Alexander Grigorov
Controlling multiple VMs with the power of Python
Controlling multiple VMs with the power of Python
Yurii Vasylenko
Fixing 403 Forbidden Nginx Errors
Fixing 403 Forbidden Nginx Errors
VEXXHOST Private Cloud
Real Time Web Applications and Merb
Real Time Web Applications and Merb
Collin Miller
Socket programming with php
Socket programming with php
Elizabeth Smith
Think your software is fault-tolerant? Prove it!
Think your software is fault-tolerant? Prove it!
Christopher Batey
Flask With Server-Sent Event
Flask With Server-Sent Event
Tencent
Why async matters
Why async matters
timbc
Async-await best practices in 10 minutes
Async-await best practices in 10 minutes
Paulo Morgado
Process file one after another
Process file one after another
Anirban Sen Chowdhary
Domains!
Domains!
Domenic Denicola
JDO 2019: Serverless Hype Driven Development - Grzegorz Piotrowski
JDO 2019: Serverless Hype Driven Development - Grzegorz Piotrowski
PROIDEA
Implement server push in flask framework
Implement server push in flask framework
Chi-Chia Huang
What's new on Laravel 5.5
What's new on Laravel 5.5
Glend Maatita
Nginx for Fun & Performance - Philipp Krenn - Codemotion Rome 2015
Nginx for Fun & Performance - Philipp Krenn - Codemotion Rome 2015
Codemotion
Sinatra: прошлое, будущее и настоящее
Sinatra: прошлое, будущее и настоящее
.toster
Jones_Lamp_Tutorial
Jones_Lamp_Tutorial
Olivia J. Jones
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Codemotion
Debugging PHP With Xdebug
Debugging PHP With Xdebug
Mark Niebergall
Firewall filters
Firewall filters
privado
Python Programming Essentials - M22 - File Operations
Python Programming Essentials - M22 - File Operations
P3 InfoTech Solutions Pvt. Ltd.
Push the web with HTML5
Push the web with HTML5
Stoyan Zhekov
Docker perl build
Docker perl build
Workhorse Computing
Syncing up with Python’s asyncio for (micro) service development, Joir-dan Gumbs
Syncing up with Python’s asyncio for (micro) service development, Joir-dan Gumbs
Pôle Systematic Paris-Region
Assurer - a pluggable server testing/monitoring framework
Assurer - a pluggable server testing/monitoring framework
Gosuke Miyashita
qconsp2015
qconsp2015
Juan Lopes
qconrio2015
qconrio2015
Juan Lopes
Mais conteúdo relacionado
Mais procurados
Think your software is fault-tolerant? Prove it!
Think your software is fault-tolerant? Prove it!
Christopher Batey
Flask With Server-Sent Event
Flask With Server-Sent Event
Tencent
Why async matters
Why async matters
timbc
Async-await best practices in 10 minutes
Async-await best practices in 10 minutes
Paulo Morgado
Process file one after another
Process file one after another
Anirban Sen Chowdhary
Domains!
Domains!
Domenic Denicola
JDO 2019: Serverless Hype Driven Development - Grzegorz Piotrowski
JDO 2019: Serverless Hype Driven Development - Grzegorz Piotrowski
PROIDEA
Implement server push in flask framework
Implement server push in flask framework
Chi-Chia Huang
What's new on Laravel 5.5
What's new on Laravel 5.5
Glend Maatita
Nginx for Fun & Performance - Philipp Krenn - Codemotion Rome 2015
Nginx for Fun & Performance - Philipp Krenn - Codemotion Rome 2015
Codemotion
Sinatra: прошлое, будущее и настоящее
Sinatra: прошлое, будущее и настоящее
.toster
Jones_Lamp_Tutorial
Jones_Lamp_Tutorial
Olivia J. Jones
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Codemotion
Debugging PHP With Xdebug
Debugging PHP With Xdebug
Mark Niebergall
Firewall filters
Firewall filters
privado
Python Programming Essentials - M22 - File Operations
Python Programming Essentials - M22 - File Operations
P3 InfoTech Solutions Pvt. Ltd.
Push the web with HTML5
Push the web with HTML5
Stoyan Zhekov
Docker perl build
Docker perl build
Workhorse Computing
Syncing up with Python’s asyncio for (micro) service development, Joir-dan Gumbs
Syncing up with Python’s asyncio for (micro) service development, Joir-dan Gumbs
Pôle Systematic Paris-Region
Assurer - a pluggable server testing/monitoring framework
Assurer - a pluggable server testing/monitoring framework
Gosuke Miyashita
Mais procurados
(20)
Think your software is fault-tolerant? Prove it!
Think your software is fault-tolerant? Prove it!
Flask With Server-Sent Event
Flask With Server-Sent Event
Why async matters
Why async matters
Async-await best practices in 10 minutes
Async-await best practices in 10 minutes
Process file one after another
Process file one after another
Domains!
Domains!
JDO 2019: Serverless Hype Driven Development - Grzegorz Piotrowski
JDO 2019: Serverless Hype Driven Development - Grzegorz Piotrowski
Implement server push in flask framework
Implement server push in flask framework
What's new on Laravel 5.5
What's new on Laravel 5.5
Nginx for Fun & Performance - Philipp Krenn - Codemotion Rome 2015
Nginx for Fun & Performance - Philipp Krenn - Codemotion Rome 2015
Sinatra: прошлое, будущее и настоящее
Sinatra: прошлое, будущее и настоящее
Jones_Lamp_Tutorial
Jones_Lamp_Tutorial
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Debugging PHP With Xdebug
Debugging PHP With Xdebug
Firewall filters
Firewall filters
Python Programming Essentials - M22 - File Operations
Python Programming Essentials - M22 - File Operations
Push the web with HTML5
Push the web with HTML5
Docker perl build
Docker perl build
Syncing up with Python’s asyncio for (micro) service development, Joir-dan Gumbs
Syncing up with Python’s asyncio for (micro) service development, Joir-dan Gumbs
Assurer - a pluggable server testing/monitoring framework
Assurer - a pluggable server testing/monitoring framework
Destaque
qconsp2015
qconsp2015
Juan Lopes
qconrio2015
qconrio2015
Juan Lopes
tdc2012
tdc2012
Juan Lopes
uerj201212
uerj201212
Juan Lopes
dnarj-20120630
dnarj-20120630
Juan Lopes
dnarj20130504
dnarj20130504
Juan Lopes
PIPES: Uma linguagem para processamento distribuído de eventos complexos
PIPES: Uma linguagem para processamento distribuído de eventos complexos
Juan Lopes
Destaque
(7)
qconsp2015
qconsp2015
qconrio2015
qconrio2015
tdc2012
tdc2012
uerj201212
uerj201212
dnarj-20120630
dnarj-20120630
dnarj20130504
dnarj20130504
PIPES: Uma linguagem para processamento distribuído de eventos complexos
PIPES: Uma linguagem para processamento distribuído de eventos complexos
Semelhante a rioinfo2012
About Node.js
About Node.js
Artemisa Yescas Engler
Node.js: CAMTA Presentation
Node.js: CAMTA Presentation
Rob Tweed
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnit
James Fuller
Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java
Baruch Sadogursky
Node intro
Node intro
cloudhead
Introduction to PowerShell
Introduction to PowerShell
Boulos Dib
Binary Studio Academy: Concurrency in C# 5.0
Binary Studio Academy: Concurrency in C# 5.0
Binary Studio
Node.js - async for the rest of us.
Node.js - async for the rest of us.
Mike Brevoort
RichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile Devices
Pavol Pitoňák
Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out!
Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out!
Priyanka Aash
The GO Language : From Beginners to Gophers
The GO Language : From Beginners to Gophers
Alessandro Sanino
Programming language for the cloud infrastructure
Programming language for the cloud infrastructure
Yaroslav Muravskyi
201209 tech days .net 4.5 核心功能及綜覽
201209 tech days .net 4.5 核心功能及綜覽
Meng-Ru (Raymond) Tsai
Async and Await on the Server
Async and Await on the Server
Doug Jones
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011
tobiascrawley
End to-end async and await
End to-end async and await
vfabro
Seven perilous pitfalls to avoid with Java | DevNation Tech Talk
Seven perilous pitfalls to avoid with Java | DevNation Tech Talk
Red Hat Developers
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Domenic Denicola
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
Yevgeniy Brikman
Developing IT infrastructures with Puppet
Developing IT infrastructures with Puppet
Alessandro Franceschi
Semelhante a rioinfo2012
(20)
About Node.js
About Node.js
Node.js: CAMTA Presentation
Node.js: CAMTA Presentation
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnit
Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java
Node intro
Node intro
Introduction to PowerShell
Introduction to PowerShell
Binary Studio Academy: Concurrency in C# 5.0
Binary Studio Academy: Concurrency in C# 5.0
Node.js - async for the rest of us.
Node.js - async for the rest of us.
RichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile Devices
Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out!
Breaking Parser Logic: Take Your Path Normalization Off and Pop 0days Out!
The GO Language : From Beginners to Gophers
The GO Language : From Beginners to Gophers
Programming language for the cloud infrastructure
Programming language for the cloud infrastructure
201209 tech days .net 4.5 核心功能及綜覽
201209 tech days .net 4.5 核心功能及綜覽
Async and Await on the Server
Async and Await on the Server
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011
End to-end async and await
End to-end async and await
Seven perilous pitfalls to avoid with Java | DevNation Tech Talk
Seven perilous pitfalls to avoid with Java | DevNation Tech Talk
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
Developing IT infrastructures with Puppet
Developing IT infrastructures with Puppet
Último
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
wesley chun
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Radu Cotescu
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Igalia
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Delhi Call girls
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
Antenna Manufacturer Coco
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Delhi Call girls
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
naman860154
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
Pixlogix Infotech
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Delhi Call girls
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Delhi Call girls
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
RTylerCroy
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
HampshireHUG
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Principled Technologies
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Enterprise Knowledge
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
sudhanshuwaghmare1
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
Martijn de Jong
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
The Digital Insurer
Último
(20)
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
rioinfo2012
1.
PROGRAMAÇÃO CONCORRENTE EM .NET 4.5 JUAN
LOPES twitter.com/juanplopes github.com/juanplopes
2.
PROGRAMAÇÃO TALVEZ CONCORRENTE EM .NET
4.5 JUAN LOPES twitter.com/juanplopes github.com/juanplopes
3.
PROGRAMAÇÃO ASSÍNCRONA EM .NET 4.5 JUAN
LOPES twitter.com/juanplopes github.com/juanplopes
4.
EU PROGRAMO WEB
5.
EU PROGRAMO WEB POR
QUE PROGRAMAR ASSINCRONAMENTE?
6.
EU PROGRAMO WEB POR
QUE PROGRAMAR ASSINCRONAMENTE? MENOR LATÊNCIA MAIOR RESPONSIVIDADE
7.
WINDOWS XP WINDOWS FORMS NÃO
BLOQUEIE A THREAD DA UI
8.
WINDOWS 8
WINRT NÃO BLOQUEIE A THREAD DA UI
9.
I/O vs CPU
10.
I/O vs CPU I/O
É MAIS CARO
11.
I/O vs CPU I/O
É MAIS LENTO
12.
I/O vs CPU I/O
É MAIS LENTO DISCO REDE BANCO DE DADOS
13.
PROGRAMAÇÃO CONCORRENTE
14.
PROGRAMAÇÃO CONCORRENTE THREADS
15.
PROGRAMAÇÃO CONCORRENTE É
DIFÍCIL
16.
PROGRAMAÇÃO CONCORRENTE É
DIFÍCIL OU NÃO
17.
COMO NÃO FAZER: new
Thread(() => { //código lento }).Start();
18.
TALVEZ NÃO PROGRAMAR
CONCORRENTEMENTE?
19.
TALVEZ NÃO PROGRAMAR
CONCORRENTEMENTE? TALVEZ ASSINCRONAMENTE
20.
MAS ANTES, O QUE
TEMOS HOJE?
21.
ATÉ .NET 3.5 BeginInvoke
EndInvoke
22.
Func<string> ler =
() => File.ReadAllText(@"C:test.txt"); var handle = ler.BeginInvoke(null, null); //qualquer outro código var resultado = ler.EndInvoke(handle);
23.
var req =
WebRequest.Create("http://google.com"); var handle = req.BeginGetRequestStream(null, null); //qualquer código var stream = req.EndGetRequestStream(handle);
24.
ATÉ .NET 3.5 Begin[QualquerCoisa]
End[QualquerCoisa]
25.
ATÉ .NET 3.5 Begin[QualquerCoisa]
End[QualquerCoisa] THREADS RACE CONDITIONS MAIS COMPLICADO
26.
.NET 4.0 PARALLEL EXTENSIONS
PLINQ (Parallel LINQ) + TPL (Task Parallel Library)
27.
.NET 4.0 PLINQ (Parallel
LINQ)
28.
var files =
new[] {"file1.txt", "file2.txt"}; var contents = string.Join("", files .AsParallel() .Select(File.ReadAllText) .ToArray());
29.
.NET 4.0 TPL (Task
Parallel Library)
30.
.NET 4.0 TPL (Task
Parallel Library) Task<T>
31.
var task =
Task.Run(() => File.ReadAllText(@"C:test.txt")); //qualquer outro código var resultado = task.Result;
32.
.NET 4.0 TPL (Task
Parallel Library) THREADS RACE CONDITIONS MENOS COMPLICADO
33.
.NET 4.5 ASYNC
AWAIT
34.
fs.readFile('test.txt', function (err,
data) { if (err) throw err; console.log(data); });
35.
Task.Run(() => File.ReadAllText(@"test.txt"))
.ContinueWith(x => Console.WriteLine(x.Result));
36.
var task =
Task.Run(() => File.ReadAllText(@"test.txt")); task.ContinueWith(x => Console.WriteLine(x.Result));
37.
var task =
Task.Run(() => File.ReadAllText(@"test.txt")); Console.WriteLine(await task);
38.
static async Task<int>
GoogleMaisYahoo() { var http = new HttpClient(); var google = http.GetStringAsync("http://google.com"); var yahoo = http.GetStringAsync("http://yahoo.com"); return (await google).Length + (await yahoo).Length; } static void Main(string[] args) { var task = GooglePlusYahoo(); //qualquer código Console.WriteLine(task.Result); Console.ReadLine(); }
39.
static Task<int> GooglePlusYahoo() {
var http = new HttpClient(); var google = http.GetStringAsync("http://google.com"); var yahoo = http.GetStringAsync("http://yahoo.com"); return Task.WhenAll(google, yahoo) .ContinueWith(x => x.Result[0].Length + x.Result[1].Length); } static void Main(string[] args) { var task = GooglePlusYahoo(); //qualquer código Console.WriteLine(task.Result); Console.ReadLine(); }
40.
.NET 4.5
ASYNC AWAIT SEM THREADS SEM RACE CONDITIONS MUITO MENOS COMPLICADO
41.
RESOLVE 92.4242% DOS
PROBLEMAS QUE THREADS RESOLVEM, APROXIMADAMENTE
42.
43.
private async void
button1_Click(object sender, EventArgs e) { var http = new HttpClient(); page.Text = "Loading..."; page.Text = await http.GetStringAsync("http://google.com"); }
44.
MESMA THREAD QUE
CHAMOU O MÉTODO POTENCIALMENTE NOVA THREAD private async void button1_Click(object sender, EventArgs e) { var http = new HttpClient(); page.Text = "Loading..."; page.Text = await http.GetStringAsync("http://google.com"); }
45.
ENTÃO CONTINUAMOS
COM THREADS BLOQUEADAS EM I/O?
46.
ENTÃO CONTINUAMOS
COM THREADS BLOQUEADAS EM I/O? NÃO
47.
IOCP
48.
IOCP I/O COMPLETION PORTS FUNCIONALIDADE
DO S.O. ASYNC "THREADLESS" I/O
49.
NÃO HÁ THREADS BLOQUEADAS
ESPERANDO CADA I/O TERMINAR
50.
NÃO HÁ THREADS BLOQUEADAS
ESPERANDO CADA I/O TERMINAR HÁ UMA ÚNICA THREAD DE IO QUE LÊ UMA FILA
51.
MÉTODOS DA BCL
QUE TERMINAM COM "ASYNC", GERALMENTE USAM IOCP
52.
MÉTODOS DA BCL
QUE TERMINAM COM "ASYNC", GERALMENTE USAM IOCP FileStream#ReadAsync HttpClient#GetStringAsync Socket#SendAsync
53.
OBRIGADO! TWITTER.COM/JUANPLOPES GITHUB.COM/JUANPLOPES
Baixar agora