Submit Search
Upload
rioinfo2012
•
0 likes
•
899 views
Juan Lopes
Follow
PROGRAMAÇÃO ASSÍNCRONA EM .NET 4.5
Read less
Read more
Technology
News & Politics
Slideshow view
Report
Share
Slideshow view
Report
Share
1 of 53
Download now
Download to read offline
Recommended
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
Recommended
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
More Related Content
What's hot
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
What's hot
(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
Viewers also liked
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
Viewers also liked
(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
Similar to 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
Similar to 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
Recently uploaded
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
Hervé Boutemy
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
SeasiaInfotech2
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
Stephanie Beckett
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
Fwdays
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
UiPathCommunity
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
Fwdays
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Safe Software
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Ridwan Fadjar
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
Dubai Multi Commodity Centre
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
Sergiu Bodiu
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
2toLead Limited
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
ScyllaDB
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
RankYa
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
Addepto
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
BookNet Canada
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
null - The Open Security Community
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
Florian Wilhelm
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
Manik S Magar
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
Fwdays
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
Kalema Edgar
Recently uploaded
(20)
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
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
Download now