﻿
{"id":4733,"date":"2016-07-09T07:23:39","date_gmt":"2016-07-09T07:23:39","guid":{"rendered":"http:\/\/www.gencayyildiz.com\/blog\/?p=4733"},"modified":"2016-07-09T07:23:39","modified_gmt":"2016-07-09T07:23:39","slug":"c-ile-multi-thread-programlamada-thread-kavrami","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/c-ile-multi-thread-programlamada-thread-kavrami\/","title":{"rendered":"C# \u0130le Multi Thread Programlamada &#8220;Thread&#8221; Kavram\u0131"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>Merhaba,<\/p>\n<p>\u00d6nceki\u00a0<a href=\"http:\/\/www.gencayyildiz.com\/blog\/c-ile-multi-thread-programlama-temelleri\/\" target=\"_blank\">C# \u0130le Multi Thread Programlama Temelleri<\/a>\u00a0ba\u015fl\u0131kl\u0131 yaz\u0131mda Multi Thread Programlamaya giri\u015f yapm\u0131\u015ft\u0131k. \u015eimdi ise Thread kavram\u0131n\u0131 ele alaca\u011f\u0131z.<\/p>\n<p>\u00d6nceki yaz\u0131m\u0131z\u0131 incelerseniz e\u011fer bir program CPU taraf\u0131ndan process olarak ele al\u0131nmakta ve \u00e7al\u0131\u015ft\u0131r\u0131lmaktad\u0131r. Halbuki i\u015f bu kadar sade bir bi\u00e7imde ger\u00e7ekle\u015ftirilmemektedir. Asl\u0131nda CPU&#8217;lar program\u0131n i\u015flenmesini process olarak de\u011fil processlerin i\u00e7erdi\u011fi alt i\u015flemler olan Thread&#8217;lar baz\u0131nda ele almaktad\u0131r.<\/p>\n<p>Hani \u00f6nceki yaz\u0131da, CPU&#8217;nun processleri s\u0131raya koymas\u0131na\u00a0<em><strong>D\u00f6ng\u00fcsel \u00c7izelgeleme<\/strong><\/em> demi\u015ftik. \u0130\u015fte as\u0131l olay\u0131n\u00a0<em><strong>D\u00f6ng\u00fcsel \u00c7izelgeleme<\/strong><\/em>\u00a0process d\u00fczeyinde de\u011fil Threadlar d\u00fczeyinde oldu\u011funu bilmenizi isterim.<\/p>\n<blockquote><p>Threadlar\u0131, process i\u00e7erisindeki alt process olarak nitelendirebiliriz&#8230;<\/p><\/blockquote>\n<p>\u015eimdi\u00a0process yap\u0131s\u0131n\u0131 daha net bir \u015fekilde ele alal\u0131m.<\/p>\n<p>Process i\u00e7inde Thread(lar\u0131) bar\u0131nd\u0131ran bir i\u015flev yap\u0131s\u0131d\u0131r. Her process i\u00e7erisinde <em><strong>Primary Thread<\/strong><\/em> diye nitelendirilen varsay\u0131lan bir thread vard\u0131r lakin bu thread d\u0131\u015f\u0131nda da threadlar olabilir de olmayabilir de&#8230; Yani process i\u00e7erisinde birden fazla thread olmak zorunda de\u011fildir.<\/p>\n<p>Primary Thread, processin \u00e7al\u0131\u015fmaya ba\u015flad\u0131\u011f\u0131 ilk noktad\u0131r. Buna \u00f6rnek olarak; \u00fczerinde \u00e7al\u0131\u015ft\u0131\u011f\u0131m\u0131z Console Applicationdaki Main metodunu hat\u0131rlat\u0131r\u0131m.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    class Program\r\n    {\r\n        static void Main(string&#x5B;] args)\r\n        {\r\n\r\n        }\r\n    }\r\n<\/pre>\n<p>\u0130\u015fte bu Main metodu asl\u0131nda processimizin Primary Thread olarak nitelendirdi\u011fi ilk thread&#8217;d\u0131r. Nihayetinde ilk olarak bu Main metodunun\u00a0\u00e7al\u0131\u015ft\u0131\u011f\u0131n\u0131 an\u0131msay\u0131n\u0131z&#8230;<\/p>\n<p>Threadlar\u0131n bir di\u011fer \u00f6zelli\u011fi ise; uzun ve maliyetli i\u015flerde threadlar CPU&#8217;lara y\u00fck olmamak i\u00e7in ge\u00e7ici olarak\u00a0D\u00f6ng\u00fcsel \u00c7izelgelemeden \u00e7\u0131kar\u0131lmaktad\u0131r. B\u00f6ylece y\u00fczlerce thread \u00e7al\u0131\u015f\u0131yormu\u015f gibi g\u00f6z\u00fcksede ger\u00e7ekte \u00e7ok az thread \u00e7izelgede aktif durumda demektir. \u0130\u015fte bu i\u015flem &#8220;<em><strong>Thread&#8217;lar\u0131n Bloke Olmas\u0131<\/strong><\/em>&#8221; diye nitelendirilmektedir.<\/p>\n<p>Evet, Thread kavram\u0131 \u00fczerine bu de\u011findiklerimiz yeterlidir.<\/p>\n<p>Bir sonraki i\u00e7eri\u011fimizde Multi Thread \u00c7al\u0131\u015fma \u00fczerine detaylarda konu\u015faca\u011f\u0131z.<\/p>\n<p>\u0130yi \u00e7al\u0131\u015fmalar&#8230;<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Merhaba, \u00d6nceki\u00a0C# \u0130le Multi Thread Programlama Temelleri\u00a0ba\u015fl\u0131kl\u0131 yaz\u0131mda Multi Thread Programlamaya giri\u015f yapm\u0131\u015ft\u0131k. \u015eimdi ise Thread kavram\u0131n\u0131 ele alaca\u011f\u0131z. \u00d6nceki yaz\u0131m\u0131z\u0131 incelerseniz e\u011fer bir program CPU taraf\u0131ndan process olarak ele al\u0131nmakta ve \u00e7al\u0131\u015ft\u0131r\u0131lmaktad\u0131r. Halbuki&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":3223,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[1346,1330,1352,1351,1235,1350,1353],"class_list":["post-4733","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c-sharp-c","tag-dongusel-cizelgeleme","tag-multi-thread","tag-primary-thread","tag-process","tag-thread","tag-thread-kavrami","tag-threadlarin-bloke-olmasi"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/4733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=4733"}],"version-history":[{"count":0,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/4733\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media\/3223"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=4733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=4733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=4733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}