<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mayowa Egbinola on Medium]]></title>
        <description><![CDATA[Stories by Mayowa Egbinola on Medium]]></description>
        <link>https://medium.com/@mayowaegbinola?source=rss-2fe4f3375547------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rixUFEjmW4PHw73ylzT6Ww.jpeg</url>
            <title>Stories by Mayowa Egbinola on Medium</title>
            <link>https://medium.com/@mayowaegbinola?source=rss-2fe4f3375547------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 23:11:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mayowaegbinola/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Dart’s Single-Threaded Concurrency Model: Isolate]]></title>
            <link>https://medium.com/whythiscode/darts-single-threaded-concurrency-model-isolate-7be3850a3b5f?source=rss-2fe4f3375547------2</link>
            <guid isPermaLink="false">https://medium.com/p/7be3850a3b5f</guid>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[dart-isolates]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Mayowa Egbinola]]></dc:creator>
            <pubDate>Sun, 02 Aug 2020 23:03:40 GMT</pubDate>
            <atom:updated>2020-08-02T23:03:40.570Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article makes it super easy for you to quickly understand how you can leverage concurrency in building high-performance software programs in the Dart language. Let’s go!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*cb7FUG-kJwQrOrEm.jpg" /><figcaption>123rf.com</figcaption></figure><h3>Why Concurrency?</h3><p>In building high-performance software programs, you want to ensure that time-consuming operations are completed swiftly, without blocking.</p><blockquote>Without <em>blocking — </em>means an operation can be executed without waiting for another operation to be completed.</blockquote><p>Concurrency provides this multi-execution capability, leading to increased throughput and responsiveness of your program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*L6XZC-ACmqEVul6wgne3rA.gif" /><figcaption>giphy.com</figcaption></figure><p>Say, you want to build a server program for your new search engine <em>(</em><strong><em>thenextgoogle.com</em></strong><em>)</em>. Such a program should be capable of responding to millions of client requests (searches) per second.</p><p>You don’t want to have a single queue of requests because that would make users wait longer in line to get responses. Such experience can be frustrating very frustrating — <em>imaging waiting for an hour before </em><strong><em>google.com</em></strong><em> returns your search result.</em></p><p>A better approach is to leverage the power of Concurrency in your server program design to process each of those requests (searches) almost simultaneously and return results to the users swiftly.</p><p>This is one important ingredient that differentiates well-crafted software programs that provide top-notch user experience from a pile of frustration</p><h3>How Does Concurrency Work?</h3><p>To understand how concurrency works on computers, it is important to understand how computer processors <em>(popularly known as CPUs</em>) work.</p><p>Open up a modern computer (phones, PCs, etc.) and you’d find in them several processors or several cores within one processor.</p><p>These computational resources generously provide more room for better execution of tasks. The idea is that the operating system would break a large task into smaller chunks and distribute them across several parts of the processor in an efficient manner, leading to increased execution speed.</p><p>Though we say tasks are executed simultaneously with concurrency, it is not the case. In reality, the operating system simply switches back-and-forth quickly between multiple task processes — it’s so quick that you would believe the processes are running simultaneously.</p><h3>Concurrency Models</h3><p>There are two major concurrency approaches (models): <em>Shared state </em>and<em> Separated state</em>.</p><p>The <em>shared state</em> model allows multiple processes running on separate threads to share the same data (variables, object instances, etc.). These threads are allowed to read and write to the same data in memory.</p><blockquote>A thread is a lightweight process within a program.</blockquote><blockquote>It keeps its private memory data, but can still access shared data of other threads within the same program.</blockquote><p>The <em>separated state</em> model, however, does not allow processes running on separate threads to access the same data. The processes cannot read and write to the same data in memory, but they can pass information back-and-forth if there is any need, using a specialized communication protocol.</p><h3>Shared State Model</h3><p>The shared state model is commonly known as ‘’<strong>Multi-threading</strong>,” and it’s used in languages like <strong>Java, Python, and C++.</strong></p><p>In multi-threading, multiple tasks are executed using separate threads. These threads have equal access to shared data and can read and write to the same memory space.</p><p>There are two major problems with multi-threading: <strong>Deadlock</strong> and <strong>race conditions</strong>. These problems either lead to the program not responding or the program creating incorrect data, which can be catastrophic.</p><p>Designing your program against these problems is hard in practice. Here is an interesting insight by <a href="http://tutorials.jenkov.com/java-concurrency/locks.html"><strong><em>Jakob Jenkov</em></strong></a>.</p><h4>The Classic Race Condition Problem</h4><p>Our friends, Jane and John, recently opened a new bank account together, and they both have equal access to this account — each person can withdraw or save money at will.</p><p>Now, their account balance is <strong><em>$100</em></strong><em>,</em> which is stored as a variable, <strong><em>total_balance</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fLoje_CJPV2SfvAsy2-Z2g.png" /></figure><p>Say, Jane adds <strong><em>$20</em></strong> to the account at the same instant when John is somewhere else trying to withdraw <strong><em>$10</em></strong> from the account, depending on which operation gets executed first by the computer (something we cannot predict correctly), the new <strong><em>total_balance</em></strong> value will differ — both friends will receive two different <strong><em>total_balance</em></strong><em> </em>values after the transaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*P532lMAecc-ZBzPbolmp_A.gif" /><figcaption>giphy.com</figcaption></figure><p>This is known as the data race problem, and it questions the <em>reliability</em> of a multi-threaded software program.</p><p>Yes, there are different solution strategies (like <strong><em>locking</em></strong><em>)</em> designed to fix this problem, but like every quick fix for a problem, they are just like <em>putting a band-aid on a bullet wound</em>.</p><blockquote><strong>Locking</strong> means <em>blocking</em> a process (thread) from reading or writing to a variable in memory, while another process (thread) is still manipulating the same variable. It is a complex solution design that should be implemented carefully and tested thoroughly before software deployment.</blockquote><h3>Separated State Model: The Dart Way</h3><p>Dart uses a S<strong>eparated state</strong> model called, ‘<strong><em>Isolate</em></strong>’. An <em>Isolate</em> is simply a separated space on the processor (CPU) with its thread and private memory data.</p><p>Concurrency is done in Dart by creating multiple isolates that run different programs simultaneously. The downside to this approach is that if caution is not taken, too many unnecessary isolates will be created, leading to expensive memory consumption.</p><blockquote><em>Isolates </em>are designed to solve inherent <em>multi-threading</em> problems. They ensure that multiple processes are never manipulating the same data in memory, which solves the data race problem.</blockquote><p>Let’s say you now want to run a function call <strong><em>decodeMyData()</em></strong> in a new isolate. You’d simply call the <strong><em>Isolate.spawn() </em></strong>and pass in the <strong><em>decodeMyData</em></strong> method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*TnPnhn9NGRhFF4elUglE7g.png" /></figure><blockquote>If Isolates do not share data in memory, how then do they communicate?</blockquote><p>They communicate by passing messages back-and-forth through specialized ports ReceivePort and SendPort.</p><p>Think of them as two ends of a pipe. The Receive port listens to the SendPort for its message, while the SendPort sends back data as a message from the decodeMyData() process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ezosyqFhHwOtOUYh9IzfDg.png" /></figure><h3>In Summary</h3><p><strong>Shared</strong> and <strong>Separated</strong> state models are two different approaches to concurrency in computer programming. Although each model provides good value, the<strong> Separated</strong><em> </em>state model<strong> </strong>makes concurrency more <em>reliable</em> and <em>easier </em>in the application.</p><p>Thanks to <a href="https://twitter.com/jjenkov"><strong>Jakob Jenkov</strong></a> and <a href="https://twitter.com/redbrogdon"><strong>Andrew Brogdon</strong></a> for sharing the insights that this article is based on.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7be3850a3b5f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/whythiscode/darts-single-threaded-concurrency-model-isolate-7be3850a3b5f">Dart’s Single-Threaded Concurrency Model: Isolate</a> was originally published in <a href="https://medium.com/whythiscode">Why This Code?</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Concept of Process Modelling & Simulation]]></title>
            <link>https://medium.com/@mayowaegbinola/concept-of-process-modelling-simulation-c922e9a8cf47?source=rss-2fe4f3375547------2</link>
            <guid isPermaLink="false">https://medium.com/p/c922e9a8cf47</guid>
            <category><![CDATA[process-modelling]]></category>
            <category><![CDATA[mayowa-egbinola]]></category>
            <category><![CDATA[chemical-engineering]]></category>
            <category><![CDATA[simulation]]></category>
            <category><![CDATA[dwsim]]></category>
            <dc:creator><![CDATA[Mayowa Egbinola]]></dc:creator>
            <pubDate>Fri, 12 Jun 2020 23:27:20 GMT</pubDate>
            <atom:updated>2020-06-12T23:39:34.828Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JsccZItkynydBQUMXLWLkw.jpeg" /></figure><h3><strong>Why Build A Process Model?</strong></h3><p>TL;DR: it makes your life easier.</p><p>Let’s say, you want to know how long it takes to boil a pot of water in your kitchen at <strong><em>five</em></strong> different heating temperatures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/1*ZG8O2jr5HqdVUIh2RxsyhQ.png" /></figure><p>That’s easy, right? You’d only need to repeat the boiling process<strong><em> five times</em></strong>. Also, the cost of material (water) and electrical energy is expected to be minimal; even your pot and hot plate won’t cost you much.</p><p>What about estimating the amount of heat evolved in a chemical reaction?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/1*cL9YNr3XnQi9BXqyiWBJKg.png" /></figure><p>A simple laboratory experiment with few runs may give you all you need, right? Also, materials, energy, and equipment won’t cost you much.</p><p>Like boiling water in your kitchen, the chemical reaction study in the laboratory is an <strong><em>experimental approach</em></strong><em> </em>to understanding the behavior of a process.</p><p>Also, they both involve<strong><em> small quantities</em></strong> of materials and energy — orders of 100cm3, and a few kilojoules of energy. To keep it simple, experiments won’t cost you much on a small-scale.</p><h4><strong>Industrial Scale Means More</strong></h4><p>As process engineers, we deal with <strong><em>large-scale </em></strong>processes — this obviously translates to thousands of tonnes of materials; millions of kilojoules of heat energy.</p><blockquote>Exploring the behavior of an industrial-scale process under different conditions by the experimental approach can be unsafe, expensive, and time-consuming.</blockquote><h4><strong>The Modelling Approach</strong></h4><p>An alternative to conducting physical experiments is to develop a set of mathematical equations that represent the process, approximately.</p><p>These equations can then be used to <strong><em>predict</em></strong> the behavior of the <strong><em>actual physical process</em></strong> under different conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*wFUWEK5Ws1V3ek9LQiTl4g.png" /></figure><blockquote><em>Modelling: Building an approximate mathematical representation of a process.</em></blockquote><blockquote>This approach is cheaper, faster, and safer compared to the experimental approach.</blockquote><h3><strong>What about Simulation?</strong></h3><p>Using a process model to predict the behavior of a physical process under different conditions is known as <strong><em>simulation</em></strong>.</p><p>Let’s say, you want to know the effect of raw material flow rate on the purity level of a product in a distillation process.</p><p>You’d build a model of the distillation process first, and then iteratively test to see the resulting purity level at different flow rates.</p><h3><strong>Building The Process Model</strong></h3><p>The relevant quantities in a chemical process model include material (mass), energy, and momentum.</p><p>Process models may be developed using first principles such as<strong><em> material and energy balances</em>.</strong></p><blockquote>It is important to note that building a process model and simulating its behavior are steps towards a bigger goal: <strong>Solving a problem</strong>.</blockquote><h3><strong>Computer-Aided Modelling &amp; Simulation</strong></h3><p>Carrying out basic material balance around a refinery is not an easy task. Plus, it takes time too.</p><p>There are lots of modelling and simulation software tools (general or specialized) designed for this purpose, and they make our work faster and easier.</p><p>The ability to use such tools effectively is a valuable skill worth mastering.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c922e9a8cf47" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>