{"id":2036,"date":"2015-05-08T11:34:49","date_gmt":"2015-05-08T09:34:49","guid":{"rendered":"http:\/\/soci.hu\/blog\/?p=2036"},"modified":"2015-05-08T11:34:49","modified_gmt":"2015-05-08T09:34:49","slug":"task-run-etiquette-examples-dont-use-task-run-in-the-implementation","status":"publish","type":"post","link":"https:\/\/soci.hu\/blog\/index.php\/2015\/05\/08\/task-run-etiquette-examples-dont-use-task-run-in-the-implementation\/","title":{"rendered":"Task.Run Etiquette Examples: Don&#8217;t Use Task.Run in the Implementation"},"content":{"rendered":"<p>Az async &#8211; await dolgokkal fel lehet szabad\u00edtani pl. as ASP.NET \u00e1ltal is haszn\u00e1lt ThreadPool sz\u00e1lakat, hogy m\u00edg egy hossz\u00fa ideig tart\u00f3 nem CPU hanem IO intenz\u00edv folyamat fut, addig legyen szabad sz\u00e1l kiszolg\u00e1lni a rendes, kicsi, gyors k\u00e9r\u00e9seket.<\/p>\n<p>De ha \u00fagy aszinkron\u00edtunk egy blokkol\u00f3, IO intenz\u00edv k\u00e9r\u00e9st, hogy becsomagoljuk Task.Run-ba, akkor adtunk a sznak egy pofont, mert pont ugyanabb\u00f3l a ThreadPoolb\u00f3l vett\u00fcnk el sz\u00e1lat, mint amit az ASP.NET is haszn\u00e1l (felt\u00e9telezve az alap TaskSchedulert haszn\u00e1ljuk). R\u00e1ad\u00e1sul m\u00e9g context switch is lesz a sz\u00e1lak k\u00f6z\u00f6tt, stb.<\/p>\n<p>Az igazi aszinkron cuccosok (pl. .NET szerviz h\u00edv\u00f3 oszt\u00e1lyok \u00e9s adatb\u00e1zis kezel\u0151 oszt\u00e1lyok) <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/aa365198(VS.85).aspx\">IO completion portot<\/a> haszn\u00e1lnak, amivel sok blokkol\u00f3 folyamatot tudnak monitorozni kev\u00e9s sz\u00e1lon, nem minden egyes folyamathoz egy sz\u00e1lat haszn\u00e1lva, mint a Task.Run-os megold\u00e1s.<\/p>\n<p>B\u0151vebben a t\u00e9m\u00e1r\u00f3l <a href=\"http:\/\/blog.stephencleary.com\/2013\/11\/taskrun-etiquette-examples-dont-use.html\">itt<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Az async &#8211; await dolgokkal fel lehet szabad\u00edtani pl. as ASP.NET \u00e1ltal is haszn\u00e1lt ThreadPool sz\u00e1lakat, hogy m\u00edg egy hossz\u00fa ideig tart\u00f3&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,75,85,14,4],"tags":[],"class_list":["post-2036","post","type-post","status-publish","format-standard","hentry","category-net","category-net-4","category-net-45","category-aspnet","category-szakmai-elet"],"_links":{"self":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/2036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=2036"}],"version-history":[{"count":1,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/2036\/revisions"}],"predecessor-version":[{"id":2037,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/2036\/revisions\/2037"}],"wp:attachment":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=2036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=2036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=2036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}