{"id":5209,"date":"2012-12-27T17:07:41","date_gmt":"2012-12-27T17:07:41","guid":{"rendered":"http:\/\/www.journeytothecloud.com\/?p=2436"},"modified":"2012-12-27T17:07:41","modified_gmt":"2012-12-27T17:07:41","slug":"it-multi-tasking-i-was-told-thered-be-no-math","status":"publish","type":"post","link":"https:\/\/icloud.pe\/blog\/it-multi-tasking-i-was-told-thered-be-no-math\/","title":{"rendered":"IT Multi-Tasking: I Was Told There\u2019d Be No Math"},"content":{"rendered":"<p>By Ben Sawyer, Solutions Engineer<\/p>\n<p>&nbsp;<\/p>\n<p>The term \u201cmulti-tasking\u201d basically means doing more than one thing at once.\u00a0 I am writing this blog while playing Legos w\/ my son &amp; helping my daughter find New Hampshire on the map.\u00a0 But I am by no means doing more than one thing at once; I\u2019m just quickly switching back &amp; forth between the three which is referred to ask &#8220;<strong>context switching<\/strong>.&#8221;\u00a0 Context switching in most cases is very costly.\u00a0 There is a toll to be paid in terms of productivity when ramping up on a task before you can actually tackle that task. <span id=\"more-2436\"><\/span> In an ideal world (where I also have a 2 handicap) one has the luxury to do a task from start to finish before starting a new task.\u00a0 My son just refuses to let me have 15 minutes to write this blog because apparently building a steam roller right now is extremely important.\u00a0 There is a sense of inertia when you work on a task after a short while because you begin to really concentrate on the task at hand.\u00a0 Since we know it&#8217;s nearly impossible to put ourselves in a vacuum &amp; work on one thing only, the best we can hope for is to do &#8220;similar&#8221; things (i.e., in the same context) at the same time.\u00a0 Let&#8217;s pretend I have to email my co-worker that I&#8217;m late writing a blog, shovel my driveway, buy more Legos at Amazon.com, &amp; get the mail (okay, I&#8217;m not pretending).\u00a0 Since emailing &amp; buying stuff online both require me to be in-front of my laptop and shoveling &amp; going to my mailbox require me to be outside my house (my physical location), it would be far more efficient to do the tasks in the same &#8220;context&#8221; at the same time.\u00a0 Think of the time it takes to get all bundled up &amp; the time it takes to power on your laptop to get online.\u00a0 Doing a few things at once usually means that you will not do that task as well (its quality) as you would have had you done it uninterrupted.\u00a0 The more closely, time-wise, you can do a task usually means the better you will do that task since it will be &#8220;fresher&#8221; in your mind.\u00a0 So\u2026<\/p>\n<ul>\n<li>Entire Task A + Entire Task B = Great Task A &amp; Great Task B.<\/li>\n<li>1\/2 Task A + Entire Task B + 1\/2 Task A = Okay Task A &amp; Excellent Task B.<\/li>\n<li>1\/2 Task A + 1\/2 Task B + 1\/2 Task A + 1\/2 Task B = Good Task A &amp; Good Task B<\/li>\n<\/ul>\n<p>Why does this matter?\u00a0 Well, because the same exact concept applies to computers &amp; the software we write.\u00a0 A single processor can do one thing at a time only (let&#8217;s forget threads), but it can context switch extremely fast which gives the illusion of multi-tasking.\u00a0 But, like a human, context switching has a cost for a computer.\u00a0 So, when you write code try to do many &#8220;similar&#8221; things at the same time.\u00a0 If you have a bunch of SQL queries to execute then you should open a connection to the database first, execute them, &amp; close the connection.\u00a0 If you need to call some VMware APIs then you should connect to vCenter first, do them, &amp; close the connection.\u00a0 Opening &amp; closing connections to any system is often slow so group your actions by context which, in this case, are systems.\u00a0 This also makes the code easier to read.\u00a0 Speaking of reading, here&#8217;s a great example of the cost of context switching.\u00a0 The author Tom Clancy loves to switch characters &amp; plot lines every chapter.\u00a0 This makes following the story very hard &amp; whenever you put the book down &amp; start reading again it&#8217;s nearly impossible to remember where you left off b\/c there&#8217;s never, ever a good stopping point.\u00a0 Tom Clancy&#8217;s writing is one of the best examples of how costly context switching is.<\/p>\n<p>So, what does this have to do with <a title=\"Private Cloud\" href=\"http:\/\/response.greenpages.com\/PreparingForAPrivateCloudJourneyByJohnRoss-B\">cloud computing<\/a>?\u00a0 Well, it ties in directly with automation &amp; orchestration.\u00a0 <a title=\"Automation\" href=\"http:\/\/www.journeytothecloud.com\/cloud-computing\/cloud-corner-series-is-automation-orchestration-like-taking-a-shower\/\">Automation<\/a> is doing the work &amp; orchestration is determining the order in which work is done.\u00a0 Things can get complicated quickly when numerous tasks need to be executed &amp; it&#8217;s not immediately apparent which need to run first &amp; which are dependent on other tasks.\u00a0 And, once that is all figured out, what happens when a task fails?\u00a0 While software executes linearly, an orchestration engine provides the ability to run multiple pieces of software concurrently.\u00a0 And that&#8217;s where things get complicated real fast.\u00a0 Sometimes it may make sense to execute things serially (one at a time) vs. in parallel (more than one at a time) simply b\/c it becomes very hand to manage more than one task at the same time.<\/p>\n<p>We live in a world in which there are 10 different devices from which we can check our email and, if we want, we can talk to our smartphone &amp; ask it to read our email to us.\u00a0 Technology has made it easy for us to get information virtually any time &amp; in any format we want.\u00a0 However, it is because of this information overload that our brains have trouble separating all the useful information from the white noise.\u00a0 So we try to be more productive and we multi-task but that usually means we\u2019re becoming more busy than productive.\u00a0 In blogs to follow, I will provide some best practices for determining when it makes sense to run more than one task at a time.\u00a0 Now, if you don&#8217;t mind, I need to help my daughter find Maine\u2026<\/p>\n<p>&nbsp;<\/p>\n<div class=\"feedflare\">\n<a href=\"http:\/\/feeds.feedburner.com\/~ff\/JourneyToTheCloud?a=ZxFE6AdS1Vk:KJSAmuVZFtg:yIl2AUoC8zA\"><img decoding=\"async\" src=\"http:\/\/feeds.feedburner.com\/~ff\/JourneyToTheCloud?d=yIl2AUoC8zA\" border=\"0\"><\/img><\/a> <a href=\"http:\/\/feeds.feedburner.com\/~ff\/JourneyToTheCloud?a=ZxFE6AdS1Vk:KJSAmuVZFtg:-BTjWOF_DHI\"><img decoding=\"async\" src=\"http:\/\/feeds.feedburner.com\/~ff\/JourneyToTheCloud?i=ZxFE6AdS1Vk:KJSAmuVZFtg:-BTjWOF_DHI\" border=\"0\"><\/img><\/a> <a href=\"http:\/\/feeds.feedburner.com\/~ff\/JourneyToTheCloud?a=ZxFE6AdS1Vk:KJSAmuVZFtg:V_sGLiPBpWU\"><img decoding=\"async\" src=\"http:\/\/feeds.feedburner.com\/~ff\/JourneyToTheCloud?i=ZxFE6AdS1Vk:KJSAmuVZFtg:V_sGLiPBpWU\" border=\"0\"><\/img><\/a> <a href=\"http:\/\/feeds.feedburner.com\/~ff\/JourneyToTheCloud?a=ZxFE6AdS1Vk:KJSAmuVZFtg:qj6IDK7rITs\"><img decoding=\"async\" src=\"http:\/\/feeds.feedburner.com\/~ff\/JourneyToTheCloud?d=qj6IDK7rITs\" border=\"0\"><\/img><\/a>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/feeds.feedburner.com\/~r\/JourneyToTheCloud\/~4\/ZxFE6AdS1Vk\" height=\"1\" width=\"1\"\/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>By Ben Sawyer, Solutions Engineer &#160; The term \u201cmulti-tasking\u201d basically means doing more than one thing at once.\u00a0 I am writing this blog while playing Legos w\/ my son &#038; helping my daughter find New Hampshire on the map.\u00a0 But I am by no means doing more than one thing at once; I\u2019m just quickly&#8230;<a href=\"http:\/\/www.journeytothecloud.com\/cloud-computing\/it-multi-tasking-i-was-told-thered-be-no-math\/\">Read More &#187;<\/a><\/p>\n","protected":false},"author":25,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[104],"tags":[113,114],"class_list":["post-5209","post","type-post","status-publish","format-standard","hentry","category-cloud-computing","tag-automation","tag-orchestration"],"_links":{"self":[{"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/posts\/5209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/comments?post=5209"}],"version-history":[{"count":0,"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/posts\/5209\/revisions"}],"wp:attachment":[{"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/media?parent=5209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/categories?post=5209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/icloud.pe\/blog\/wp-json\/wp\/v2\/tags?post=5209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}