{"id":20156,"date":"2023-01-26T06:55:01","date_gmt":"2023-01-26T06:55:01","guid":{"rendered":"https:\/\/www.booksofall.com\/de\/?post_type=product&#038;p=20156"},"modified":"2023-01-26T06:55:14","modified_gmt":"2023-01-26T06:55:14","slug":"coursebook","status":"publish","type":"product","link":"https:\/\/www.booksofall.com\/de\/coursebook\/","title":{"rendered":"Coursebook"},"content":{"rendered":"<p>Systems Architecture<\/p>\n<p>This section is a short review of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Systems_architecture\">System Architecture<\/a> topics that you\u2019ll need for <a href=\"https:\/\/en.wikipedia.org\/wiki\/Systems_programming\">System Programming<\/a>.<\/p>\n<p>2.1.1 Assembly<\/p>\n<p>What is <a href=\"https:\/\/www.britannica.com\/dictionary\/assembly\">assembly<\/a>? Assembly is the lowest that you\u2019ll get to <a href=\"https:\/\/www.sciencedirect.com\/topics\/engineering\/machine-language\">machine language<\/a> without writing 1\u2019s and 0\u2019s. Each computer has an architecture, and that architecture has an associated assembly language. Each assembly command has a 1:1 mapping to a set of 1\u2019s and 0\u2019s that tell the computer exactly what to do. For example, the following in the widely used x86 Assembly language add one to the memory address 20 [13] \u2013 you can also look in [8] Section 2A under the add instruction though it is more verbose.<\/p>\n<p>add BYTE PTR [0x20], 1<\/p>\n<p>Why do we mention this? Because it is important that although you are going to be doing most of this class in <a href=\"https:\/\/www.w3schools.com\/c\/c_intro.php\">C<\/a>, that this is what the code is translated into. Serious implications arise for race conditions and atomic operations.<\/p>\n<p>2.1.2 Atomic Operations<\/p>\n<p>An operation is atomic if no other processor should interrupt it. Take for example the above assembly code to add one to a register. In the architecture, it may actually have a few different steps on the circuit. The operation may start by fetching the value of the memory from the stick of ram, then storing it in the cache or a register, and then finally writing back [12] \u2013 under the description for fetch-and-add though your micro-architecture may vary. Or depending on performance operations, it may keep that value in cache or in a register which is local to that process \u2013 try dumping the -O2 optimized assembly of incrementing a variable. The problem comes in if two processors try to do it at the same time. The two processors could at the same time copy the value of the memory address, add one, and store the same result back, resulting in the value only being incremented once. That is why we have a special set of instructions on modern systems called atomic operations. If an instruction is atomic, it makes sure that only one processor or thread performs any intermediate step at a time. With x86 this is done by the lock prefix [8, p. 1120]. lock add BYTE PTR [0x20], 1<\/p>\n<p>Why don\u2019t we do this for everything? It makes commands slower! If every time a computer does something it has to make sure that the other cores or processors aren\u2019t doing anything, it\u2019ll be much slower. Most of the time we differentiate these with special consideration. Meaning, we will tell you when we use something like this. Most of the time you can assume the instructions are unlocked.<\/p>\n<p>2.1.3 Caching<\/p>\n<p>Ah yes, Caching. One of computer science\u2019s greatest problems. Caching that we are referring is processor caching. If a particular address is already in the cache when reading or writing, the processor will perform the operation on the cache such as adding and update the actual memory later because updating memory is slow [9, Section 3.4]. If it isn\u2019t, the processor requests a chunk of memory from the memory chip and stores it in the cache, kicking out the least recently used page \u2013 this depends on caching policy, but Intel\u2019s does use this. This is done because the l3 processor cache is roughly three times faster to reach than the memory in terms of time [11, p. 22] though exact speeds will vary based on the clock speed and architecture. Naturally, this leads to problems because there are two different copies of the same value, in the cited paper this refers to an unshared line. This isn\u2019t a class about caching, know how this could impact your code. A short but non-complete list could be<\/p>\n<p>1. Race Conditions! If a value is stored in two different processor caches, then that value should be accessed by a single thread.<\/p>\n<p>2. Speed. With a cache, your program may look faster mysteriously. Just assume that reads and writes that either happened recently or are next to each other in memory are fast.<\/p>\n<p>3. Side effects. Every read or write effects the cache state. While most of the time this doesn\u2019t help or hurt, it is important to know. Check the Intel programmer guide on the lock prefix for more information.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><iframe frameborder=\"0\" allowtransparency=\"true\" allowFullscreen=\"true\" style=\"width: 100%; height: 700px; border: none;\" src=\"https:\/\/online.visual-paradigm.com\/share\/book\/coursebook-18io0ysyro?enforceShowPromotionBar=true&#038;p=1\"><\/iframe><\/p>\n","protected":false},"featured_media":20163,"template":"","meta":{"_yoast_wpseo_title":"","_yoast_wpseo_metadesc":""},"product_brand":[],"product_cat":[285],"product_tag":[],"class_list":{"0":"post-20156","1":"product","2":"type-product","3":"status-publish","4":"has-post-thumbnail","6":"product_cat-c-by-programming-language","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>Coursebook - BooksOfAll German<\/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\/de\/coursebook\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Coursebook - BooksOfAll German\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.booksofall.com\/de\/coursebook\/\" \/>\n<meta property=\"og:site_name\" content=\"BooksOfAll German\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-26T06:55:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.booksofall.com\/de\/wp-content\/uploads\/sites\/9\/2023\/01\/img_63d222f4b678c.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.booksofall.com\/de\/wp-content\/uploads\/sites\/9\/2023\/01\/img_63d222f4b678c.png\" \/>\n<meta name=\"twitter:label1\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data1\" content=\"3\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.booksofall.com\/de\/coursebook\/\",\"url\":\"https:\/\/www.booksofall.com\/de\/coursebook\/\",\"name\":\"Coursebook - BooksOfAll German\",\"isPartOf\":{\"@id\":\"https:\/\/www.booksofall.com\/de\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.booksofall.com\/de\/coursebook\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/de\/coursebook\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.booksofall.com\/de\/wp-content\/uploads\/sites\/9\/2023\/01\/img_63d222f4b678c.png\",\"datePublished\":\"2023-01-26T06:55:01+00:00\",\"dateModified\":\"2023-01-26T06:55:14+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.booksofall.com\/de\/coursebook\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.booksofall.com\/de\/coursebook\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/www.booksofall.com\/de\/coursebook\/#primaryimage\",\"url\":\"https:\/\/www.booksofall.com\/de\/wp-content\/uploads\/sites\/9\/2023\/01\/img_63d222f4b678c.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/de\/wp-content\/uploads\/sites\/9\/2023\/01\/img_63d222f4b678c.png\",\"width\":\"506\",\"height\":\"714\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.booksofall.com\/de\/coursebook\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.booksofall.com\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Categories\",\"item\":\"https:\/\/www.booksofall.com\/de\/categories\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Coursebook\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.booksofall.com\/de\/#website\",\"url\":\"https:\/\/www.booksofall.com\/de\/\",\"name\":\"BooksOfAll German\",\"description\":\"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.\",\"publisher\":{\"@id\":\"https:\/\/www.booksofall.com\/de\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.booksofall.com\/de\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.booksofall.com\/de\/#organization\",\"name\":\"BooksOfAll German\",\"url\":\"https:\/\/www.booksofall.com\/de\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/www.booksofall.com\/de\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.booksofall.com\/de\/wp-content\/uploads\/sites\/9\/2022\/06\/booksofall-logo-2.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/de\/wp-content\/uploads\/sites\/9\/2022\/06\/booksofall-logo-2.png\",\"width\":166,\"height\":30,\"caption\":\"BooksOfAll German\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/de\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Coursebook - BooksOfAll German","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\/de\/coursebook\/","og_locale":"de_DE","og_type":"article","og_title":"Coursebook - BooksOfAll German","og_url":"https:\/\/www.booksofall.com\/de\/coursebook\/","og_site_name":"BooksOfAll German","article_modified_time":"2023-01-26T06:55:14+00:00","og_image":[{"url":"https:\/\/www.booksofall.com\/de\/wp-content\/uploads\/sites\/9\/2023\/01\/img_63d222f4b678c.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_image":"https:\/\/www.booksofall.com\/de\/wp-content\/uploads\/sites\/9\/2023\/01\/img_63d222f4b678c.png","twitter_misc":{"Gesch\u00e4tzte Lesezeit":"3\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.booksofall.com\/de\/coursebook\/","url":"https:\/\/www.booksofall.com\/de\/coursebook\/","name":"Coursebook - BooksOfAll German","isPartOf":{"@id":"https:\/\/www.booksofall.com\/de\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.booksofall.com\/de\/coursebook\/#primaryimage"},"image":{"@id":"https:\/\/www.booksofall.com\/de\/coursebook\/#primaryimage"},"thumbnailUrl":"https:\/\/www.booksofall.com\/de\/wp-content\/uploads\/sites\/9\/2023\/01\/img_63d222f4b678c.png","datePublished":"2023-01-26T06:55:01+00:00","dateModified":"2023-01-26T06:55:14+00:00","breadcrumb":{"@id":"https:\/\/www.booksofall.com\/de\/coursebook\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.booksofall.com\/de\/coursebook\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/www.booksofall.com\/de\/coursebook\/#primaryimage","url":"https:\/\/www.booksofall.com\/de\/wp-content\/uploads\/sites\/9\/2023\/01\/img_63d222f4b678c.png","contentUrl":"https:\/\/www.booksofall.com\/de\/wp-content\/uploads\/sites\/9\/2023\/01\/img_63d222f4b678c.png","width":"506","height":"714"},{"@type":"BreadcrumbList","@id":"https:\/\/www.booksofall.com\/de\/coursebook\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.booksofall.com\/de\/"},{"@type":"ListItem","position":2,"name":"Categories","item":"https:\/\/www.booksofall.com\/de\/categories\/"},{"@type":"ListItem","position":3,"name":"Coursebook"}]},{"@type":"WebSite","@id":"https:\/\/www.booksofall.com\/de\/#website","url":"https:\/\/www.booksofall.com\/de\/","name":"BooksOfAll German","description":"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.","publisher":{"@id":"https:\/\/www.booksofall.com\/de\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.booksofall.com\/de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Organization","@id":"https:\/\/www.booksofall.com\/de\/#organization","name":"BooksOfAll German","url":"https:\/\/www.booksofall.com\/de\/","logo":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/www.booksofall.com\/de\/#\/schema\/logo\/image\/","url":"https:\/\/www.booksofall.com\/de\/wp-content\/uploads\/sites\/9\/2022\/06\/booksofall-logo-2.png","contentUrl":"https:\/\/www.booksofall.com\/de\/wp-content\/uploads\/sites\/9\/2022\/06\/booksofall-logo-2.png","width":166,"height":30,"caption":"BooksOfAll German"},"image":{"@id":"https:\/\/www.booksofall.com\/de\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.booksofall.com\/de\/wp-json\/wp\/v2\/product\/20156","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.booksofall.com\/de\/wp-json\/wp\/v2\/product"}],"about":[{"href":"https:\/\/www.booksofall.com\/de\/wp-json\/wp\/v2\/types\/product"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.booksofall.com\/de\/wp-json\/wp\/v2\/media\/20163"}],"wp:attachment":[{"href":"https:\/\/www.booksofall.com\/de\/wp-json\/wp\/v2\/media?parent=20156"}],"wp:term":[{"taxonomy":"product_brand","embeddable":true,"href":"https:\/\/www.booksofall.com\/de\/wp-json\/wp\/v2\/product_brand?post=20156"},{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.booksofall.com\/de\/wp-json\/wp\/v2\/product_cat?post=20156"},{"taxonomy":"product_tag","embeddable":true,"href":"https:\/\/www.booksofall.com\/de\/wp-json\/wp\/v2\/product_tag?post=20156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}