{"id":20324,"date":"2023-01-30T04:13:08","date_gmt":"2023-01-30T04:13:08","guid":{"rendered":"https:\/\/www.booksofall.com\/ru\/?post_type=product&#038;p=20324"},"modified":"2023-01-30T05:14:53","modified_gmt":"2023-01-30T05:14:53","slug":"threading-in-c","status":"publish","type":"product","link":"https:\/\/www.booksofall.com\/ru\/threading-in-c\/","title":{"rendered":"Threading in C#"},"content":{"rendered":"<h4>How Threading Works<\/h4>\n<p>Multithreading is managed internally by a thread scheduler, a function the<a href=\"https:\/\/www.techtarget.com\/whatis\/definition\/Common-Language-Runtime-CLR\"> CLR<\/a> typically delegates to the operating system. A thread scheduler ensures all active threads are allocated appropriate execution time, and that threads that are waiting or blocked (for instance, on an exclusive lock or on user input) do not consume <a href=\"https:\/\/en.wikipedia.org\/wiki\/CPU_time\">CPU time<\/a>.<\/p>\n<p>On a <a href=\"https:\/\/www.tutorialspoint.com\/Single-Processor-Systems\">single-processor<\/a> computer, a thread scheduler performs time-slicing \u2014 rapidly switching execution between each of the active threads. Under Windows, a time-slice is typically in the tens-of-milliseconds region \u2014 much larger than the CPU overhead in actually switching context between one thread and another (which is typically in the few-microseconds region).<\/p>\n<p>On a <a href=\"https:\/\/www.techopedia.com\/definition\/8474\/multiprocessor\">multi-processor<\/a> computer, multithreading is implemented with a mixture of <a href=\"https:\/\/www.geeksforgeeks.org\/time-slicing-in-cpu-scheduling\/\">time-slicing<\/a> and genuine concurrency, where different threads run code simultaneously on different CPUs. It\u2019s almost certain there will still be some time-slicing, because of the operating system\u2019s need to service its own threads \u2014 as well as those of other applications.<\/p>\n<p>A thread is said to be preempted when its execution is interrupted due to an external factor such as time-slicing. In most situations, a thread has no control over when and where it\u2019s preempted.<\/p>\n<h4>Threads vs Processes<\/h4>\n<p>A thread is analogous to the operating system process in which your application runs. Just as processes run in parallel on a computer, threads run in parallel within a single process. Processes are fully isolated from each other; threads have just a limited degree of isolation. In particular, threads share (heap) memory with other threads running in the same application. This, in part, is why threading is useful: one thread can fetch data in the background, for instance, while another thread can display the data as it arrives.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><iframe style=\"width: 100%; height: 700px; border: none;\" src=\"https:\/\/online.visual-paradigm.com\/share\/book\/threading-18o8aplax5?enforceShowPromotionBar=true&amp;p=1\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"featured_media":20327,"template":"","meta":{"_yoast_wpseo_title":"","_yoast_wpseo_metadesc":""},"product_brand":[],"product_cat":[290],"product_tag":[],"class_list":{"0":"post-20324","1":"product","2":"type-product","3":"status-publish","4":"has-post-thumbnail","6":"product_cat-csharp","8":"first","9":"instock","10":"shipping-taxable","11":"product-type-simple"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Threading in C# - BooksOfAll Russian<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.booksofall.com\/ru\/threading-in-c\/\" \/>\n<meta property=\"og:locale\" content=\"ru_RU\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Threading in C# - BooksOfAll Russian\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.booksofall.com\/ru\/threading-in-c\/\" \/>\n<meta property=\"og:site_name\" content=\"BooksOfAll Russian\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-30T05:14:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/img_63d742ddad66c.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/img_63d742ddad66c.png\" \/>\n<meta name=\"twitter:label1\" content=\"\u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 \u043c\u0438\u043d\u0443\u0442\u0430\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.booksofall.com\/ru\/threading-in-c\/\",\"url\":\"https:\/\/www.booksofall.com\/ru\/threading-in-c\/\",\"name\":\"Threading in C# - BooksOfAll Russian\",\"isPartOf\":{\"@id\":\"https:\/\/www.booksofall.com\/ru\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.booksofall.com\/ru\/threading-in-c\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/ru\/threading-in-c\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/img_63d742ddad66c.png\",\"datePublished\":\"2023-01-30T04:13:08+00:00\",\"dateModified\":\"2023-01-30T05:14:53+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.booksofall.com\/ru\/threading-in-c\/#breadcrumb\"},\"inLanguage\":\"ru-RU\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.booksofall.com\/ru\/threading-in-c\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ru-RU\",\"@id\":\"https:\/\/www.booksofall.com\/ru\/threading-in-c\/#primaryimage\",\"url\":\"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/img_63d742ddad66c.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/img_63d742ddad66c.png\",\"width\":\"598\",\"height\":\"826\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.booksofall.com\/ru\/threading-in-c\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.booksofall.com\/ru\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Categories\",\"item\":\"https:\/\/www.booksofall.com\/ru\/categories\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Threading in C#\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.booksofall.com\/ru\/#website\",\"url\":\"https:\/\/www.booksofall.com\/ru\/\",\"name\":\"BooksOfAll Russian\",\"description\":\"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.\",\"publisher\":{\"@id\":\"https:\/\/www.booksofall.com\/ru\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.booksofall.com\/ru\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ru-RU\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.booksofall.com\/ru\/#organization\",\"name\":\"BooksOfAll Russian\",\"url\":\"https:\/\/www.booksofall.com\/ru\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ru-RU\",\"@id\":\"https:\/\/www.booksofall.com\/ru\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2022\/06\/booksofall-logo-2.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2022\/06\/booksofall-logo-2.png\",\"width\":166,\"height\":30,\"caption\":\"BooksOfAll Russian\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/ru\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Threading in C# - BooksOfAll Russian","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.booksofall.com\/ru\/threading-in-c\/","og_locale":"ru_RU","og_type":"article","og_title":"Threading in C# - BooksOfAll Russian","og_url":"https:\/\/www.booksofall.com\/ru\/threading-in-c\/","og_site_name":"BooksOfAll Russian","article_modified_time":"2023-01-30T05:14:53+00:00","og_image":[{"url":"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/img_63d742ddad66c.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_image":"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/img_63d742ddad66c.png","twitter_misc":{"\u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f":"1 \u043c\u0438\u043d\u0443\u0442\u0430"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.booksofall.com\/ru\/threading-in-c\/","url":"https:\/\/www.booksofall.com\/ru\/threading-in-c\/","name":"Threading in C# - BooksOfAll Russian","isPartOf":{"@id":"https:\/\/www.booksofall.com\/ru\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.booksofall.com\/ru\/threading-in-c\/#primaryimage"},"image":{"@id":"https:\/\/www.booksofall.com\/ru\/threading-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/img_63d742ddad66c.png","datePublished":"2023-01-30T04:13:08+00:00","dateModified":"2023-01-30T05:14:53+00:00","breadcrumb":{"@id":"https:\/\/www.booksofall.com\/ru\/threading-in-c\/#breadcrumb"},"inLanguage":"ru-RU","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.booksofall.com\/ru\/threading-in-c\/"]}]},{"@type":"ImageObject","inLanguage":"ru-RU","@id":"https:\/\/www.booksofall.com\/ru\/threading-in-c\/#primaryimage","url":"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/img_63d742ddad66c.png","contentUrl":"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/img_63d742ddad66c.png","width":"598","height":"826"},{"@type":"BreadcrumbList","@id":"https:\/\/www.booksofall.com\/ru\/threading-in-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.booksofall.com\/ru\/"},{"@type":"ListItem","position":2,"name":"Categories","item":"https:\/\/www.booksofall.com\/ru\/categories\/"},{"@type":"ListItem","position":3,"name":"Threading in C#"}]},{"@type":"WebSite","@id":"https:\/\/www.booksofall.com\/ru\/#website","url":"https:\/\/www.booksofall.com\/ru\/","name":"BooksOfAll Russian","description":"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.","publisher":{"@id":"https:\/\/www.booksofall.com\/ru\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.booksofall.com\/ru\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ru-RU"},{"@type":"Organization","@id":"https:\/\/www.booksofall.com\/ru\/#organization","name":"BooksOfAll Russian","url":"https:\/\/www.booksofall.com\/ru\/","logo":{"@type":"ImageObject","inLanguage":"ru-RU","@id":"https:\/\/www.booksofall.com\/ru\/#\/schema\/logo\/image\/","url":"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2022\/06\/booksofall-logo-2.png","contentUrl":"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2022\/06\/booksofall-logo-2.png","width":166,"height":30,"caption":"BooksOfAll Russian"},"image":{"@id":"https:\/\/www.booksofall.com\/ru\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/product\/20324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/product"}],"about":[{"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/types\/product"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/media\/20327"}],"wp:attachment":[{"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/media?parent=20324"}],"wp:term":[{"taxonomy":"product_brand","embeddable":true,"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/product_brand?post=20324"},{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/product_cat?post=20324"},{"taxonomy":"product_tag","embeddable":true,"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/product_tag?post=20324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}