<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Layman's Guide to Computing - Season 12</title><link href="https://ngjunsiang.github.io/laymansguide/" rel="alternate"></link><link href="https://ngjunsiang.github.io/laymansguide/feeds/season-12.atom.xml" rel="self"></link><id>https://ngjunsiang.github.io/laymansguide/</id><updated>2022-01-22T08:00:00+08:00</updated><entry><title>Issue 156: Translation</title><link href="https://ngjunsiang.github.io/laymansguide/issue156.html" rel="alternate"></link><published>2022-01-22T08:00:00+08:00</published><updated>2022-01-22T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-01-22:/laymansguide/issue156.html</id><summary type="html">&lt;p&gt;To speed up execution and avoid translation overhead, some systems employ ahead-of-time translation, storing the translated instructions to be executed in future. But many systems employ a mix of just-in-time (&lt;span class="caps"&gt;JIT&lt;/span&gt;) and ahead-of-time (&lt;span class="caps"&gt;AOT&lt;/span&gt;)&amp;nbsp;techniques.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Translating a set of instructions before executing it will always lead to a slowdown, although sometimes this may not be noticeable to&amp;nbsp;users.&lt;/p&gt;
&lt;p&gt;So, just-in-time (&lt;span class="caps"&gt;JIT&lt;/span&gt;) compilation is really cool and mostly works. Feed in enough instructions to fill a buffer, and execute them. Keep your fingers crossed and hope the buffer doesn’t empty. That’s kind of how our global supply chain works&amp;nbsp;too.&lt;/p&gt;
&lt;p&gt;But sometimes it doesn’t go smoothly. The program hits a code branch, new instructions have to be unpredictably injected. The emulation layer halts temporarily. The program&amp;nbsp;stutters.&lt;/p&gt;
&lt;p&gt;We can’t really avoid that, not without rewriting the program anyway. But we can at least decide &lt;em&gt;when&lt;/em&gt; to carry out the&amp;nbsp;translation.&lt;/p&gt;
&lt;h2&gt;Ahead-of-time&amp;nbsp;translation&lt;/h2&gt;
&lt;p&gt;What if we translated whatever we could ahead of time, and stored the &lt;em&gt;native&lt;/em&gt; instructions? Then, whenever we need that chunk, instead of translating the original program chunk, we just load the already-translated&amp;nbsp;instructions?&lt;/p&gt;
&lt;p&gt;This is called ahead-of-time (&lt;span class="caps"&gt;AOT&lt;/span&gt;) translation, and is what Apple Rosetta 2 does with MacOS programs compiled for Intel x86-64. While installing those applications, it also carries out translation into native &lt;span class="caps"&gt;ARM&lt;/span&gt; instructions that the M1 later uses for&amp;nbsp;execution.&lt;/p&gt;
&lt;h2&gt;Android &lt;span class="caps"&gt;AOT&lt;/span&gt;&amp;nbsp;translation&lt;/h2&gt;
&lt;p&gt;The Java virtual machine (&lt;span class="caps"&gt;VM&lt;/span&gt;), also called the Java Runtime (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue151.html"&gt;Issue 151&lt;/a&gt;)), is the interpreter that carries out the Java bytecode that a Java program&amp;nbsp;comprises.&lt;/p&gt;
&lt;p&gt;Android apps, though themselves Java programs, are run not by the Java Runtime, but by the Android Runtime&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;Whenever your Android phone finishes installing an Android update, there is always a significant block of time that it takes up “optimising” your apps. What it is doing is actually &lt;span class="caps"&gt;AOT&lt;/span&gt; translation, of the app’s Java bytecode into &lt;span class="caps"&gt;ARM&lt;/span&gt;&amp;nbsp;instructions.&lt;/p&gt;
&lt;h2&gt;Compilers vs&amp;nbsp;interpreters&lt;/h2&gt;
&lt;p&gt;Back in &lt;a href="https://ngjunsiang.github.io/laymansguide/issue054.html"&gt;Issue 54&lt;/a&gt;), I mentioned in a footnote&amp;nbsp;that&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Purists will argue with me that Python technically runs through an interpreter, not a compiler. At this point, the distinction between the two terms for layfolks is not critical, and I choose clarity over accuracy at this point until I can delve into more detail in a future&amp;nbsp;issue.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here is where I can draw the distinction more&amp;nbsp;clearly.&lt;/p&gt;
&lt;p&gt;A &lt;strong&gt;compiler&lt;/strong&gt; &lt;em&gt;compiles&lt;/em&gt; a programming language into another language; usually this means translating a programming language into machine instructions, or virtual machine (&lt;span class="caps"&gt;VM&lt;/span&gt;) bytecode (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue150.html"&gt;Issue 150&lt;/a&gt;)). But it is also not unheard of for compilers to translate one programming language into another, e.g. translating to Javascript for use in a&amp;nbsp;webpage.&lt;/p&gt;
&lt;p&gt;An &lt;strong&gt;interpreter&lt;/strong&gt; &lt;em&gt;interprets&lt;/em&gt; a programming language, and executes it to bring about the intended effect (creating/changing/deleting a file, producing a sound, displaying an image,&amp;nbsp;…).&lt;/p&gt;
&lt;p&gt;It may be helpful to think of a compiler as carrying out &lt;span class="caps"&gt;AOT&lt;/span&gt; translation, and an interpreter as carrying out &lt;span class="caps"&gt;JIT&lt;/span&gt; translation. But many systems will use a mix of both. The Python interpreter, for instance, actually translates Python code into intermediate Python bytecode, and then executes the bytecode. When you run the same Python script, it executes the bytecode if the Python code has not changed. If it has changed, the interpreter will recompile the bytecode first, then execute&amp;nbsp;it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; To speed up execution and avoid translation overhead, some systems employ ahead-of-time translation, storing the translated instructions to be executed in future. But many systems employ a mix of just-in-time (&lt;span class="caps"&gt;JIT&lt;/span&gt;) and ahead-of-time (&lt;span class="caps"&gt;AOT&lt;/span&gt;)&amp;nbsp;techniques.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S13] Issue 157: &lt;span class="caps"&gt;NTP&lt;/span&gt; and&amp;nbsp;time-syncing&lt;/p&gt;
&lt;p&gt;In the season finale, I’ll wrap up with a mishmash of things that are &lt;em&gt;not&lt;/em&gt; the Internet per-se, but very much a part of the Internet and our lives. First up: how do our phones always know the &lt;em&gt;actual&lt;/em&gt;&amp;nbsp;time?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;Recall from &lt;a href="https://ngjunsiang.github.io/laymansguide/issue151.html"&gt;Issue 151&lt;/a&gt;) that one needs a distribution license to distribute the Java runtime environment (&lt;span class="caps"&gt;JRE&lt;/span&gt;); Google would have to pay hefty licensing fees to Oracle to bundle the &lt;span class="caps"&gt;JRE&lt;/span&gt; with each copy of Android. Instead, they decided to write their own compatible runtime: the Android Runtime. Is this legal? They already fought that battle in court (&lt;a href="https://en.wikipedia.org/wiki/Google_LLC_v._Oracle_America,_Inc."&gt;Google &lt;span class="caps"&gt;LLC&lt;/span&gt; v. Oracle America, Inc&lt;/a&gt;), and it seems the answer is “yes” (with a heap of caveats).&amp;#160;&lt;a class="footnote-backref" href="#fnref:1" title="Jump back to footnote 1 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><category term="Season 12"></category></entry><entry><title>Issue 155: Emulation performance</title><link href="https://ngjunsiang.github.io/laymansguide/issue155.html" rel="alternate"></link><published>2022-01-15T08:00:00+08:00</published><updated>2022-01-15T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-01-15:/laymansguide/issue155.html</id><summary type="html">&lt;p&gt;Translating a set of instructions before executing it will always lead to a slowdown, although sometimes this may not be noticeable to&amp;nbsp;users.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Programs that were not compiled for the instruction set of the host &lt;span class="caps"&gt;OS&lt;/span&gt; have to go through an emulation layer program. This program translates the instructions of that program into compatible instructions that its own processor can&amp;nbsp;execute.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The Apple M1 is an &lt;span class="caps"&gt;ARM&lt;/span&gt; processor that executes 64-bit &lt;span class="caps"&gt;ARM&lt;/span&gt; instructions. MacOS programs that were compiled for Intel 64-bit x86-64 processors go through the Apple Rosetta 2 emulation layer to run on the&amp;nbsp;M1.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Yes, that’s what I said last issue. But if that were all the Apple Rosetta 2 emulation layer did, The M1 Macbook would not have gotten its rave&amp;nbsp;reviews.&lt;/p&gt;
&lt;h2&gt;The act of&amp;nbsp;translation&lt;/h2&gt;
&lt;p&gt;Think about it: the &lt;span class="caps"&gt;ARM&lt;/span&gt; and x86-64 instruction sets are very different! They have different lengths, different instruction names and bit values, different concepts of operation, … they’re &lt;em&gt;very&lt;/em&gt; different. While the Intel Core and &lt;span class="caps"&gt;ARM&lt;/span&gt; processor architectures share &lt;em&gt;some&lt;/em&gt; similarities, translating instructions from one set to another, though possible, is still no simple&amp;nbsp;feat.&lt;/p&gt;
&lt;p&gt;Keep in mind that in addition to translating the x86-64 instructions to &lt;span class="caps"&gt;ARM&lt;/span&gt;, the M1 also has to &lt;em&gt;execute them&lt;/em&gt;—the program must go on. It should not be surprising at all that there is a performance hit compared with executing native &lt;span class="caps"&gt;ARM&lt;/span&gt;&amp;nbsp;instructions.&lt;/p&gt;
&lt;p&gt;If you were given a set of execution instructions in your native language, you would have little difficulty carrying out the required task. But if the execution instructions are now in alien language? Suppose you were given translation instructions, in your native language, for understanding the alien language. You would definitely be doing it slower than if the execution instructions were in your native&amp;nbsp;language.&lt;/p&gt;
&lt;h2&gt;Just-in-time&amp;nbsp;translation&lt;/h2&gt;
&lt;p&gt;These days, our processors are fast enough that if they are not too bogged down, they can actually read in instructions slightly ahead of time, translate them, and store the translated instructions for a short period of time before they are executed. This way, the operating system remains ever so slightly ahead of the program being translated, in a way reminiscent of our currently strained global supply&amp;nbsp;chain.&lt;/p&gt;
&lt;p&gt;Naturally, it doesn’t make sense to keep doing translation work. As much as possible, we want to minimise it! But&amp;nbsp;how?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Translating a set of instructions before executing it will always lead to a slowdown, although sometimes this may not be noticeable to&amp;nbsp;users.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S12] Issue 156:&amp;nbsp;Translation&lt;/p&gt;
&lt;p&gt;In the last issue of season 12, we talk about why app installation or system updates can take so&amp;nbsp;long.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 12"></category></entry><entry><title>Issue 154: Emulation</title><link href="https://ngjunsiang.github.io/laymansguide/issue154.html" rel="alternate"></link><published>2022-01-08T08:00:00+08:00</published><updated>2022-01-08T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-01-08:/laymansguide/issue154.html</id><summary type="html">&lt;p&gt;Programs that were not compiled for the instruction set of the host &lt;span class="caps"&gt;OS&lt;/span&gt; have to go through an emulation layer program. This program translates the instructions of that program into compatible instructions that its own processor can&amp;nbsp;execute.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; The cloud offers standard digital business services, accessible through a web interface and &lt;span class="caps"&gt;API&lt;/span&gt;, which any developer (with a credit card) can use. Developers don’t have to reinvent the wheel, so long as they know how to use web&amp;nbsp;APIs.&lt;/p&gt;
&lt;p&gt;Virtualisation, particularly system virtualization, is a real game-changer for those of us who like to have our apps all running in the same operating system, instead of switching operating systems all the time through dual-booting (or Apple&amp;nbsp;Parallels).&lt;/p&gt;
&lt;p&gt;But what is stopping us from allowing them to run near-natively in the desktop, their windows directly showing up in the taskbar, without the distracting abstraction of the virtual&amp;nbsp;machine?&lt;/p&gt;
&lt;h2&gt;Introduction to&amp;nbsp;Emulation&lt;/h2&gt;
&lt;p&gt;What you are seeking is a feature known as &lt;strong&gt;emulation&lt;/strong&gt;, in which your operating system (&lt;span class="caps"&gt;OS&lt;/span&gt;), which we shall again call the &lt;strong&gt;host&lt;/strong&gt;, &lt;em&gt;emulates&lt;/em&gt; the instruction set (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue053.html"&gt;Issue 53&lt;/a&gt;)) that the application is compiled for. In other words, the host &lt;span class="caps"&gt;OS&lt;/span&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;presents itself as the “correct” machine type to the application (“hello program, I listen to x86 instructions and respond to x86 instructions, so please treat me like an x86&amp;nbsp;processor”),&lt;/li&gt;
&lt;li&gt;transparently interprets its machine code into its instruction set’s machine code (through a program called an &lt;strong&gt;emulation layer&lt;/strong&gt;),&lt;/li&gt;
&lt;li&gt;executes the interpreted version, producing its intended effects, and returning any intended output back to the&amp;nbsp;application.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Depending on how different the two instruction sets are, the complexity of this task differs greatly. Not much point going into detail here in a layman’s newsletter, so instead I’ll briefly illustrate some instances of emulation in the&amp;nbsp;wild.&lt;/p&gt;
&lt;p&gt;The three main instruction sets discussed here are x86 (32-bit), x86-64 (64-bit), and &lt;span class="caps"&gt;ARM&lt;/span&gt;&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt; (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue053.html"&gt;Issue 53&lt;/a&gt;)).&lt;/p&gt;
&lt;h2&gt;Windows-to-Windows emulation (&lt;span class="caps"&gt;WOW64&lt;/span&gt;)&lt;/h2&gt;
&lt;p&gt;Do you remember the great 32-to-64-bit schism of the late 2000s (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue055.html"&gt;Issue 55&lt;/a&gt;))? There was a period of time when people got confused whether a Windows program they had could run on a 32-bit x86 processor or a 64-bit x86-64 processor: programs compiled for the latter could not run on the former, but programs compiled for the former could run on the&amp;nbsp;latter.&lt;/p&gt;
&lt;p&gt;&lt;img alt="screenshot of download options for WinRAR, showing 32-bit and 64-bit options" src="https://ngjunsiang.github.io/laymansguide/issue154_01.png" /&gt;&lt;br /&gt;
&lt;em&gt;Some download sites still ask you to make this choice between downloading the 32-bit or 64-bit version, usually for users who for whatever reason have opted not to upgrade to 64-bit&amp;nbsp;processors.&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;That was a lie. Programs compiled for Windows on x86 cannot run &lt;em&gt;natively&lt;/em&gt; on x86-64, and vice-versa. x86 and x86-64, while looking similar, are different instruction sets. x86 instructions have to be translated into x86-64 instructions to run on a 64-bit&amp;nbsp;processor.&lt;/p&gt;
&lt;p&gt;What happened was Microsoft developed the &lt;span class="caps"&gt;WOW64&lt;/span&gt; subsystem, an emulation layer that translated 32-bit x86 instructions into 64-bit x86-64 instructions. When users tried to run a 32-bit application, Windows plugged the instruction stream into &lt;span class="caps"&gt;WOW64&lt;/span&gt;, executing the interpreted instructions and allowing it to run near-natively&lt;sup id="fnref:2"&gt;&lt;a class="footnote-ref" href="#fn:2"&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;And so the 32-to-64-bit transition took place more smoothly than it would otherwise&amp;nbsp;have.&lt;/p&gt;
&lt;h2&gt;Windows &lt;span class="caps"&gt;ARM&lt;/span&gt; emulation for&amp;nbsp;x86&lt;/h2&gt;
&lt;p&gt;In 2019, Microsoft released the Surface Pro X, its second&lt;sup id="fnref:3"&gt;&lt;a class="footnote-ref" href="#fn:3"&gt;3&lt;/a&gt;&lt;/sup&gt; &lt;span class="caps"&gt;ARM&lt;/span&gt;-powered laptop. That’s right, it’s Windows not running on an Intel chip. Microsoft does actually have a version of Windows, called Windows &lt;span class="caps"&gt;ARM&lt;/span&gt;, which runs on &lt;span class="caps"&gt;ARM&lt;/span&gt; chips. But what about all the programs you know and&amp;nbsp;love?&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;WOW64&lt;/span&gt; to the rescue again! This emulation layer &lt;em&gt;also&lt;/em&gt; translates 64-bit x86-64 instructions to 64-bit &lt;span class="caps"&gt;ARM&lt;/span&gt; instructions, allowing them to run on Windows &lt;span class="caps"&gt;ARM&lt;/span&gt; (with a performance penalty due to the translation&amp;nbsp;required).&lt;/p&gt;
&lt;h2&gt;Game console&amp;nbsp;emulation&lt;/h2&gt;
&lt;p&gt;If you find any “reborn” retro gaming products floating around, these are guaranteed to be emulators in disguise: the original hardware that the consoles used are no longer in production. (If you don’t find any, you can also just google “console emulation” to find a whole collection of&amp;nbsp;them.)&lt;/p&gt;
&lt;p&gt;These emulators are usually hobby projects by skilled amateurs, who attempt to reverse-engineer the workings of the original hardware. They then write programs to &lt;em&gt;emulate&lt;/em&gt; these processors on modern hardware, allowing you to “boot” a digital copy of the games that worked on those&amp;nbsp;platforms.&lt;/p&gt;
&lt;h2&gt;Apple&amp;nbsp;Rosetta&lt;/h2&gt;
&lt;p&gt;The Apple M1 is an &lt;span class="caps"&gt;ARM&lt;/span&gt; processor that executes 64-bit &lt;span class="caps"&gt;ARM&lt;/span&gt; instructions. MacOS programs compiled for Intel 64-bit x86-64 processors must go through the Apple Rosetta 2 emulation layer to run on the M1. This works like &lt;span class="caps"&gt;WOW64&lt;/span&gt; but in the reverse direction: it takes in an x86-64 instruction stream, and produces interpreted instructions for Apple &lt;span class="caps"&gt;ARM&lt;/span&gt;&amp;nbsp;processors.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Programs that were not compiled for the instruction set of the host &lt;span class="caps"&gt;OS&lt;/span&gt; have to go through an emulation layer program. This program translates the instructions of that program into compatible instructions that its own processor can&amp;nbsp;execute.&lt;/p&gt;
&lt;p&gt;Simple to describe, much more difficult to execute …&amp;nbsp;😩&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S12] Issue 155: Emulation&amp;nbsp;performance&lt;/p&gt;
&lt;p&gt;Is this how emulation actually works? I wish! Don’t want to go too deep, but I think it is instructive to briefly discuss performance issues, and why it leads to some things you might have&amp;nbsp;observed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;&lt;span class="caps"&gt;ARM&lt;/span&gt; actually has a 32-bit instruction set—AArch32 and a 64-bit instruction set—AArch64, which are incompatible. But since Apple switched to AArch64 starting from the iPhone 5S (2013), other mobile device manufacturers have followed suit, and AArch64 is now the main instruction set used on mobile. In this issue, I use &lt;span class="caps"&gt;ARM&lt;/span&gt; to refer to AArch64.&amp;#160;&lt;a class="footnote-backref" href="#fnref:1" title="Jump back to footnote 1 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;You can still see this happening with some old programs; this is usually indicated in the title bar as compatibility mode.&amp;#160;&lt;a class="footnote-backref" href="#fnref:2" title="Jump back to footnote 2 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:3"&gt;
&lt;p&gt;Their first was the ill-fated &lt;a href="https://www.techradar.com/reviews/pc-mac/tablets/microsoft-surface-rt-1085839/review"&gt;Surface &lt;span class="caps"&gt;RT&lt;/span&gt;&lt;/a&gt;, which these days is only whispered about.&amp;#160;&lt;a class="footnote-backref" href="#fnref:3" title="Jump back to footnote 3 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><category term="Season 12"></category></entry><entry><title>Issue 153: Using the cloud</title><link href="https://ngjunsiang.github.io/laymansguide/issue153.html" rel="alternate"></link><published>2022-01-01T08:00:00+08:00</published><updated>2022-01-01T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-01-01:/laymansguide/issue153.html</id><summary type="html">&lt;p&gt;The cloud offers standard digital business services, accessible through a web interface and &lt;span class="caps"&gt;API&lt;/span&gt;, which any developer (with a credit card) can use. Developers don’t have to reinvent the wheel, so long as they know how to use web&amp;nbsp;APIs.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Actually making a web application requires you to set up lots of supporting software and carry out lots of steps to create a suitable app&amp;nbsp;environment.&lt;/p&gt;
&lt;p&gt;Last issue, I described the whole host of things that need to be done just to make a web application work on another server, different from where you did your&amp;nbsp;programming.&lt;/p&gt;
&lt;p&gt;How do people deploy web services so quickly if there is so much tedium&amp;nbsp;involved?&lt;/p&gt;
&lt;h2&gt;Birth of the&amp;nbsp;Cloud&lt;/h2&gt;
&lt;p&gt;You could set up the environment, containerise it, and deploy it through a container … that’s one way to solve for&amp;nbsp;distribution.&lt;/p&gt;
&lt;p&gt;But somebody smart realised that this is likely a common problem. 99%&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt; of applications are going to need the same building blocks: one or more databases (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue079.html"&gt;Season 7&lt;/a&gt;)), remote storage servers for storing large files (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue106.html"&gt;Issue 106&lt;/a&gt;)), web servers (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue008.html"&gt;Issue 8&lt;/a&gt;)), and of course the application&amp;nbsp;itself.&lt;/p&gt;
&lt;p&gt;All these pieces must themselves run on a machine (physical or virtual). The hardware, the network resources, the type of database, the type of storage, … these are usually not key differentiators for the business. They do not derive their business value by managing it differently from other&amp;nbsp;companies.&lt;/p&gt;
&lt;p&gt;Amazon was the first to realise that whatever they were doing to scale Amazon’s business globally, their competitors and other businesses would eventually need as&amp;nbsp;well.&lt;/p&gt;
&lt;h2&gt;The Cloud is&amp;nbsp;born&lt;/h2&gt;
&lt;p&gt;The Cloud is a collection of services that can be plugged in to an application, in lieu of writing your own code. Instead of implementing your own storage server, you could use Google Cloud Storage, or Amazon S3, or Microsoft Azure Storage, etc. You access these and other services typically through a web &lt;span class="caps"&gt;API&lt;/span&gt; (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue004.html"&gt;Issue 4&lt;/a&gt;)), and have the option to manage them through a web&amp;nbsp;interface.&lt;/p&gt;
&lt;p&gt;&lt;img alt="screenshot of Google Cloud Storage’s web interface" src="https://ngjunsiang.github.io/laymansguide/issue153_01.png" /&gt;&lt;br /&gt;
&lt;em&gt;Google Cloud Storage web&amp;nbsp;interface&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Besides virtual machines (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue147.html"&gt;Issue 147&lt;/a&gt;)), cloud offerings span multiple layers of&amp;nbsp;abstraction.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Google Cloud Storage’s main cloud offerings" src="https://ngjunsiang.github.io/laymansguide/issue153_02.png" /&gt;&lt;br /&gt;
&lt;em&gt;Google Cloud main&amp;nbsp;offerings&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Here are Google’s mainstay&amp;nbsp;offerings:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Compute Engine: virtual&amp;nbsp;machines&lt;/li&gt;
&lt;li&gt;App Engine: a pre-configured, setup-free virtual machine that runs code which you upload, through a web &lt;span class="caps"&gt;API&lt;/span&gt; or their web&amp;nbsp;interface&lt;/li&gt;
&lt;li&gt;Kubernetes Engine: a hypervisor (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue148.html"&gt;Issue 148&lt;/a&gt;)) that runs your&amp;nbsp;containers&lt;/li&gt;
&lt;li&gt;Cloud Storage: a storage service for files (see earlier&amp;nbsp;screenshot)&lt;/li&gt;
&lt;li&gt;Cloud &lt;span class="caps"&gt;SQL&lt;/span&gt;: a relational database service (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue087.html"&gt;Issue 87&lt;/a&gt;))&lt;/li&gt;
&lt;li&gt;Cloud Bigtable: a NoSQL database service (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue090.html"&gt;Issue 90&lt;/a&gt;))&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Then there are variants for running big data queries, using machine learning nodes, and rebranded services for running the backends of mobile apps, … the key common factor here is that using these services is much simpler than rolling and maintaining your own version!&lt;sup id="fnref:2"&gt;&lt;a class="footnote-ref" href="#fn:2"&gt;2&lt;/a&gt;&lt;/sup&gt; And it lets you speed up development by not having to reinvent the wheel that cloud services have implemented for&amp;nbsp;you.&lt;/p&gt;
&lt;h2&gt;The Cloud&amp;nbsp;grows&lt;/h2&gt;
&lt;p&gt;As web applications got larger and larger, beyond the capacity of even a single high-end server to manage, they had to be redesigned so that they could run on multiple servers while maintaining data synchronicity. As businesses standardise on ways to do that, cloud providers add these tools as part of their&amp;nbsp;offerings.&lt;/p&gt;
&lt;p&gt;For example, sending/receiving messages between servers is a key engineering problem. Data packets sometimes get dropped en-route, or when a server gets overloaded. Sometimes they get held up at a server, time out, and then they get resent by the client (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue009.html"&gt;Issue 9&lt;/a&gt;)); the server receives two identical requests, and sends two identical responses, resulting in a duplicate&amp;nbsp;response.&lt;/p&gt;
&lt;p&gt;If you don’t want to write your own software for managing communication between servers, the cloud lets you write code for your machines to communicate easily, without having to crack your head thinking about how to make it&amp;nbsp;happen.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; The cloud offers standard digital business services, accessible through a web interface and &lt;span class="caps"&gt;API&lt;/span&gt;, which any developer (with a credit card) can use. Developers don’t have to reinvent the wheel, so long as they know how to use web&amp;nbsp;APIs.&lt;/p&gt;
&lt;p&gt;There is, of course, much more to developing an application than just gluing services together. For commercial applications, you still have compliance requirements, logging, monitoring, and other things to set up. But these are not new needs, and not really worth going into detail in a layman’s&amp;nbsp;newsletter.&lt;/p&gt;
&lt;p&gt;I hope the gist of what the cloud does is at least&amp;nbsp;clearer!&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S12] Issue 154:&amp;nbsp;Emulation&lt;/p&gt;
&lt;p&gt;I am done with virtualisation and the cloud at this point. You’ve learned about hardware virtualisation (through drivers), system virtualisation (through system VMs), process virtualisation (through process VMs), and service virtualisation (through APIs) so far this&amp;nbsp;season.&lt;/p&gt;
&lt;p&gt;I’m going to use the last three issues to talk about a related and current thing: instruction translation and emulation. Let’s start with a question: How is the Apple M1, an &lt;span class="caps"&gt;ARM&lt;/span&gt; chip, able to run MacOS programs compiled for the Intel x86-64 chips? Aren’t they two very different instruction sets (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue053.html"&gt;Issue 53&lt;/a&gt;))?&lt;/p&gt;
&lt;p&gt;Yes, yes they are. More next issue&amp;nbsp;;)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;Illustrative but not accurate estimation!&amp;#160;&lt;a class="footnote-backref" href="#fnref:1" title="Jump back to footnote 1 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;Provided your use case is in the 99-percentile! If yours is an edge case, you might find that rolling your own version is better value for money in the long run.&amp;#160;&lt;a class="footnote-backref" href="#fnref:2" title="Jump back to footnote 2 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><category term="Season 12"></category></entry><entry><title>Issue 152: Getting started with programming</title><link href="https://ngjunsiang.github.io/laymansguide/issue152.html" rel="alternate"></link><published>2021-12-25T08:00:00+08:00</published><updated>2021-12-25T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-12-25:/laymansguide/issue152.html</id><summary type="html">&lt;p&gt;Actually making a web application requires you to set up lots of supporting software and carry out lots of steps to create a suitable app&amp;nbsp;environment.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; The Java Runtime Environment (&lt;span class="caps"&gt;JRE&lt;/span&gt;) bundles the Java &lt;span class="caps"&gt;VM&lt;/span&gt; and supporting libraries. The &lt;span class="caps"&gt;JRE&lt;/span&gt; has to be installed on the user’s system for Java programs to work, unless the program bundles the supporting libraries. Solo programmers can start programming with OpenJDK for free with fewer features and less support, while commercial companies can license Oracle &lt;span class="caps"&gt;JDK&lt;/span&gt; for better support and&amp;nbsp;features.&lt;/p&gt;
&lt;p&gt;So you started taking up programming. Maybe you went to a class, where everything was set up for you and you didn’t have to worry about installing and configuring necessary software. Or you took an online course, where step-by-step instructions were provided and you mostly didn’t have to spend time scratching your head. That’s how it should be; you paid to learn &lt;em&gt;programming&lt;/em&gt;, not to learn how to configure a software development&amp;nbsp;environment.&lt;/p&gt;
&lt;p&gt;Once you actually have to start writing code though&amp;nbsp;…&lt;/p&gt;
&lt;h2&gt;Setting up a development&amp;nbsp;environment&lt;/h2&gt;
&lt;p&gt;Let’s suppose you are writing code for a web application. You start by installing the software for the compiler/interpreter program, which either executes your code directly or compiles it into an executable binary (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue054.html"&gt;Issue 54&lt;/a&gt;)).&lt;/p&gt;
&lt;p&gt;Now you begin writing your code. Along the way, you begin to install various libraries (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue017.html"&gt;Issue 17&lt;/a&gt;)) and frameworks (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue018.html"&gt;Issue 18&lt;/a&gt;)) that your code relies on. These are provided in things called &lt;strong&gt;packages&lt;/strong&gt;, which are basically zipped files containing all the files and metadata for the library/framework. You install these packages using another program, called a &lt;strong&gt;package manager&lt;/strong&gt;, through the command line terminal (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue015.html"&gt;Issue 15&lt;/a&gt;)).&lt;/p&gt;
&lt;p&gt;You write more code. And one day … you’re done! The real pain has just&amp;nbsp;begun!&lt;/p&gt;
&lt;h2&gt;Deploying&amp;nbsp;code&lt;/h2&gt;
&lt;p&gt;Thus far, you have been programming on your own laptop. But your laptop can’t handle a full webserver load once people start using your app, so you wisely decided to lease a virtual machine (&lt;span class="caps"&gt;VM&lt;/span&gt;: see &lt;a href="https://ngjunsiang.github.io/laymansguide/issue147.html"&gt;Issue 147&lt;/a&gt;)) from a cloud provider instead. You boot up the &lt;span class="caps"&gt;VM&lt;/span&gt;, it goes through its bootup process (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue112.html"&gt;Issue 112&lt;/a&gt;)), and finally completes. You are greeted with a familiar command line, the text cursor blinking&amp;nbsp;cheerfully.&lt;/p&gt;
&lt;p&gt;How are you going to get your code on that&amp;nbsp;machine?&lt;/p&gt;
&lt;p&gt;Maybe you set up a code repository (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue019.html"&gt;Issue 19&lt;/a&gt;)) on another server, and then download your code onto the &lt;span class="caps"&gt;VM&lt;/span&gt; with some&amp;nbsp;commands.&lt;/p&gt;
&lt;p&gt;Maybe you decide to turn your app into a package instead: you write software instructions (more code!) to tell the &lt;strong&gt;package manager&lt;/strong&gt; (mentioned earlier) how to install the package, and how to configure everything. You add some files with metadata, a file manifest containing all the files used by the package, and then pack it up. You install yet more software (called &lt;strong&gt;build tools&lt;/strong&gt;) to help you automate this part. Then you set up another file server, upload the package onto it from your laptop, download it from the &lt;span class="caps"&gt;VM&lt;/span&gt;, and install it on the &lt;span class="caps"&gt;VM&lt;/span&gt; using the same &lt;strong&gt;package manager&lt;/strong&gt;&amp;nbsp;software.&lt;/p&gt;
&lt;p&gt;You test it, and after many hours of cursing, confused pacing and mumbling, and much hair-tearing, it finally works.&amp;nbsp;Phew!&lt;/p&gt;
&lt;h2&gt;Expanding the&amp;nbsp;app&lt;/h2&gt;
&lt;p&gt;Unfortunately, the tiny toy server that you used to test your web app doesn’t hold up to real-world network loads. You’ll need to put the app behind a Real™ web server; as more and more users use it, you may even need to deploy your app to multiple servers to handle the load, all managed by a &lt;strong&gt;load balancer&lt;/strong&gt;. The balancer receives the web requests (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue009.html"&gt;Issue 9&lt;/a&gt;)), decides which of the multiple servers has the lowest load so far, and directs the request to it so it can serve a web response (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue008.html"&gt;Issue 8&lt;/a&gt;)).&lt;/p&gt;
&lt;p&gt;Deploying more servers … does that mean you have to do the above all over&amp;nbsp;again?!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Actually making a web application requires you to set up lots of supporting software and carry out lots of steps to create a suitable app&amp;nbsp;environment.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S12] Issue 153: Using the&amp;nbsp;cloud&lt;/p&gt;
&lt;p&gt;I hope this issue adequately describes the problem that the cloud attempted to resolve! When people talk about “using the cloud”, what is that actually&amp;nbsp;like?&lt;/p&gt;
&lt;p&gt;Next issue, I’ll give a peek. Short issue&amp;nbsp;guaranteed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 12"></category></entry><entry><title>Issue 151: the Java VM</title><link href="https://ngjunsiang.github.io/laymansguide/issue151.html" rel="alternate"></link><published>2021-12-18T08:00:00+08:00</published><updated>2021-12-18T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-12-18:/laymansguide/issue151.html</id><summary type="html">&lt;p&gt;The Java Runtime Environment (&lt;span class="caps"&gt;JRE&lt;/span&gt;) bundles the Java &lt;span class="caps"&gt;VM&lt;/span&gt; and supporting libraries. The &lt;span class="caps"&gt;JRE&lt;/span&gt; has to be installed on the user’s system for Java programs to work, unless the program bundles the supporting libraries. Solo programmers can start programming with OpenJDK for free with fewer features and less support, while commercial companies can license Oracle &lt;span class="caps"&gt;JDK&lt;/span&gt; for better support and&amp;nbsp;features.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; System VMs provide a set of virtualised hardware that the &lt;span class="caps"&gt;OS&lt;/span&gt; interacts with. Process VMs provide a set of libraries that a program (written in that programming language) interacts&amp;nbsp;with.&lt;/p&gt;
&lt;p&gt;If the Java &lt;span class="caps"&gt;VM&lt;/span&gt; lets us write programs that work across multiple Oses, why don’t we write everything in Java&amp;nbsp;then?&lt;/p&gt;
&lt;p&gt;Actually a lot of enterprises do! But there are some tradeoffs to make this&amp;nbsp;work.&lt;/p&gt;
&lt;h2&gt;What’s&amp;nbsp;bundled&lt;/h2&gt;
&lt;p&gt;The code required to make a Java program run on every operating system is not simple; somehow all this complexity needs to make its way to the target computer, whether it uses it or&amp;nbsp;not.&lt;/p&gt;
&lt;p&gt;Ideally, we have one part: the program you want to distribute, bundled and delivered to the user. The other part, like an adapter (the Java &lt;span class="caps"&gt;VM&lt;/span&gt;), allows your program to work on the target&amp;nbsp;computer.&lt;/p&gt;
&lt;p&gt;Up to this point I have given the impression that the Java &lt;span class="caps"&gt;VM&lt;/span&gt; is all that is needed for the adapter to work. This is inaccurate; the Java &lt;span class="caps"&gt;VM&lt;/span&gt; interprets the program instructions (in an intermediate set of instructions called &lt;em&gt;bytecode&lt;/em&gt;). It still needs a whole set of supporting libraries to enable interfacing with the &lt;span class="caps"&gt;OS&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;The Java &lt;span class="caps"&gt;VM&lt;/span&gt; and these supporting libraries are installed in a software package called the Java Runtime Environment (&lt;span class="caps"&gt;JRE&lt;/span&gt;). If you hear the term “runtime environment”, this is what it refers to: the program plus the libraries it needs to&amp;nbsp;run.&lt;/p&gt;
&lt;p&gt;If you want to write Java programs, you’ll need more than the &lt;span class="caps"&gt;JRE&lt;/span&gt; though. you will need supporting tools especially for debugging, and these are provided in the Java Development Kit (&lt;span class="caps"&gt;JDK&lt;/span&gt;). This is not only true for Java, but for many other languages as well; if you are getting into programming, and asked to pick a download, you usually want the one that says “development&amp;nbsp;kit”.&lt;/p&gt;
&lt;h1&gt;Tradeoffs in&amp;nbsp;distribution&lt;/h1&gt;
&lt;p&gt;If you want to keep the software bundle size small, you’ll have to ask the user to install the &lt;span class="caps"&gt;JRE&lt;/span&gt; separately (about ~&lt;span class="caps"&gt;80MB&lt;/span&gt; downloaded, more when installed). If you don’t want your users to face that hassle, you’ll have to take on the work of bundling the required libraries into your program yourself. Are you going to bundle libraries for all targeted OSes, or just for one particular platform? The more you bundle the larger the size&amp;nbsp;&amp;#8230;&lt;/p&gt;
&lt;p&gt;Nobody said multiplatform support is&amp;nbsp;easy!&lt;/p&gt;
&lt;h2&gt;The&amp;nbsp;legalese&lt;/h2&gt;
&lt;p&gt;Java is free to use—but only on a personal basis. Once you intend to distribute your program, and maybe even make money, the issue of licensing rears its&amp;nbsp;head.&lt;/p&gt;
&lt;p&gt;Java was originally created at Sun Microsystems in 1995, but was acquired by Oracle in 2010. They do enforce their licensing pretty strictly, so be prepared to pay for the&amp;nbsp;convenience!&lt;/p&gt;
&lt;h2&gt;Java and&amp;nbsp;open-source&lt;/h2&gt;
&lt;p&gt;If the only way to distribute programs with multiplatform support is to pay a licensing fee, Java would see much lower takeup, which would hurt long-term profits &amp;#8230; so a big portion of the Java core is open-sourced as &lt;a href="https://openjdk.java.net/"&gt;OpenJDK&lt;/a&gt;. This is free to use and extend, and many businesses have been successfully releasing software based on it. But it is going to be a lot more work carrying out testing and writing code for features which are not&amp;nbsp;provided.&lt;/p&gt;
&lt;p&gt;On top of OpenJDK, Oracle &lt;span class="caps"&gt;JDK&lt;/span&gt;—Oracle’s commercial release of the &lt;span class="caps"&gt;JDK&lt;/span&gt;—adds some proprietary code, plus lots of enterprise support and testing. In general you’re going to have a much easier time writing your code with Oracle &lt;span class="caps"&gt;JDK&lt;/span&gt; instead of OpenJDK—that is how Oracle makes&amp;nbsp;money!&lt;/p&gt;
&lt;p&gt;If you just want to get familiar with the language, or are working on a personal project, OpenJDK lets you do so for free, legally. If you are a corporation trying to get your engineers to write code that runs on multiple platforms so as to simplify your systems, Oracle &lt;span class="caps"&gt;JDK&lt;/span&gt; helps you to save time doing that, for a&amp;nbsp;fee.&lt;/p&gt;
&lt;p&gt;It’s the best of both&amp;nbsp;worlds.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; The Java Runtime Environment (&lt;span class="caps"&gt;JRE&lt;/span&gt;) bundles the Java &lt;span class="caps"&gt;VM&lt;/span&gt; and supporting libraries. The &lt;span class="caps"&gt;JRE&lt;/span&gt; has to be installed on the user’s system for Java programs to work, unless the program bundles the supporting libraries. Solo programmers can start programming with OpenJDK for free with fewer features and less support, while commercial companies can license Oracle &lt;span class="caps"&gt;JDK&lt;/span&gt; for better support and&amp;nbsp;features.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S12] Issue 152: Getting started with&amp;nbsp;programming&lt;/p&gt;
&lt;p&gt;Hold on, I&amp;nbsp;thought—&lt;/p&gt;
&lt;p&gt;Nah, Layman’s Guide to Computing has not suddenly switched to being a Guide to Programming! We are still on the topic of the cloud and the history of commercial computing. Where I last stopped, I was talking about how co-hosting started from virtual-hardware &lt;span class="caps"&gt;VM&lt;/span&gt; rental, and then added containerisation to its bag of tools. Then I segued into talking about process virtualisation and the Java &lt;span class="caps"&gt;VM&lt;/span&gt; (last issue &lt;span class="amp"&gt;&amp;amp;&lt;/span&gt; this&amp;nbsp;issue).&lt;/p&gt;
&lt;p&gt;A short note though: process virtualisation isn’t a co-hosting tool, but a programming tool. We use process virtualisation while writing programs, not while deploying programs to the cloud. And I do want to get back to talking about the&amp;nbsp;cloud.&lt;/p&gt;
&lt;p&gt;But before I do that, there’s one thing that the average layperson would not be familiar with, and which I need to talk&amp;nbsp;about:&lt;/p&gt;
&lt;p&gt;Why is it so difficult to &lt;em&gt;do&lt;/em&gt; programming, even with experience? Yes, &lt;em&gt;do&lt;/em&gt; programming, not merely learn&amp;nbsp;it!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 12"></category></entry><entry><title>Issue 150: System VMs vs Process VMs</title><link href="https://ngjunsiang.github.io/laymansguide/issue150.html" rel="alternate"></link><published>2021-12-11T08:00:00+08:00</published><updated>2021-12-11T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-12-11:/laymansguide/issue150.html</id><summary type="html">&lt;p&gt;System VMs provide a set of virtualised hardware that the &lt;span class="caps"&gt;OS&lt;/span&gt; interacts with. Process VMs provide a set of libraries that a program (written in that programming language) interacts&amp;nbsp;with.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Containers are one layer of virtualisation above virtual machines: containerisation systems virtualise access to the operating system, presenting a virtual interface that provides software with the resources it needs, without being aware of software running in other containers on the same&amp;nbsp;system.&lt;/p&gt;
&lt;h2&gt;Recap&lt;/h2&gt;
&lt;p&gt;If I need to configure an entire machine to install and configure my own operating system (&lt;span class="caps"&gt;OS&lt;/span&gt;), I can rent a virtual machine — this is system&amp;nbsp;virtualisation.&lt;/p&gt;
&lt;p&gt;If I just need to run a set of software &lt;em&gt;on a particular &lt;span class="caps"&gt;OS&lt;/span&gt;&lt;/em&gt; but don’t want the hassle of managing the rest of the &lt;span class="caps"&gt;OS&lt;/span&gt;, I can containerise them for the &lt;span class="caps"&gt;OS&lt;/span&gt; — this is&amp;nbsp;containerisation.&lt;/p&gt;
&lt;p&gt;What if I want to write software that will work the same on multiple OSes? Is that&amp;nbsp;possible?&lt;/p&gt;
&lt;p&gt;Before 1995,&amp;nbsp;no!&lt;/p&gt;
&lt;h2&gt;&lt;span class="caps"&gt;OS&lt;/span&gt;-level details are&amp;nbsp;tricky&lt;/h2&gt;
&lt;p&gt;OSes mediate access to resources through libraries (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue017.html"&gt;Issue 17&lt;/a&gt;)). Instead of having to deal with storage disk sectors and blocks, you can just use library features to ask the &lt;span class="caps"&gt;OS&lt;/span&gt; to help you create a file and write data to it. The &lt;span class="caps"&gt;OS&lt;/span&gt; and filesystem (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue106.html"&gt;Issue 106&lt;/a&gt;)) take care of the&amp;nbsp;details.&lt;/p&gt;
&lt;p&gt;I don’t know how to explain this more clearly without showing some programming code; the &lt;span class="caps"&gt;OS&lt;/span&gt; controls a lot of things! Which is a problem when it comes to multi-&lt;span class="caps"&gt;OS&lt;/span&gt; support, because different OSes control different things&amp;nbsp;differently.&lt;/p&gt;
&lt;p&gt;The library features for lots of things — storage, searching through directories, networking, etc — are different between Windows, Linux, MacOS,&amp;nbsp;&amp;#8230;&lt;/p&gt;
&lt;h2&gt;Abstracting away the&amp;nbsp;details&lt;/h2&gt;
&lt;p&gt;Can’t we program in a higher-level language, and use another program (the code interpreter) to break it down to different types of operations on different operating systems?&amp;nbsp;E.g. &lt;code&gt;python.exe&lt;/code&gt; on Windows will try to make my Python code work in Windows by using Windows&amp;nbsp;libraries, &lt;code&gt;python&lt;/code&gt; on Linux will do so using Linux libraries,&amp;nbsp;and &lt;code&gt;python&lt;/code&gt; on MacOS will do so using macOS libraries. Javascript, Ruby, Perl, VBScript, and other &lt;strong&gt;interpreted programming languages&lt;/strong&gt; work this way too&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;To a large extent, this is possible. But there remain some irreconcilable&amp;nbsp;differences:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;if you need to use Python to run a command-line program, such as a shell script (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue016.html"&gt;Issue 16&lt;/a&gt;)), those will depend on terminal availability: not all terminals have cross-&lt;span class="caps"&gt;OS&lt;/span&gt;&amp;nbsp;support!&lt;/li&gt;
&lt;li&gt;If you need to specify a file location, Windows and Linux do not use the same path separators (the character that separates folder names in a folder hierarchy); Windows&amp;nbsp;uses &lt;code&gt;\&lt;/code&gt; to separate directory names, while Linux and MacOS&amp;nbsp;uses &lt;code&gt;/&lt;/code&gt;. This is often a source of bugs and&amp;nbsp;headaches.&lt;/li&gt;
&lt;li&gt;Important advanced features, such as multiprocessing (on multiple &lt;span class="caps"&gt;CPU&lt;/span&gt; cores simultaneously), are &lt;a href="https://rhodesmill.org/brandon/2010/python-multiprocessing-linux-windows/"&gt;handled differently in different OSes&lt;/a&gt; in ways that may be incompatible within the same&amp;nbsp;program.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Virtualising processes vs virtualising&amp;nbsp;hardware&lt;/h2&gt;
&lt;p&gt;So it looks like we need something more. We need a programming language that can be interpreted into intermediate instructions (these are called &lt;em&gt;bytecode&lt;/em&gt;), and we need a program for each &lt;span class="caps"&gt;OS&lt;/span&gt; that can carry out these intermediate&amp;nbsp;instructions.&lt;/p&gt;
&lt;p&gt;That program is also called a virtual machine (&lt;span class="caps"&gt;VM&lt;/span&gt;), but this is not hardware virtualisation. It is &lt;em&gt;process&lt;/em&gt;&amp;nbsp;virtualisation.&lt;/p&gt;
&lt;p&gt;The &lt;span class="caps"&gt;OS&lt;/span&gt; interacts with virtual hardware without directly accessing the underlying hardware. Similarly, we want our code to interact with a virtual process instead of using &lt;span class="caps"&gt;OS&lt;/span&gt; libraries&amp;nbsp;directly.&lt;/p&gt;
&lt;p&gt;This is how the Java programming language works. It provides a (process) &lt;span class="caps"&gt;VM&lt;/span&gt;, called the Java &lt;span class="caps"&gt;VM&lt;/span&gt;, for each operating system. Your Java program interacts with the Java &lt;span class="caps"&gt;VM&lt;/span&gt; only; it mediates all access to the operating&amp;nbsp;system.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; System VMs provide a set of virtualised hardware that the &lt;span class="caps"&gt;OS&lt;/span&gt; interacts with. Process VMs provide a set of libraries that a program (written in that programming language) interacts&amp;nbsp;with.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S12] Issue 151: the Java &lt;span class="caps"&gt;VM&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The idea sounds pretty cool &amp;#8230; so why don’t we write more programs this way? And what &lt;em&gt;is&lt;/em&gt; the Java &lt;span class="caps"&gt;VM&lt;/span&gt;&amp;nbsp;anyway?&lt;/p&gt;
&lt;p&gt;Light discussion on code-adjacent issues next&amp;nbsp;issue!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;As opposed to &lt;strong&gt;compiled programming languages&lt;/strong&gt; (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue054.html"&gt;Issue 54&lt;/a&gt;)), where code is compiled into &lt;span class="caps"&gt;CPU&lt;/span&gt; instructions for one hardware platform for one &lt;span class="caps"&gt;OS&lt;/span&gt; only.&amp;#160;&lt;a class="footnote-backref" href="#fnref:1" title="Jump back to footnote 1 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><category term="Season 12"></category></entry><entry><title>Issue 149: History of commercial computing - containerisation</title><link href="https://ngjunsiang.github.io/laymansguide/issue149.html" rel="alternate"></link><published>2021-12-04T08:00:00+08:00</published><updated>2021-12-04T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-12-04:/laymansguide/issue149.html</id><summary type="html">&lt;p&gt;Containers are one layer of virtualisation above virtual machines: containerisation systems virtualise access to the operating system, presenting a virtual interface that provides software with the resources it needs, without being aware of software running in other containers on the same&amp;nbsp;system.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Renting out virtual hardware instead of physical hardware meant that instead of having to move hardware around and manage it, you could send the &lt;em&gt;data&lt;/em&gt; for running an &lt;span class="caps"&gt;OS&lt;/span&gt; to the hosting company and have them be responsible for hardware&amp;nbsp;operations.&lt;/p&gt;
&lt;h2&gt;Business&amp;nbsp;concerns&lt;/h2&gt;
&lt;p&gt;Every business computer you have encountered likely runs an operating system (&lt;span class="caps"&gt;OS&lt;/span&gt;). And yet, what value does managing the &lt;span class="caps"&gt;OS&lt;/span&gt; have for the business? They have business software to run—point-of-sale systems, accounting systems, communication systems e.g. email—but the &lt;span class="caps"&gt;OS&lt;/span&gt; is no big concern for them, as long as it runs the&amp;nbsp;software!&lt;/p&gt;
&lt;p&gt;If I have point-of-sale software that only runs in Windows, and I’m paying for a company to provide it as a service, I don’t care if the software actually runs on Windows with direct hardware access, or if it is doing it through a virtual machine, &lt;em&gt;so long as it works&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;If I am going to help other companies run point-of-sale systems, one way to do it securely (so that data from different terminals/companies do not mix) would be to run a separate virtual machine (&lt;span class="caps"&gt;VM&lt;/span&gt;) for each system. I would do this through a &lt;a href="https://en.wikipedia.org/wiki/Hypervisor"&gt;hypervisor&lt;/a&gt;, a specialised &lt;em&gt;thing&lt;/em&gt; (software/firmware/hardware) meant for running&amp;nbsp;VMs.&lt;/p&gt;
&lt;h2&gt;Virtualising&amp;nbsp;OSes&lt;/h2&gt;
&lt;p&gt;This is kind of wasteful; I am running multiple versions of the same &lt;span class="caps"&gt;OS&lt;/span&gt; to support as many copies of the point-of-sale system, even though they can all run on the same &lt;span class="caps"&gt;OS&lt;/span&gt;. I am just loathe to do so for security&amp;nbsp;reasons.&lt;/p&gt;
&lt;p&gt;What if we could apply virtualisation one layer up: instead of just virtualising hardware, we &lt;em&gt;virtualise the &lt;span class="caps"&gt;OS&lt;/span&gt;&lt;/em&gt;?&lt;/p&gt;
&lt;p&gt;To recap: when we virtualise the hardware, we provide virtual drivers that the &lt;span class="caps"&gt;OS&lt;/span&gt; can accept as valid&amp;nbsp;hardware.&lt;/p&gt;
&lt;p&gt;But programs don’t need real or virtual hardware; they need &lt;span class="caps"&gt;OS&lt;/span&gt; libraries which provide common resources and services: network, storage, compute, memory, windowing/display. If we can provide &lt;em&gt;virtual libraries&lt;/em&gt; which respond like the actual &lt;span class="caps"&gt;OS&lt;/span&gt; libraries would, the programs would be able to run as&amp;nbsp;normal.&lt;/p&gt;
&lt;p&gt;The technology that enables OSes to let programs think they are running exclusively, protected from other programs, is called &lt;span class="caps"&gt;OS&lt;/span&gt;-level virtualisation, but more widely referred to as &lt;strong&gt;containerisation&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;An &lt;span class="caps"&gt;OS&lt;/span&gt; (with the appropriate software &lt;span class="amp"&gt;&amp;amp;&lt;/span&gt; support) can run multiple &lt;strong&gt;containers&lt;/strong&gt;, each container acting like a sandbox (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue092.html"&gt;Issue 92&lt;/a&gt;)) for the software within. In each container, software has access to &lt;span class="caps"&gt;OS&lt;/span&gt; features, but are unable to affect software outside of the container. Each container appears to have exclusive access to (a portion of) the system’s network, storage, compute, and memory&amp;nbsp;resources.&lt;/p&gt;
&lt;h2&gt;Managing&amp;nbsp;containers&lt;/h2&gt;
&lt;p&gt;The word &lt;strong&gt;containers&lt;/strong&gt; may seem like a misnomer, for what are effectively software wrappers. But these do work almost like shipping containers: set up a container in an &lt;span class="caps"&gt;OS&lt;/span&gt;, install the required software, configure it, and now you have a container ready to meet business needs. You could send this container to any virtualisation service, they drop that container into their hosting system, and it runs like you&amp;nbsp;expect.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Containers are one layer of virtualisation above virtual machines: containerisation systems virtualise access to the operating system, presenting a virtual interface that provides software with the resources it needs, without being aware of software running in other containers on the same&amp;nbsp;system.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S12] Issue 150: System vs Process&amp;nbsp;VMs&lt;/p&gt;
&lt;p&gt;Up to this point, we have been looking at two different kinds of virtualisation: system virtualisation (virtualising hardware), and containerisation (virtualising operating system&amp;nbsp;environments).&lt;/p&gt;
&lt;p&gt;Next issue, we examine a third kind: process&amp;nbsp;virtualisation.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 12"></category></entry><entry><title>Issue 148: History of commercial computing - cohosting</title><link href="https://ngjunsiang.github.io/laymansguide/issue148.html" rel="alternate"></link><published>2021-11-27T08:00:00+08:00</published><updated>2021-11-27T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-11-27:/laymansguide/issue148.html</id><summary type="html">&lt;p&gt;Renting out virtual hardware instead of physical hardware meant that instead of having to move hardware around and manage it, you could send the &lt;em&gt;data&lt;/em&gt; for running an &lt;span class="caps"&gt;OS&lt;/span&gt; to the hosting company and have them be responsible for hardware&amp;nbsp;operations.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Running a virtual machine is like running a physical machine, but within a window in your &lt;span class="caps"&gt;OS&lt;/span&gt;.&lt;/p&gt;
&lt;h2&gt;Co-located&amp;nbsp;hosting&lt;/h2&gt;
&lt;p&gt;A not-so-long time ago, to run a website, you literally just ran a webserver on your desktop, connected it to the internet, and gave your &lt;span class="caps"&gt;IP&lt;/span&gt; address to other people. This is a pretty unreliable way to host a business website though. A big company would make business arrangements to procure a reliable internet connection, set up the infrastructure (power, cooling, mounting hardware) required to run multiple computers, and then manage their multiple systems with a full &lt;span class="caps"&gt;IT&lt;/span&gt; management team (hardware &lt;span class="amp"&gt;&amp;amp;&lt;/span&gt;&amp;nbsp;software).&lt;/p&gt;
&lt;p&gt;Not every company can afford this. Smaller companies would therefore &lt;strong&gt;co-locate&lt;/strong&gt; their computers (called colo boxes) with bigger companies, enjoying service support and infrastructure for a monthly/yearly fee. Some companies decided to just provide these services as their full-time business, and the hosting business was&amp;nbsp;born.&lt;/p&gt;
&lt;h2&gt;The difficulties of troubleshooting&amp;nbsp;remotely&lt;/h2&gt;
&lt;p&gt;Running your computer on someone else’s premises is no joke. If something went wrong, there was no way to do troubleshooting remotely. You had to drive down and do the troubleshooting onsite, usually wasting at least half a day in the process. Unsurprisingly, this was a problem many companies were happy to abstract away by paying more money. Soon, hosting companies offered to rent your &lt;em&gt;their&lt;/em&gt; computers, configured to standard specs, &lt;em&gt;and&lt;/em&gt; provide basic onsite troubleshooting. You would email/send them the software you wanted to run on those computers, with instructions, and they would do it for you. A huge timesaver; most hardware issues are now out of mind for business&amp;nbsp;owners.&lt;/p&gt;
&lt;p&gt;You still had to worry about &lt;span class="caps"&gt;OS&lt;/span&gt; issues though. If you need to have multiple pieces of software set up and configured, this was something a hosting company could not do for you. And this was where virtual machines (VMs) came in handy. What if you could set up a virtual machine, with virtual &lt;span class="caps"&gt;CPU&lt;/span&gt; and virtual memory, install your &lt;span class="caps"&gt;OS&lt;/span&gt; on a virtual disk, install all your required software in that &lt;span class="caps"&gt;OS&lt;/span&gt;, and then send that virtual disk (as data) to a hosting company? They would then run that disk through their hypervisor, a piece of software that manages virtual&amp;nbsp;machines.&lt;/p&gt;
&lt;h2&gt;The promise of&amp;nbsp;virtualisation&lt;/h2&gt;
&lt;p&gt;This was the promise that virtualisation companies offered to businesses. You could manage your virtual machines remotely, choosing when to boot them up or shut them off, paying only for virtual hardware you requested, without affecting the virtual machines of other companies. Hosting companies could “collect rent” for multiple VMs running on a single&amp;nbsp;computer.&lt;/p&gt;
&lt;p&gt;After all, as long as you have an interface to manage it, and you are able to set up your software on it, does it really matter whether it is a physical or virtual&amp;nbsp;machine?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Renting out virtual hardware instead of physical hardware meant that instead of having to move hardware around and manage it, you could send the &lt;em&gt;data&lt;/em&gt; for running an &lt;span class="caps"&gt;OS&lt;/span&gt; to the hosting company and have them be responsible for hardware&amp;nbsp;operations.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S12] Issue 149: History of commercial computing -&amp;nbsp;containerisation&lt;/p&gt;
&lt;p&gt;Can we push this further? Could we get hosting companies to not only help us run the hardware, but the operating system as well? Yes, yes we&amp;nbsp;can!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 12"></category></entry><entry><title>Issue 147: Operating systems on virtual hardware</title><link href="https://ngjunsiang.github.io/laymansguide/issue147.html" rel="alternate"></link><published>2021-11-20T08:00:00+08:00</published><updated>2021-11-20T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-11-20:/laymansguide/issue147.html</id><summary type="html">&lt;p&gt;Running a virtual machine is like running a physical machine, but within a window in your &lt;span class="caps"&gt;OS&lt;/span&gt;.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Virtual hardware can be created in the form of drivers that respond to a program’s requests for hardware resources. If a bootup program enumerates hardware devices and receives a response, then as long as it continues to receive valid and correct responses, it can work with the virtual hardware to run an operating&amp;nbsp;system.&lt;/p&gt;
&lt;p&gt;So &amp;#8230; what is it like to run an operating system (&lt;span class="caps"&gt;OS&lt;/span&gt;) on virtual hardware? I promised screenshots, but they probably won’t be as exciting as you expect—it looks quite&amp;nbsp;normal!&lt;/p&gt;
&lt;h2&gt;Creating a virtual&amp;nbsp;machine&lt;/h2&gt;
&lt;p&gt;I don’t want to purchase a VMware license, so I will be using an alternative virtual machine product instead: Oracle’s free Virtualbox. This is what it looks like, running on Arch Linux on my&amp;nbsp;laptop:&lt;/p&gt;
&lt;p&gt;&lt;img alt="screenshot of Virtualbox in Arch Linux" src="https://ngjunsiang.github.io/laymansguide/issue147_01.png" /&gt;&lt;br /&gt;
&lt;em&gt;Virtualbox main&amp;nbsp;interface&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Let’s create a new virtual machine. It asks which &lt;span class="caps"&gt;OS&lt;/span&gt; I intend to use, presumably so it can pick the right virtual hardware to use (MacOS virtual machines may be more picky? I’m not too sure here either). I don’t have a valid Windows license to use, so I’m just going to demo with Arch Linux&amp;nbsp;instead.&lt;/p&gt;
&lt;p&gt;Whichever &lt;span class="caps"&gt;OS&lt;/span&gt; you pick, you are going to have to find a way to install that &lt;span class="caps"&gt;OS&lt;/span&gt; into your virtual machine—whether you are using actual boot media (such as a &lt;span class="caps"&gt;DVD&lt;/span&gt; drive), or virtual&amp;nbsp;media.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Creating a virtual machine in Virtualbox" src="https://ngjunsiang.github.io/laymansguide/issue147_02.png" /&gt;&lt;br /&gt;
&lt;em&gt;Creating a virtual&amp;nbsp;machine&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Cool, you actually get to configure how much of your computer’s memory the virtual machine will get to&amp;nbsp;use.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Configuring memory size in Virtualbox" src="https://ngjunsiang.github.io/laymansguide/issue147_03.png" /&gt;&lt;br /&gt;
&lt;em&gt;Configuring memory&amp;nbsp;size&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Without a storage disk, a computer isn’t much. Virtualbox needs &lt;em&gt;something&lt;/em&gt; it can use as a disk; the usual way is to create a file on your system that Virtualbox uses as a virtual disk. The space occupied by this virtual disk can be preallocated up front (so that your virtual machine doesn’t accidentally “run out of storage space” before the disk is full), or it can be dynamically allocated, only taking up as much space as is actually&amp;nbsp;used.&lt;/p&gt;
&lt;p&gt;I don’t have an existing virtual disk file, so I will ahead and create one here (not shown). If I have one from a previous installation, I can use it here&amp;nbsp;instead.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Configuring virtual hard disk in Virtualbox" src="https://ngjunsiang.github.io/laymansguide/issue147_04.png" /&gt;&lt;br /&gt;
&lt;em&gt;Configuring hard&amp;nbsp;disk&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;The machine is created; the main interface now looks like this. Note that all the “hardware” you see there is&amp;nbsp;virtual!&lt;/p&gt;
&lt;p&gt;&lt;img alt="Virtualbox main interface, with one virtual machine" src="https://ngjunsiang.github.io/laymansguide/issue147_05.png" /&gt;&lt;br /&gt;
&lt;em&gt;Virtualbox main interface, with one virtual&amp;nbsp;machine&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;If you are doing this on your own computer, at this point you might want to go into Settings and see what else you can toy around with: number of (virtual) CPUs, sharing some folders on your system with the virtual machine (they show up as shared network folders), adding more disks or even a virtual optical drive,&amp;nbsp;etc.&lt;/p&gt;
&lt;hr /&gt;
&lt;h2&gt;Setting up boot&amp;nbsp;media&lt;/h2&gt;
&lt;p&gt;I could try to boot it now, but I already know it won’t work; there is nothing in the hard disk to boot from. With a physical computer, at this point we will attempt to install the &lt;span class="caps"&gt;OS&lt;/span&gt; from a &lt;span class="caps"&gt;DVD&lt;/span&gt; drive or flash drive. You could allow your virtual machine to access the &lt;span class="caps"&gt;DVD&lt;/span&gt; drive or flash drive in order to do this, or you can do it virtually. Most operating systems (including Windows) provide virtual boot media for installation: an &lt;span class="caps"&gt;ISO&lt;/span&gt; file is a virtual optical&amp;nbsp;disk.&lt;/p&gt;
&lt;p&gt;I can download the &lt;span class="caps"&gt;ISO&lt;/span&gt; boot file for Arch Linux, but it seems they have gotten savvier lately and actually provide virtual boot media in the form of &lt;em&gt;virtual hard disks&lt;/em&gt;! Let’s use that instead. I add it as a second virtual disk in&amp;nbsp;Virtualbox:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Virtualbox hard disk configuration" src="https://ngjunsiang.github.io/laymansguide/issue147_06.png" /&gt;&lt;br /&gt;
&lt;em&gt;Virtualbox hard disk configuration. packer-virtualbox.vmdk is the virtual boot media for Arch&amp;nbsp;Linux&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Once I start the virtual machine, it begins its boot sequence, and I interrupt it by pressing F12 to go to the boot menu (otherwise it will attempt to boot from the main virtual hard disk, and fail to detect any &lt;span class="caps"&gt;OS&lt;/span&gt;). Interesting to see here that it isn’t actually connected to a monitor: virtualbox presents a virtual display device, to which the virtual machine sends its video signal. Virtualbox captures these signals and displays them within the window instead. So you can flexibly configure the window size, and the virtual machine just thinks the display device it is connected to has been&amp;nbsp;resized.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Virtualbox boot menu" src="https://ngjunsiang.github.io/laymansguide/issue147_07.png" /&gt;&lt;br /&gt;
&lt;em&gt;Virtualbox boot menu. Through the virtual (&lt;span class="caps"&gt;AHCI&lt;/span&gt;) disk controller, the virtual machine detects two (virtual) disks: the new disk I created, and the Arch Linux boot media that I&amp;nbsp;loaded.&lt;/em&gt;    &lt;/p&gt;
&lt;h2&gt;Running a virtual&amp;nbsp;machine&lt;/h2&gt;
&lt;p&gt;I select the second disk to boot up Arch Linux for installation, and the login prompt&amp;nbsp;appears:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Virtualbox login prompt" src="https://ngjunsiang.github.io/laymansguide/issue147_08.png" /&gt;&lt;br /&gt;
&lt;em&gt;The Arch Linux login prompt, in Virtualbox. Yes, this is how Arch Linux gets installed the first&amp;nbsp;time.&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;I wont go any further at this point, because then I’d just be showing you how to set up Arch Linux. But I trust this is enough to give you an idea: running a virtual machine feels just like running a physical machine, but in a&amp;nbsp;window!&lt;/p&gt;
&lt;p&gt;Okay hold on, how do we shut this thing down? It is not recommended for a computer to be unplugged without a proper shutdown, so &amp;#8230; how do we do that with a virtual&amp;nbsp;machine?&lt;/p&gt;
&lt;p&gt;Even the powerdown and reset buttons on a computer are actually hardware signals which the &lt;span class="caps"&gt;OS&lt;/span&gt; receives and uses to trigger a series of actions. We can send these signals virtually too, through Virtualbox’s Machine&amp;nbsp;menu:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Virtualbox Machine menu" src="https://ngjunsiang.github.io/laymansguide/issue147_09.png" /&gt;&lt;br /&gt;
&lt;em&gt;The Virtualbox Machine&amp;nbsp;menu.&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;And with that, let’s shut it&amp;nbsp;down.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Running a virtual machine is like running a physical machine, but within a window in your &lt;span class="caps"&gt;OS&lt;/span&gt;.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S12] Issue 148: History of commercial computing -&amp;nbsp;cohosting&lt;/p&gt;
&lt;p&gt;Right, so this has been really cool and all, but not something a layperson would use on a daily basis usually. And the setup still seems &amp;#8230; rather technical? So why does this deserve its own&amp;nbsp;season?&lt;/p&gt;
&lt;p&gt;Remember that this happened before the turn of the century, so the tech industry has had two decades to figure out how to make money out of this. And two decades is the equivalent of a whole lifetime in this industry. How did virtualisation change the landscape of commercial computing? Time to take another walk in recent&amp;nbsp;history.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 12"></category></entry><entry><title>Issue 146: Virtual hardware</title><link href="https://ngjunsiang.github.io/laymansguide/issue146.html" rel="alternate"></link><published>2021-11-13T08:00:00+08:00</published><updated>2021-11-13T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-11-13:/laymansguide/issue146.html</id><summary type="html">&lt;p&gt;Virtual hardware can be created in the form of drivers that respond to a program’s requests for hardware resources. If a bootup program enumerates hardware devices and receives a response, then as long as it continues to receive valid and correct responses, it can work with the virtual hardware to run an operating&amp;nbsp;system.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Programs do not usually deal with the gnarly details of hardware, but instead access it through an interface. They access storage devices through a filesystem, and access hardware through&amp;nbsp;drivers.&lt;/p&gt;
&lt;p&gt;How does one trick an operating system (&lt;span class="caps"&gt;OS&lt;/span&gt;) into coexisting with other operating systems on a single machine? By &lt;em&gt;virtualising&lt;/em&gt; hardware into virtual&amp;nbsp;drivers!&lt;/p&gt;
&lt;h2&gt;Virtual network&amp;nbsp;hardware&lt;/h2&gt;
&lt;p&gt;Let’s take an example. Take a look at your network devices: there&amp;#8217;s one for your &lt;span class="caps"&gt;LAN&lt;/span&gt; port, there’s one for your wifi card, and these days there may be one each for your Bluetooth chip and 4G/5G modem&amp;nbsp;too.&lt;/p&gt;
&lt;p&gt;If your workplace requires a &lt;span class="caps"&gt;VPN&lt;/span&gt;, you may have noticed that it adds a new network device. How is this possible if you don’t actually have any new network&amp;nbsp;hardware?&lt;/p&gt;
&lt;p&gt;Remember that in an operating system, access to hardware is mediated through drivers. A driver decides how to present its interfaces to the operating system. In essence, nothing prevents a driver from presenting multiple interfaces to the &lt;span class="caps"&gt;OS&lt;/span&gt;, provided the driver is able to receive requests and respond to&amp;nbsp;them.&lt;/p&gt;
&lt;p&gt;A &lt;span class="caps"&gt;VPN&lt;/span&gt; uses its own driver to present an additional interface to the &lt;span class="caps"&gt;OS&lt;/span&gt;, and that is how we end up with “virtual&amp;nbsp;hardware”.&lt;/p&gt;
&lt;h2&gt;Virtual&amp;nbsp;storage&lt;/h2&gt;
&lt;p&gt;We are used to thinking of storage as referring to a hard disk, or solid state disk. But technically anything that is capable of representing bits can be used as storage—with an appropriate&amp;nbsp;driver.&lt;/p&gt;
&lt;p&gt;Some operating systems/programs provide drivers for &lt;span class="caps"&gt;RAM&lt;/span&gt; disks—a storage disk that uses computer memory. These appear as a normal disk drive (in Windows) or mountpoint (in Linux). Managing files in a &lt;span class="caps"&gt;RAM&lt;/span&gt; disk is speedy, because computer memory is much faster than a storage&amp;nbsp;device.&lt;/p&gt;
&lt;h2&gt;Virtual&amp;nbsp;memory&lt;/h2&gt;
&lt;p&gt;In &lt;a href="https://ngjunsiang.github.io/laymansguide/issue055.html"&gt;Issue 55&lt;/a&gt;), I explained how the operating system offers and controls access to computer memory, the pagefile (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue117.html"&gt;Issue 117&lt;/a&gt;)), as well as hardware devices through a single addressing interface: virtual&amp;nbsp;memory.&lt;/p&gt;
&lt;p&gt;When a program requests access to the printer and the &lt;span class="caps"&gt;OS&lt;/span&gt; responds with “here, you can send your request to memory address 0x35a4b2ff”, how is it to know if the data is going to a physical printer, or to a virtual one&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;?&lt;/p&gt;
&lt;h2&gt;Virtual&amp;nbsp;hardware&lt;/h2&gt;
&lt;p&gt;Take a look at your Device Manager in Control Panel. What do you&amp;nbsp;see?&lt;/p&gt;
&lt;p&gt;&lt;img alt="screenshot of Device Manager in Windows 10" src="https://ngjunsiang.github.io/laymansguide/issue146_01.jpg" /&gt;&lt;br /&gt;
&lt;small&gt;Device Manager in Windows 10&lt;br /&gt;Note that what you are seeing are not the actual hardware (which the &lt;span class="caps"&gt;OS&lt;/span&gt; cannot possibly know). These are interfaces to the hardware.&lt;/small&gt;&lt;/p&gt;
&lt;p&gt;A whole set of drivers and interfaces which the &lt;span class="caps"&gt;OS&lt;/span&gt; uses to carry out its&amp;nbsp;work.&lt;/p&gt;
&lt;p&gt;Many of these were initialised during bootup (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue112.html"&gt;Issue 112&lt;/a&gt;)), when the &lt;span class="caps"&gt;OS&lt;/span&gt; kernel (the core of the &lt;span class="caps"&gt;OS&lt;/span&gt;) enumerates the available hardware by sending out signals and seeing what hardware&amp;nbsp;responds.&lt;/p&gt;
&lt;p&gt;So a bunch of engineers at VMware thought: what if we &amp;#8230; made drivers to present virtual hardware emulating the &lt;span class="caps"&gt;CPU&lt;/span&gt;, memory, storage devices, &amp;#8230; and even the chipset? What if we then we booted the &lt;span class="caps"&gt;BIOS&lt;/span&gt; (the bootup program loaded on a computer’s mainboard; see &lt;a href="https://ngjunsiang.github.io/laymansguide/issue112.html"&gt;Issue 112&lt;/a&gt;)), got the virtual hardware to respond when the &lt;span class="caps"&gt;BIOS&lt;/span&gt; enumerates hardware, and then basically simulated all the signals that hardware would actually&amp;nbsp;send?&lt;/p&gt;
&lt;p&gt;We end up with a virtual machine—one that you can actually install an &lt;span class="caps"&gt;OS&lt;/span&gt;&amp;nbsp;on!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Virtual hardware can be created in the form of drivers that respond to a program’s requests for hardware resources. If a bootup program enumerates hardware devices and receives a response, then as long as it continues to receive valid and correct responses, it can work with the virtual hardware to run an operating&amp;nbsp;system.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S12] Issue 147: Operating systems on virtual&amp;nbsp;hardware&lt;/p&gt;
&lt;p&gt;So &amp;#8230; what is it like to run an operating system on virtual hardware? Screenshots&amp;nbsp;incoming!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;These virtual printers do, in fact, exist. It is why some OSes offer a “Print to &lt;span class="caps"&gt;PDF&lt;/span&gt;” printer device: the program effectively sends print commands to another program, which interprets the commands to produce a &lt;span class="caps"&gt;PDF&lt;/span&gt; file. This is possible because both printers and the &lt;span class="caps"&gt;PDF&lt;/span&gt; format share a common language: Postscript (see &lt;a href="https://ngjunsiang.github.io/laymansguide/issue051.html"&gt;Issue 51&lt;/a&gt;)).&amp;#160;&lt;a class="footnote-backref" href="#fnref:1" title="Jump back to footnote 1 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><category term="Season 12"></category><category term="virtualisation"></category></entry><entry><title>Issue 145: What an app wants, what an app needs</title><link href="https://ngjunsiang.github.io/laymansguide/issue145.html" rel="alternate"></link><published>2021-11-06T08:00:00+08:00</published><updated>2021-11-06T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-11-06:/laymansguide/issue145.html</id><summary type="html">&lt;p&gt;Programs do not usually deal with the gnarly details of hardware, but instead access it through an interface. They access storage devices through a filesystem, and access hardware through&amp;nbsp;drivers.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; In 1999, VMware launched VMware Workstation, which allowed multiple operating systems to run off a single&amp;nbsp;machine.&lt;/p&gt;
&lt;p&gt;In Season 5 (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue054.html"&gt;Issue 53&lt;/a&gt;)), I went into some detail on how our programs work. The programming language they are written in gets &lt;em&gt;compiled&lt;/em&gt; into &lt;span class="caps"&gt;CPU&lt;/span&gt; instructions, which get carried out by the &lt;span class="caps"&gt;CPU&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;But the program does not handle everything on its own. In fact, it does not usually have direct access to hardware (unless requested from and provided by the operating system (&lt;span class="caps"&gt;OS&lt;/span&gt;)). All such access is abstracted and mediated through the operating system. The program requests and receives memory space, reads and writes files, and processes keyboard/mouse input—through the operating&amp;nbsp;system.&lt;/p&gt;
&lt;p&gt;How does the program know it is not living in a simulation? If the environment it operates in responds to its requests, the program continues running without a care. A keypress event is a keypress event, and the program can respond to it, whether it really came from a keyboard or not. A file that has data to read can be treated like a file, whether it is really stored on the hard disk or actually streamed from cloud&amp;nbsp;storage.&lt;/p&gt;
&lt;h2&gt;Computing&amp;nbsp;interfaces&lt;/h2&gt;
&lt;p&gt;This paradigm is really powerful, because it enables us to pipe data from place to place. It enables us to build &lt;strong&gt;interfaces&lt;/strong&gt;: instead of writing a program that has to grapple with the gnarly details of files in binary format, I can write a program that deals with a &lt;em&gt;file interface&lt;/em&gt; instead. The interface lets me read and write data, while the gnarly details are handled one layer down, by the&amp;nbsp;filesystem.&lt;/p&gt;
&lt;p&gt;And this is how we can open documents from a flash drive without even realising that the flash drive uses a different filesystem from our system&amp;nbsp;disk.&lt;/p&gt;
&lt;p&gt;The &lt;span class="caps"&gt;OS&lt;/span&gt; is just another special set of programs that mediate access to the hardware. Yet, it is easy to forget that even the &lt;span class="caps"&gt;OS&lt;/span&gt;’s many programs do not actually deal with the gnarly details of hardware, but with an &lt;em&gt;interface&lt;/em&gt; to the hardware. This interface are the drivers (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue120.html"&gt;Issue 120&lt;/a&gt;)) we keep hearing about, and which our &lt;span class="caps"&gt;OS&lt;/span&gt; keeps telling us could not be found or are&amp;nbsp;outdated.&lt;/p&gt;
&lt;p&gt;As long as the “drivers” respond in the right way, the operating system continues to carry out its instructions as&amp;nbsp;programmed.&lt;/p&gt;
&lt;p&gt;How does one trick an operating system into coexisting with other operating systems on a single&amp;nbsp;machine?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Programs do not usually deal with the gnarly details of hardware, but instead access it through an interface. They access storage devices through a filesystem, and access hardware through&amp;nbsp;drivers.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S12] Issue 146: Virtual&amp;nbsp;hardware&lt;/p&gt;
&lt;p&gt;Examples&amp;nbsp;incoming!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 12"></category><category term="app"></category><category term="operating system"></category></entry><entry><title>Issue 144: Programs-in-a-vat</title><link href="https://ngjunsiang.github.io/laymansguide/issue144.html" rel="alternate"></link><published>2021-10-30T08:00:00+08:00</published><updated>2021-10-30T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-10-30:/laymansguide/issue144.html</id><summary type="html">&lt;p&gt;n 1999, VMware launched VMware Workstation, which allowed multiple operating systems to run off a single&amp;nbsp;machine.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; The Apple M1 is a souped-up iPhone processor, with unified&amp;nbsp;memory.&lt;/p&gt;
&lt;p&gt;I want to circle back to talking about processors again in this season, because there are a couple of pretty world-shaking ideas I haven’t fully fleshed out in Layman’s Guide&amp;nbsp;yet.&lt;/p&gt;
&lt;p&gt;One of them is—hmm where do I begin. As early as 1641, in Meditations on First Philosophy, Descartes proposes that “All that up to the present time I have accepted as most true and certain I have learned either from the senses or through the senses; but it is sometimes proved to me that these senses are deceptive, and it is wiser not to trust entirely to anything by which we have once been deceived.” In other words, Descartes isn’t always sure that he believes what he sees; his senses sometimes deceive him about the nature of&amp;nbsp;reality.&lt;/p&gt;
&lt;p&gt;More than three centuries later, in 1999, the Wachowski brothers translate this idea into a more modern form: what if the world as we know it is a simulation running on some other cosmic, otherworldly hardware? Is it possible to signal to our senses so convincingly that a simulacrum may be thought of as&amp;nbsp;real?&lt;/p&gt;
&lt;p&gt;Hold that thought, because this is the Layman’s Guide to Computing, not Philosophy (although there is plenty of that in Computing as well!). For millennials like me who came of age in the early noughties, The Matrix defined the zeitgeist for the next couple of decades, whatever one may think of its aesthetics. It is difficult to overcredit it with&amp;nbsp;this.&lt;/p&gt;
&lt;h2&gt;VMware is&amp;nbsp;founded&lt;/h2&gt;
&lt;p&gt;But allow me to put a little dent in that reputation: the year is 1998, in Palo Alto, California. A company named VMware had just been founded. One year later, in 1999, they demoed and launched &lt;a href="https://www.virten.net/2015/12/vmware-workstation-from-1999-to-2015/"&gt;VMware Workstation&lt;/a&gt;, their first product. In that demo, engineers demonstrated how VMware Workstation could allow users to run &lt;span class="caps"&gt;MS&lt;/span&gt;-&lt;span class="caps"&gt;DOS&lt;/span&gt;, Linux, FreeBSD, and multiple versions of Windows—that’s multiple operating systems (&lt;span class="caps"&gt;OS&lt;/span&gt;)—off &lt;em&gt;a single machine&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;The release of VMware Workstation probably happened too late to influence the direction of The Matrix, but no doubt there was talk in the air of &lt;em&gt;virtualising OSes&lt;/em&gt; in the years leading up to it. To be clear, this is not dual-booting, in which a user can choose, through a boot menu, which &lt;span class="caps"&gt;OS&lt;/span&gt; to boot into (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue112.html"&gt;Issue 112&lt;/a&gt;). We are talking about &lt;em&gt;multiple&lt;/em&gt; OSes, running &lt;em&gt;simultaneously&lt;/em&gt;, off &lt;em&gt;a single machine&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;How does such a thing&amp;nbsp;happen?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; In 1999, VMware launched VMware Workstation, which allowed multiple operating systems to run off a single&amp;nbsp;machine.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S12] Issue 145: What an app wants, what an app&amp;nbsp;needs&lt;/p&gt;
&lt;p&gt;What enables an operating system to function, convinced it has full control of hardware? For that matter, how would it even know if the hardware &amp;#8230; is really&amp;nbsp;hardware?&lt;/p&gt;
&lt;p&gt;&amp;#8230;&amp;nbsp;👻&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 12"></category></entry></feed>