﻿{"id":619,"date":"2021-09-17T07:25:01","date_gmt":"2021-09-17T07:25:01","guid":{"rendered":"https:\/\/gridnet.org\/wpp\/?p=619"},"modified":"2022-07-28T07:58:44","modified_gmt":"2022-07-28T07:58:44","slug":"architecture-decentralized-processing-threads-and-fake-it-till-you-make-it","status":"publish","type":"post","link":"https:\/\/mag.gridnet.org\/index.php\/2021\/09\/17\/architecture-decentralized-processing-threads-and-fake-it-till-you-make-it\/","title":{"rendered":"Architecture, Decentralized Processing Threads, and.. Fake It Till you make it!"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-71 alignleft\" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/05\/gridUser1.gif\" alt=\"\" width=\"112\" height=\"157\" \/><em><span style=\"color: #00ffff;\"><strong>Disclaimer:<\/strong> <\/span><strong>This<\/strong> <\/em>article is <em><strong>not<\/strong> <\/em>a scientific one. Still, it targets both IT folks and regular crypto-aficionados alike through a playful mixture of science, facts and <span style=\"color: #ff00ff;\">grotesque.<\/span><\/p>\n<p>Reading through will give you a solid overview on some of the architectural details the kinds of possibilities and architectural decision to expect from the upcoming production-release.<\/p>\n<p>First off, we&#8217;ve prepared for you a simplified<span style=\"color: #00ffff;\"><em><strong> UML Use Case<\/strong><\/em>\u00a0<\/span>diagram involving elements\u00a0around the <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET<\/span>\u00a0<span style=\"color: #ffffff;\">Operating System<\/span><\/strong>. It depicts interactions between external actors and some of the internal sub-systems. Swipe your finger over the infographics below\u00a0to activate the <em><span style=\"color: #00ffff;\">Wizardous<\/span> <\/em>zoom\/pane which will allow\u00a0zoom-in on some of the details.<\/p>\n<p>Whenever architectural elements are mentioned it may come in handy.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_625\" style=\"width: 382px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-625\" class=\"zoooom wp-image-625\" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/system2.png\" alt=\"\" width=\"372\" height=\"389\" \/><p id=\"caption-attachment-625\" class=\"wp-caption-text\"><strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET<\/span> <\/strong><span style=\"color: #ffffff;\"><strong>OS<\/strong>&#8216;<\/span> Use Case UML Scheme<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><em><span style=\"color: #00ffff;\">Decentralized Processing Threads<\/span><\/em>,- what are these?\u00a0 Are they for real? Or maybe these are just fancy names pulled out of the <em><span style=\"color: #00ffff;\"><strong>Wizards<\/strong><\/span><\/em><span style=\"color: #00ffff;\">\u2019<\/span>\u00a0 magical hats?\ud83c\udfa9 ~<em>Propaganda-talk<\/em> used to shill <span style=\"color: #00ffff;\"><em>The Holy Project<\/em> <\/span>of theirs so that they could continue on their devious quest (..) towards decentralization of the entire planet(..)?<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_667\" style=\"width: 787px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-667\" class=\"wp-image-667\" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/wizardriding.gif\" alt=\"\" width=\"777\" height=\"435\" \/><p id=\"caption-attachment-667\" class=\"wp-caption-text\">A Wizard\ud83e\uddd9 removing weeds from the ground, that&#8217;s a joyous view \ud83e\udd2d<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>(..) After all, the nomenclature of a \u2018<em><span style=\"color: #00ffff;\">decentralized operating system<\/span>\u2019<\/em> in itself might sound to some like one big <em>tasty<\/em> marketing click-bait\u00a0 (it certainly would have sounded like so to <em><span style=\"color: #00ffff;\"><strong>Wizards<\/strong><\/span><\/em>\u00a0 were it not for themselves behind the wheels ).<\/p>\n<p><em>Marketing is important. There\u2019s no escaping of that.<\/em><\/p>\n<p>Still, some choose to make it <em>the sole prominent part<\/em> of their project. Enter the realm of ..<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_639\" style=\"width: 536px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-639\" class=\"wp-image-639\" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/fake.jpg\" alt=\"\" width=\"526\" height=\"501\" \/><p id=\"caption-attachment-639\" class=\"wp-caption-text\">IOTA:&#8221;(..) we\u2019ll incentivize your data exchange we don\u2019t know how (..) now you just give us some $$$ (..)\u201d<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>(..) and indeed! (..) Nobody shall <em>ever<\/em> beat IOTA\ud83e\udd21 (<span style=\"color: #ff00ff;\"><strong><em>I<\/em><\/strong><\/span><em>rresponsible <span style=\"color: #00ff00;\"><strong>O<\/strong><\/span>nes <span style=\"color: #808000;\"><strong>T<\/strong><\/span>ake <span style=\"color: #666699;\"><strong>A<\/strong><\/span>dvantage<\/em>) in the arts of <em>deception<\/em>.<\/p>\n<p>If you feel like it, you may read more about it over <a href=\"https:\/\/www.coindesk.com\/business\/2020\/02\/25\/iota-being-shut-off-is-the-latest-chapter-in-an-absurdist-history\/\">here<\/a>. The topic itself certainly deserves a separate publication at our <em>Holy Mag<\/em>. Still, this one has nothing to do with data-exchange so we\u2019ll just <em>relax<\/em> and skip over it. <em><span style=\"color: #00ffff;\"><strong>Wizards<\/strong><\/span><\/em>\u00a0certainly <em>do not <\/em>have time to take a shit on other projects (feel free to browse through some of the recent tweets for more<em>), but <\/em>IOTA\ud83e\udd21 (<em>as the name suggests<\/em>) at least deserves it. Big Time. And every now and then even a <em><span style=\"color: #00ffff;\"><strong>Wizard<\/strong><\/span><\/em>\u00a0might come in a need of an urgent <em>thing<\/em> so..\ud83d\ude2e\u200d\ud83d\udca8<\/p>\n<p>Alright, listen up, for the aim of this article, first off,- is to provide those of you not familiar with computer science with a quick background check on what traditional \u2018<em>threads\u2019<\/em> are. Don&#8217;t you be afraid ~Here, we won\u2019t be getting into much of a detail as the Internet is full of resources on the matter (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Thread_(computing)\">Wikipedia<\/a>).<\/p>\n<p>Second, the point is to give you a solid overview of the coined by us <span style=\"color: #00ffff;\"><strong><em>Decentralized Processing Threads<\/em><\/strong><\/span>. Now, since here is the only place on the Internet to get to know about these, we shall be focusing on the latter, wouldn\u2019t you agree?<\/p>\n<p>Buckle up fellas! Head-starting with traditional \u2018centralized\u2019 threads now!\u00a0 Let the story begin to unfold (..) let the bits and bytes flow (..) the 0s and 1s (..) let them flow all around .<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_641\" style=\"width: 1006px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-641\" class=\"wp-image-641\" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/starts.gif\" alt=\"\" width=\"996\" height=\"415\" \/><p id=\"caption-attachment-641\" class=\"wp-caption-text\">Long time ago.. in a galaxy far away (..)<\/p><\/div>\n<p>&nbsp;<\/p>\n<h1 style=\"text-align: center;\"><span style=\"color: #00ffff;\"><strong>The Concept Of A Thread<\/strong><\/span><\/h1>\n<p style=\"text-align: center;\"><span style=\"color: #ccffff;\"><em>(..) threads\u2019\u00a0 (..) simple as that, not?<\/em><\/span><\/p>\n<div id=\"attachment_642\" style=\"width: 640px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-642\" class=\"wp-image-642 \" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/oldthreads.jpg\" alt=\"\" width=\"630\" height=\"420\" \/><p id=\"caption-attachment-642\" class=\"wp-caption-text\">Without threads, you wouldn&#8217;t bare it, you wouldn&#8217;t take it.<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>Threads make your life easier each and every day! In short, threads allow for management of concurrency. To understand it, become aware of the fact that the very electronic device of yours, the one you\u2019ve been looking at trying to figure out what <em><span style=\"color: #00ffff;\"><strong>Wizards<\/strong><\/span><\/em>\u00a0 have been after as of recent included, performed hundreds of thousands of operations in the background. Data has been transmitted between your computer and their server, the screen refreshed thousands of times (and counting), the web-browser kept reacting to gestures and mouse-movements (..) And are you listening to music while reading this?<\/p>\n<p>All these actions are always carried out either directly or indirectly through the <em>Central Processing Unit (CPU).<\/em> Multiple other peripherals may be involved! The screen, the speakers, the radio transmitter (..) Touch sensor, touchpad, mouse, keyboard, memory units and so on.<\/p>\n<p>The important thing to note is that a CPU executes instructions written by programmers. Those <em>(not-so-always)<\/em>boring folks make them tick as desired so that the user experience is delivered.<\/p>\n<p><em>Now<\/em>, how many simultaneous instructions can a CPU perform? Well, that depends on its <em>architecture<\/em>\u00a0. On its number of \u2018cores\u2019, to be semi-exact. Indeed, allowing ourselves for some sloppy simplifications, a single core can execute a single instruction at a time. The more cores, the more things going on at a time. The more fun, the more pleasurable the user experience gets to be.<\/p>\n<p>What \u2018rules\u2019 the CPU? The \u2018<span style=\"color: #00ffff;\"><strong>Operating System<\/strong><\/span>\u2019 . The latter is just a <em>piece of software<\/em> as well. Why so special? Is it? It manages other programs. At least that\u2019s one of its main purposes.<\/p>\n<p>The operating system employs the convention of <em>threads<\/em> to create an <em>illusion<\/em> of multiple applications operating simultaneously, no matter what the number of the underlying hardware CPU cores actually is. An illusion?\u00a0 Yeah. But if you don\u2019t get to notice, does it matter? No hard feelings about it; it\u2019s <em>only<\/em> tech.<\/p>\n<div id=\"attachment_643\" style=\"width: 714px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-643\" class=\"wp-image-643 \" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/cpu.gif\" alt=\"\" width=\"704\" height=\"396\" \/><p id=\"caption-attachment-643\" class=\"wp-caption-text\">The bits and bytes (..) the 0s and 1s (..)<\/p><\/div>\n<p>The <span style=\"color: #00ffff;\"><strong>operating system<\/strong><\/span> spawns a new thread on the programmer\u2019s request and wraps <em>his<\/em> code around it. The programmer gets to tell which thread gets which instructions to run. The operating system is aware of each and every thread owned by each and every application. Oh <strong><em>Yes<\/em><\/strong>, a single application can own multiple threads . Once an application exits, all of its threads are guaranteed to be terminated as well. The operating system distributes execution time-slots provided by the CPU across all the active threads.<\/p>\n<p style=\"text-indent: 36.0pt;\"><span style=\"font-family: 'Arial',sans-serif;\">The time-slots assigned to individual threads are so small that you wouldn&#8217;t notice. In a way, it\u2019s like watching a movie. You don\u2019t get to see the flickering of individual frames. Our brains don\u2019t react so fast. Our vision system, at least.<\/span><\/p>\n<div id=\"attachment_644\" style=\"width: 495px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-644\" class=\"wp-image-644 \" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/mario.gif\" alt=\"\" width=\"485\" height=\"241\" \/><p id=\"caption-attachment-644\" class=\"wp-caption-text\">2D sprites are in use even today! From the perspective of a being \u2018living\u2019 in the 5th dimension, would we just be static 4-dimensional sculptures? The Time would have ceased to exist<\/p><\/div>\n<p>A traditional thread has one owner. It is the app . The thread can be managed by both the operating system and the owning app (to a limited extent). The thread\u2019s lifetime never exceeds the app\u2019s lifetime. Threads can be started and killed by the two on demand. Threads are containers for instructions. They have an identifier and can be looked-up and queried by it. Threads allow for more efficient processes\u2019 isolation. Each thread has a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Stack_(abstract_data_type)\">stack<\/a>\u00a0of its own.<\/p>\n<p>All these properties have a common denominator with what we\u2019re about to show. With some notable differences, though.<\/p>\n<p><span style=\"color: #00ccff;\"><em>(..)\u00a0 We\u2019re now entering the realm of\u2026<\/em><\/span><\/p>\n<h1 style=\"text-align: center;\"><span style=\"color: #00ffff;\"><strong>Decentralized Processing Threads<\/strong> \ud83c\udfa9<\/span><\/h1>\n<div id=\"attachment_669\" style=\"width: 1510px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-669\" class=\"wp-image-669 size-full\" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/wizardPipe.png\" alt=\"\" width=\"1500\" height=\"843\" \/><p id=\"caption-attachment-669\" class=\"wp-caption-text\">(..) it is said that <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET<span style=\"color: #ffffff;\">\u00a0<\/span><\/span><\/strong><span style=\"color: #ffffff;\">OS<\/span> materialized from the <span style=\"color: #00ffff;\"><em><strong>Old Wizards<\/strong><\/em><\/span>&#8216;\ud83e\uddd9 Pipe Dreams (..)<\/p><\/div>\n<p><span style=\"color: #99ccff;\"><em>(..) and Fake It Till You make it (..) wouldn\u2019t you?<\/em>\u00a0<\/span><\/p>\n<p>Right, so what\u2019s the rationale? Why did our beloved <em><span style=\"color: #00ffff;\"><strong>Wizards<\/strong><\/span><\/em>\u00a0 come up with these? Let\u2019s highlight the end-result possibilities first.<\/p>\n<p><strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET\u00a0<\/span><\/strong><span style=\"color: #ffffff;\"><strong>OS<\/strong><\/span> allows for multiple UI-based applications to be run simultaneously.<\/p>\n<p>One may click or touch through the UI just like if using a regular (i.e. centralized) Windows\/Linux and\/or Mac-OS X box.\u00a0\u00a0<strong><em>More!<\/em><\/strong>\u00a0One may access the system through a command-line based interface if he or <em>she\u00a0<\/em>\u00a0<em>feels <\/em>like doing so over SSH.<\/p>\n<p>One may keep using application A which queries the decentralized VM for data while application B affects the decentralized VM the very same moment as both apps remain fully responsive. In the background both apps can be communicating with the very same or multiple different full-nodes. The UI dApps do not even need to \u2018<em>think<\/em>\u2019 about the realm of network connections and other details, as it\u2019s all taken care of by the <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22ee\u00a0<\/span><span style=\"color: #ffffff;\">System<\/span><\/strong> (i.e. through what we call the <em><span style=\"color: #00ffff;\"><strong>VM Context<\/strong><\/span><\/em>, an almost(?) magical kind of a thing running right within of a web-browser).<\/p>\n<p>Now, gaining access, playing around, invoking commands and having a nice front-end UI might be <em>one thing<\/em>.<\/p>\n<p>Propagating changes to the decentralized network of computers is a <em>whole yet another <\/em>kind of a story.<\/p>\n<p>Talk about interactive code formulation while user(s) interact with the system, synchronizing ad-hoc execution of instructions at full-nodes, maintaining proper state across applications, ensuring state-boundaries (separate stacks), allowing for replication of code execution results across the decentralized network of nodes.<\/p>\n<p>Can bitcoin do this?\u00a0 Certainly not (..) Ethereum?\u00a0\u00a0<strong><em>No way.<\/em><\/strong><\/p>\n<div id=\"attachment_647\" style=\"width: 320px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-647\" class=\"wp-image-647\" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/stoneage.jpg\" alt=\"\" width=\"310\" height=\"310\" srcset=\"https:\/\/mag.gridnet.org\/wp-content\/uploads\/2021\/09\/stoneage.jpg 225w, https:\/\/mag.gridnet.org\/wp-content\/uploads\/2021\/09\/stoneage-150x150.jpg 150w, https:\/\/mag.gridnet.org\/wp-content\/uploads\/2021\/09\/stoneage-75x75.jpg 75w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\" \/><p id=\"caption-attachment-647\" class=\"wp-caption-text\">Presumably, nothings nowadays progress as fast as technology. These are the times when currently living people believe in the possibility of being immortal. Come in terms with that. We need to put our believes in technology, in progress and not to create yet another bitcoin-religion. People are now smart enough to respect supply rules alone.<\/p><\/div>\n<p>&nbsp;<\/p>\n<p><em><span style=\"color: #00ffff;\"><strong>Wizards&#8217;\u00a0<\/strong><\/span><\/em>\u00a0rant in 3..2..1: Yeah\u2026 we all used to put our hopes in Ethereum in years when it used to be marketed the most. (..) The decentralized computer of yours (..) as they used to put it (..) you know it (..) we\u2019ve all heard of it.<\/p>\n<p>Even though the expectations of the most of us were never met, at least Ethereum turned out to be <strong><em>a very usable product<\/em><\/strong>. It pushed the technology to whole new level. Maybe not as much as &#8216;bitcoin&#8217;. Yet again at least it was not a shill-scam-bubble like <em>IOTA<\/em> \ud83e\udd21 (Irresponsible Ones Taka Advantage, as its name suggests). \u00a0Folks such as those at IOTA are <em>dangerous<\/em> since they know their devious ways around the tech well enough to even trick some researchers (..) paying them for travel tickets to conferences, funding food and stuff\u2026 you know how it is. Everyone needs to eat(..) Anyways ~~ Watch out. That\u2019s what <em><span style=\"color: #00ffff;\"><strong>Wizards\u00a0<\/strong><\/span><\/em>\u00a0throw their \ud83e\udd5a at.<\/p>\n<p>Alright, let us now focus on the <span style=\"color: #00ffff;\"><em><strong>Decentralized Processing Threads<\/strong><\/em><\/span>, the subject we\u2019ve got at hand. How do these differ from their centralized corresponding representatives?<\/p>\n<div id=\"attachment_709\" style=\"width: 543px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-709\" class=\"wp-image-709 \" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/investors.gif\" alt=\"\" width=\"533\" height=\"279\" \/><p id=\"caption-attachment-709\" class=\"wp-caption-text\">(..) of yes Investors (..) you listen-up as well<\/p><\/div>\n<ul>\n<li>For starters, <span style=\"color: #00ffff;\"><em><strong>Decentralized Threads<\/strong><\/em><\/span> are <strong>so <em>much<\/em> slower<\/strong> than their centralized counterparts. All the thumb-rules of projects such as Ethereum apply here as well if code is to be replicated (it does not need to be).<\/li>\n<li>Yet! These <strong><em>can be<\/em><\/strong> so much more usable, <strong><em>interactive and agile<\/em><\/strong> than what you know from the Ethereum\u2019s realm! How? They can execute arbitrary code in Sandbox mode while an app is already running without necessarily affecting the decentralized state-machinery i.e. without replicating results across nodes. This allows to offset slow processing at full-nodes with very fast CPUs and GPUs available on users&#8217; local computers.<\/li>\n<li>In need of some agility? The code can be formulated while an UI dApps keeps running and authenticated at the end (..) by the end, compiled, put within the Code Package and replicated throughout the network.<\/li>\n<li>The system constantly keeps track of <em><span style=\"color: #00ffff;\"><strong>ERG<\/strong> <\/span><\/em>usage while to app keeps running in SandBox. And proposes an optimal value when changes are to be committed.<\/li>\n<li>This time, some of the operations are to be affecting the decentralized state machine. It\u2019s a <strong><em>decentralized<\/em><\/strong> <strong><em>operating system, <\/em><\/strong>remember?<\/li>\n<li>It\u2019s no more <em>only<\/em> about your local laptop or smartphone. Now things are different. The user-invoked operations, the instructions within the threads, they need to affect computers all over the planet. Not only your local device\u2019s volatile memory or storage.<\/li>\n<li>A thread executes <span style=\"color: #00ffff;\"><strong><em>#GridScript<\/em><\/strong><\/span> byte-code<\/li>\n<li>A thread can contain execute and return results of arbitrary code as needed.<\/li>\n<li>When it comes to code that is to be committed though, it is to contain <strong><em>only <\/em><\/strong>instructions that are to affect the decentralized state machine. There is no need for a decentralized thread to contain code responsible for animations, for things that are irrelevant to the decentralized consensus.<\/li>\n<li>Execution of each instruction entails cost. That is very similar to Gas known from the Ethereum\u2019s realm. Even still, each client is granted a welcoming bonus Erg once he or she connects. The bonus amount can be used only in SandBox mode and cannot be used for code-replication.<\/li>\n<li>A decentralized processing thread can be spawned on any node maintaining the decentralized <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET\u00a0<span style=\"color: #ffffff;\">OS<\/span>\u00a0<\/span><\/strong>\u00a0state machine and accessed remotely.<\/li>\n<li>A single UI session can be taking use of multiple threads at multiple nodes within the network, i.e. each UI app on same remote desktop session, within same UI session, can be spawned on a different computer around the world. One Terminal UI dApp can be running on a computer located in New York while another in Shanghai. These instances can be interacting with each other through Onion-Routed connectivity.<\/li>\n<li>A single UI dApp can request multiple threads from multiple computers around the world<\/li>\n<li>Every user session (remote UI session or Terminal) has at least a single thread\u2013the System Thread.<\/li>\n<li>Every other thread is an offspring of the System Thread.<\/li>\n<li>The System Thread manages the lifetime of all of its sub-threads.<\/li>\n<li>Decentralized Processing Threads can be (<strong><em>committed<\/em><\/strong>\u00a0) either separately or in bulk.<\/li>\n<li>Even though threads can be spawned at multiple computers around the world, they can be also synchronized and committed together all at once.<\/li>\n<li>A thread can be marked as \u2018committable\u2019 anytime.<\/li>\n<li>Commitment of the System-Thread causes all of its sub-threads to be committed as well.<\/li>\n<li>When a thread is committed, all the instructions located within it are compiled on the fly into a byte-code and put within a single <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22ee<\/span><\/strong><span style=\"color: #00ffff;\"><strong><em>Code Package<\/em><\/strong><\/span>, which is broadcast throughout the network.<\/li>\n<li>Threads can be shared (if not marked as private) and indeed threads can have multiple flags. Such nuances are beyond the scope of this article.<\/li>\n<li>Threads can be committable or not. A non-committable thread may be useful when only a sandbox execution of commands is desired. It\u2019s important to let the system know about the nature of a thread to prevent it from undertaking some automated measures upon it. <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET\u00a0<span style=\"color: #ffffff;\">OS<\/span><\/span><\/strong>\u00a0is a lot about the end-user\u2019s experience, thus we\u2019ve given users the power to invoke various operations (like having all applications committed) with a single key-press. For the OS to handle threads properly, it needs to know what it\u2019s dealing with.<\/li>\n<li>A thread may be a read-only thread. <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET\u00a0<span style=\"color: #ffffff;\">OS<\/span>\u00a0<\/span><\/strong>allows access to such a thread even if a commitment operation is pending.<\/li>\n<\/ul>\n<p>Above we\u2019ve tackled a few key-concepts, we\u2019ll now go through one by one<\/p>\n<h1 style=\"text-align: center;\"><span style=\"color: #00ffff;\"><strong>Programmer vs User<\/strong><\/span><\/h1>\n<p>Programs written for <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET\u00a0<\/span><\/strong><span style=\"color: #ffffff;\"><strong>OS<\/strong><\/span> are a mixture of both JavaScript, CSS and <span style=\"color: #00ffff;\"><strong>#GridScript<\/strong><\/span>. The latter is (to large extent) backwards compatible with Forth. It executes on full-nodes while JavaScript code runs within web-browsers. All the user-mode functionalities are made available for in-web-browser applications through what is known as a <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET\u00a0<\/span><span style=\"color: #ffffff;\">OS<\/span><\/strong>\u2019 <span style=\"color: #33cccc;\"><strong>VM Context<\/strong><\/span>. The JavaScript-based VM Context is part of the operating system and is involved in magnitude of things.<\/p>\n<ul>\n<li>Networking (onion routing across full-nodes, mobile devices, data routing across web-browsers, participates in signalling across all of these).<\/li>\n<li>Session management. The <strong><span style=\"color: #33cccc;\">VM Context<\/span><\/strong> itself is deemed as <strong><em>not trusted<\/em><\/strong> from the perspective of both full-nodes and <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET\u00a0<\/span><\/strong>Token mobile apps. With that said, it still has the power of ruling and synchronizing applications running within a single user-mode session. The <span style=\"color: #33cccc;\"><strong>VM Context<\/strong><\/span> acts as an intermediary between user-mode UI elements and the kernel-mode eco-system. The decentralized consensus is deemed to be part of kernel mode operandi. Below you may see a simplifies infographics showcasing allowing to grasp differences between <span style=\"color: #33cccc;\"><strong>User Mode<\/strong><\/span> and <span style=\"color: #00ffff;\"><strong>Kernel Mode<\/strong><\/span>.<\/li>\n<li>Ad-hoc, in-the-background code formulation. This occurs for instance when user performs some UI-related actions that are to affect the decentralized state-machine, like drag-and dropping a file onto a GRIDNET-OS file manager UI dApp , from the host, centralized operating system.<\/li>\n<\/ul>\n<div id=\"attachment_650\" style=\"width: 511px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-650\" class=\"zoooom wp-image-650\" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/kernelmode.png\" alt=\"\" width=\"501\" height=\"306\" \/><p id=\"caption-attachment-650\" class=\"wp-caption-text\">Extrinsics vs <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET\u00a0<span style=\"color: #ffffff;\">OS<\/span><\/span><\/strong>&#8216; User Mode and Kernel Mode<\/p><\/div>\n<p style=\"text-indent: 36.0pt;\"><span style=\"font-family: 'Arial',sans-serif;\">The infographics herein are by no means complete and only touch upon vast topics and APIs pending additional documentation. User Mode API is easy to use. It was designed to allow JavaScript developers to get things done nice and easy. New thread? Sure! Willing to deliver a notification to the user\u2019s mobile app? Onion routed? Not knowing its address, not knowing through whom to deliver? No problem at all ~ just tell it what\u2019s to be delivered and the <span style=\"color: #00ffff;\"><strong>VM Context<\/strong> <\/span>would use the data it stored during session-negotiation while the user logged on by scanning the Log-Me-In QR Code. The kernel mode APIs are much more sophisticated and unavailable to User-Mode applications, by default.<\/span><\/p>\n<div id=\"attachment_652\" style=\"width: 328px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-652\" class=\"wp-image-652\" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/uservsprog.png\" alt=\"\" width=\"318\" height=\"538\" \/><p id=\"caption-attachment-652\" class=\"wp-caption-text\">That doesn&#8217;t mean that <em><span style=\"color: #00ffff;\"><strong>Wizards\u00a0<\/strong><\/span><\/em>do not eat ;d<\/p><\/div>\n<p>The <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET\u00a0<span style=\"color: #ffffff;\">OS<\/span>\u00a0<\/span><\/strong>terminal is actually a <span style=\"color: #00ffff;\"><strong><em>#GridScript<\/em><\/strong><\/span> interpreter. Thus, whenever issuing commands to the console you might already feel like a programmer.\u00a0 From now on the terms of user and programmer will be used interchangeably. And indeed, the language has been designed to accommodate its usage as a command-line user interface and to facilitate ad hoc representation of actions performed within the UI so that the resulting in-code representations of these could be broadcast across the network and affect the decentralized state machine.<\/p>\n<h1 style=\"text-align: center;\"><span style=\"color: #00ffff;\"><strong>The System-Thread vs Sub-Threads<\/strong><\/span><\/h1>\n<p><span style=\"font-family: 'Arial',sans-serif;\">Once user establishes a session with any of the available full-nodes, the node spawns a single instance of a <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET\u00a0<span style=\"color: #ffffff;\">OS<\/span><\/span><\/strong><span style=\"color: #ffffff;\"><strong>\u2019 VM<\/strong><\/span> sandbox environment, encapsulating at least a single decentralized thread\u2013the System Thread. <\/span><\/p>\n<p><span style=\"font-family: 'Arial',sans-serif;\">Programmer\/user may spawn a new thread anytime by issuing the Start Thread (\u2018st\u2019) command from the <span style=\"color: #00ffff;\"><strong>#GridScript<\/strong> <\/span>interpreter. When dealing with the <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET\u00a0<span style=\"color: #ffffff;\">OS<\/span><\/span><\/strong>\u00a0JavaScript context (available to UI dApps running from within of a web-browser), a new thread can also be requested\u00a0 by invoking its createThread() sub-routine. The VM-Context would automatically choose the most suitable node and attempt to use its resources for the purposes of spawning a new thread. Under the hood, the initial full-node, the one handling the connection itself, is always aware of every sub-thread. What are the implications? The system-thread has the ability to affect any of its sub-threads by executing <em><span style=\"color: #00ffff;\"><strong>#GridScript<\/strong><\/span><\/em> instructions directly from within.<\/span><\/p>\n<h1 style=\"text-align: center;\"><span style=\"color: #00ffff;\"><strong>The concept of Transactions and Code Packages<\/strong><\/span><\/h1>\n<div id=\"attachment_653\" style=\"width: 709px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-653\" class=\"wp-image-653 \" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/bitcoinstoneage.jpg\" alt=\"\" width=\"699\" height=\"249\" \/><p id=\"caption-attachment-653\" class=\"wp-caption-text\">Believe it or not, little bit over 10 years ago decentralized &#8216;transactions&#8217; were only about decrementing value A while incrementing B by the same amount equal to C. That is what Bitcoin used to be about \ud83d\udc7b<\/p><\/div>\n<p style=\"text-indent: 18.0pt;\"><span style=\"font-family: 'Arial',sans-serif;\">Some of you might be aware of the nomenclature of transactions from the database-realm. Here, the concept and mechanics are similar.<\/span><\/p>\n<p style=\"text-indent: 18.0pt;\"><span style=\"font-family: 'Arial',sans-serif;\"> In <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET\u00a0<span style=\"color: #ffffff;\">OS<\/span><\/span><\/strong>, \u2018transactions\u2019 have little to do with their simplistic counterparts known from the bitcoin\u2019s realm. It is way more suitable to think in terms of committable <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22ee<\/span><\/strong><span style=\"color: #00ffff;\"><strong><i>Code Packages<\/i><\/strong><\/span>. Single code package may contain byte-code resulting from compilation of multiple threads living at various nodes. It is thus the <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET\u00a0<\/span><span style=\"color: #ffffff;\">Operating System<\/span><\/strong> assuring that the boundaries between the threads are maintained at all times, and whether the particular threads should be compiled, committed and thus broadcast across the network.<\/span><\/p>\n<h1 style=\"text-indent: 18pt; text-align: center;\"><span style=\"color: #00ffff;\"><strong>Commitment of Threads<\/strong><\/span><\/h1>\n<p style=\"text-indent: 18.0pt;\"><span style=\"font-family: 'Arial',sans-serif;\">The <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22ee<\/span><\/strong><span style=\"color: #00ffff;\"><strong><i>System Thread<\/i><\/strong> <\/span>is always aware of all of its sub-threads. When committing threads in bulk it would be the system-thread performing synchronization across all the sub-threads, compiling source codes coming from within of each and committing i.e. broadcasting the resulting<span style=\"color: #00ffff;\"> <strong>\u22ee\u22ee\u22ee<\/strong><strong><i>Code Package<\/i><\/strong><\/span> for consideration across the network. Threads and processes can be listed anytime by issuing the Linux-compatible \u2018ps\u2019 command. Processes can be killed by using the \u2018kill\u2019 user-mode command.<\/span><\/p>\n<p>Let us now take a look at the Terminal UI dApp below.<\/p>\n<div id=\"attachment_658\" style=\"width: 1495px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-658\" class=\"wp-image-658\" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/threadUI1.jpg\" alt=\"\" width=\"1485\" height=\"612\" \/><p id=\"caption-attachment-658\" class=\"wp-caption-text\">Multiple Threads for same UI session and same UI dApp. Each instance of the Terminal UI dApp has access to a private Thread.<\/p><\/div>\n<p>Back when each of the above UI Terminal dApps was launched, each had requested a brand new decentralized processing thread for the purposes of executing commands input by the user. That was achieved by querying an appropriate method of the\u00a0\u00a0\u00a0<strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22ee<\/span><span style=\"color: #00ffff;\">VM Context.<\/span><\/strong><\/p>\n<p>Above, at the upper corner, a mouse-hovered <span style=\"color: #00ffff;\"><strong>\u22ee\u22ee\u22ee<\/strong>Magic Button<\/span> can be seen. Once, hovered, the <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22ee<\/span><\/strong><span style=\"color: #00ffff;\">Magic Button<\/span> displays the currently pending actions.<\/p>\n<p>What does it mean for an action to be pending? That it is yet to affect the decentralized consensus. Currently it shows two applications awaiting to be <em>committed<\/em>.<\/p>\n<p>Notice packages\u2019 names and processes\u2019 IDs next to actions&#8217; descriptions. All it now takes, is for the user to either click or tap the <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22ee<\/span><\/strong><span style=\"color: #00ffff;\"><strong><em>Magic Button<\/em><\/strong><\/span>.<\/p>\n<p>Once clicked, the <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22ee<\/span><span style=\"color: #00ffff;\">VM Context<\/span>\u00a0<\/strong>(running within a web-browser) would instruct the <strong><span style=\"color: #00ffff;\">System Thread<\/span><\/strong>\u00a0(running at a full-node) to collect source-codes from all of its sub-threads.That would include threads owned by both of the above UI dApps.<\/p>\n<p>In the background that would be happening by having the<span style=\"color: #00ffff;\">\u00a0<\/span><strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeVM Context<\/span>\u00a0<\/strong>formulate an appropriate BER-encoded VM-Meta-Data processing request, one containing autonomously formulated #GridScript commands, causing the system thread to initiate the <em><strong>code-commit manoeuvre<\/strong>, once executed<\/em><\/p>\n<p>Note that in the background this might be happening over computers located at different parts of the world.\u00a0 Once all the intermediary source-codes, from the corresponding sub-threads have been fetched, the system thread would then compile these, doing some pre-processing assuring proper execution contexts (stack-frames-related), put the resulting byte-code into a single\u00a0<strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22ee<\/span><span style=\"color: #00ffff;\">Code Package<\/span><\/strong> and (..) instruct the <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22ee<\/span><span style=\"color: #00ffff;\">VM Context<\/span>\u00a0<\/strong> running within the user&#8217;s web-browser to display a QR-Code requesting a signature form the user.<\/p>\n<p>A nicely animated <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeQR Intent\u00a0<\/span><\/strong>would be shown full-screen, to be scanned by the <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeGRIDNET<\/span>\u00a0<span style=\"color: #ffffff;\">Token<\/span><\/strong> mobile app.<\/p>\n<p>It&#8217;s not the end of the story. The mobile app would be handed the resulting code package, decompile it and generate a meta-data description of things that are to be performed in the name of the user. Upon the user&#8217;s consent (after using the Virtual Fingerprint sensor), the private key stored by the mobile app would be used to generate an elliptic curve signature which would be onion-routed to the full-node at which the System-Thread currently resides.<\/p>\n<p>The system thread would keep notifying both the Web-UI and the mobile app upon the status of processing. If everything looks fine, the<strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22ee<\/span><span style=\"color: #00ffff;\">Code Package<\/span><\/strong>\u00a0 would be broadcast across the network. In fact, the process is much more complicated than that, you may look at the infographics below to gain a more vivid higher-level overview.<\/p>\n<p>The below is what occurs from the perspective of the overall operating system. (yes you get to use the magical magnifier yet again!)<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_660\" style=\"width: 327px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-660\" class=\"wp-image-660 zoooom\" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/perspective1.png\" alt=\"\" width=\"317\" height=\"145\" \/><p id=\"caption-attachment-660\" class=\"wp-caption-text\">Top level overview on the Threads&#8217; commit process.<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>On the other hand, the<span style=\"color: #00ffff;\"><strong> UML diagram<\/strong> <\/span>below illustrates how the process looks like from the perspective of an UI dApp.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_661\" style=\"width: 268px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-661\" class=\" zoooom wp-image-661\" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/diagram2.png\" alt=\"\" width=\"258\" height=\"536\" \/><p id=\"caption-attachment-661\" class=\"wp-caption-text\">Decentralized Threads from the perspective of an UI dApp.<\/p><\/div>\n<p>As you may see above the key thing is assuring synchronization. We don\u2019t want threads committed when not ready (ex. during unfinished partial code formulation etc).<\/p>\n<p>From the perspective of an UI dApp, performing commits can be either:<\/p>\n<ul>\n<li><strong><span style=\"color: #00ffff;\">App invoked<\/span> <\/strong>\u2013 that\u2019s when the app wants to have code committed to the decentralized state-machine<\/li>\n<li><span style=\"color: #00ffff;\"><strong>User invoked<\/strong> <\/span>\u2013 user may trigger commitment of a thread, but first the thread needs to be marked as committable in the first place. Marking thread as committable is achieved by executing the Thread-Ready command on the particular thread. Note that this can be tested and seen by running the Terminal UI dApp and executing the \u2018rt\u2019 command by hand as seen below:<\/li>\n<\/ul>\n<div id=\"attachment_662\" style=\"width: 1476px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-662\" class=\"wp-image-662 size-full\" src=\"https:\/\/gridnet.org\/wpp\/wp-content\/uploads\/2021\/09\/threadUI2.jpg\" alt=\"\" width=\"1466\" height=\"431\" \/><p id=\"caption-attachment-662\" class=\"wp-caption-text\">Threads being marked as committable.<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>Once a tread is marked as committable, the system may commit it anytime. This might be either system-invoked or user-invoked. A sample case of a user invoked global commit would be user tapping the <strong><span style=\"color: #00ffff;\">\u22ee\u22ee\u22eeMagic Button<\/span><\/strong>, which by default commits all of the sub-threads attached to the <span style=\"color: #00ffff;\"><strong>\u22ee\u22ee\u22eeSystem Thread<\/strong><\/span> i.e. all of its off springs.<\/p>\n<p>&nbsp;<\/p>\n<p>That&#8217;s it for now fellas! Keep in mind that as complicated as it all might look, lots of details (including architectural ones) were omitted. Certainly data-routing would be such a thing. We&#8217;ve implemented very sophisticated onion-routing apparatus to allow for the above to be happening (ex. targeting specific Threads located of separate nodes). That&#8217;s a topic which deserves an article of its own . Stay tuned for more soon, we&#8217;re polishing the UI\/Decentralized Thread mechanics and soon you&#8217;ll be able to take the entire Web-UI for a ride yourself!<\/p>\n<p>Should you have questions of any sort, shoot right away (..) Twitter, Discords, wizards@gridnet.org ~~that&#8217;s where we&#8217;re at.<\/p>\n<p>More on the way!<\/p>\n<p>~~Forever Yours<\/p>\n<p><em><span style=\"color: #00ffff;\"><strong>Wizards<\/strong><\/span><\/em>\ud83e\uddd9 \ud83e\uddd9\u200d\u2640\ufe0f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Disclaimer: This article is not a scientific one. Still, it targets both IT folks and regular crypto-aficionados alike through a playful mixture&#8230;<\/p>\n","protected":false},"author":1,"featured_media":669,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,9,10,8,13,1],"tags":[],"class_list":["post-619","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-core","category-general","category-os-news","category-news","category-opinions","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/mag.gridnet.org\/index.php\/wp-json\/wp\/v2\/posts\/619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mag.gridnet.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mag.gridnet.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mag.gridnet.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mag.gridnet.org\/index.php\/wp-json\/wp\/v2\/comments?post=619"}],"version-history":[{"count":79,"href":"https:\/\/mag.gridnet.org\/index.php\/wp-json\/wp\/v2\/posts\/619\/revisions"}],"predecessor-version":[{"id":4805,"href":"https:\/\/mag.gridnet.org\/index.php\/wp-json\/wp\/v2\/posts\/619\/revisions\/4805"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mag.gridnet.org\/index.php\/wp-json\/wp\/v2\/media\/669"}],"wp:attachment":[{"href":"https:\/\/mag.gridnet.org\/index.php\/wp-json\/wp\/v2\/media?parent=619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mag.gridnet.org\/index.php\/wp-json\/wp\/v2\/categories?post=619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mag.gridnet.org\/index.php\/wp-json\/wp\/v2\/tags?post=619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}