<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Layman's Guide to Computing - Season 09</title><link href="https://ngjunsiang.github.io/laymansguide/" rel="alternate"></link><link href="https://ngjunsiang.github.io/laymansguide/feeds/season-09.atom.xml" rel="self"></link><id>https://ngjunsiang.github.io/laymansguide/</id><updated>2021-04-24T08:00:00+08:00</updated><entry><title>Issue 117: Swap space</title><link href="https://ngjunsiang.github.io/laymansguide/issue117.html" rel="alternate"></link><published>2021-04-24T08:00:00+08:00</published><updated>2021-04-24T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-04-24:/laymansguide/issue117.html</id><summary type="html">&lt;p&gt;Operating systems use a page file on the storage disk as a complement to physical memory. This allows OSes to behave more performantly than they would if they did not have a page file. Data that is rarely accessed is moved to the pagefile (“paged out”), and can be paged in when it is needed later, albeit with a performance&amp;nbsp;hit.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Hibernation mode causes the computer to store the data configuration into a hibernation file on disk. When powered up, the &lt;span class="caps"&gt;OS&lt;/span&gt; reads the data configuration from the file back into memory. This lets the system avoid having to do a full shutdown and bootup; it performs a shorter version of these two sequences&amp;nbsp;instead.&lt;/p&gt;
&lt;p&gt;In &lt;a href="https://ngjunsiang.github.io/laymansguide/issue057.html"&gt;Issue 57&lt;/a&gt;), I laid out the transfer speeds and latencies for a few places in the computer where data can be&amp;nbsp;stored:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hard disk drive (&lt;span class="caps"&gt;HDD&lt;/span&gt;): ≈5 ms response latency, 100 &lt;span class="caps"&gt;MB&lt;/span&gt;/s transfer&amp;nbsp;speed&lt;/li&gt;
&lt;li&gt;Solid state disk (&lt;span class="caps"&gt;SSD&lt;/span&gt;): up to 0.1 ms response latency, 0.5–1+ &lt;span class="caps"&gt;GB&lt;/span&gt;/s transfer&amp;nbsp;speed&lt;/li&gt;
&lt;li&gt;Physical memory (&lt;span class="caps"&gt;RAM&lt;/span&gt;): 0.1 µs (0.0001 ms) response latency, &lt;span class="caps"&gt;20GB&lt;/span&gt;/s transfer&amp;nbsp;speed&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;CPU&lt;/span&gt; register: &amp;lt;1 ns (&amp;lt;0.000001 ms) response&amp;nbsp;latency&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Apart from the &lt;span class="caps"&gt;CPU&lt;/span&gt; itself, physical memory is one of the fastest places to store and retrieve data. It’s just such a pity that there’s a limited amount of it, and you really can’t get more than &lt;span class="caps"&gt;32GB&lt;/span&gt; of it in a single computer (for future readers, this is written in early 2021). If you bought a cheaper computer that only has &lt;span class="caps"&gt;8GB&lt;/span&gt; or only &lt;span class="caps"&gt;4GB&lt;/span&gt;, this quickly limits the number of apps you can have open at any single&amp;nbsp;moment.&lt;/p&gt;
&lt;p&gt;What happens when you run out of&amp;nbsp;memory?&lt;/p&gt;
&lt;h2&gt;Running out of&amp;nbsp;memory&lt;/h2&gt;
&lt;p&gt;When a program needs more memory, it requests it from the operating system (&lt;span class="caps"&gt;OS&lt;/span&gt;), and waits for the &lt;span class="caps"&gt;OS&lt;/span&gt; to give that memory. After all, it can’t do anything else until the memory is&amp;nbsp;available.&lt;/p&gt;
&lt;p&gt;The &lt;span class="caps"&gt;OS&lt;/span&gt;, on the other hand, will give that memory if it is available. If not, it will wait for other programs to free up memory before passing that memory to the waiting program. If no program is willing to release memory&amp;nbsp;…&lt;/p&gt;
&lt;p&gt;I guess the computer just hangs&amp;nbsp;🤷&lt;/p&gt;
&lt;h2&gt;Mitigating out-of-memory&amp;nbsp;problems&lt;/h2&gt;
&lt;p&gt;If memory is limited, what can we do to increase&amp;nbsp;it?&lt;/p&gt;
&lt;p&gt;As it turns out, not all parts of memory are constantly being written to or read from. Lots of it is just sitting there, waiting for that one moment when the data is needed. Kind of wasteful if out of &lt;span class="caps"&gt;8GB&lt;/span&gt; of memory, only &lt;span class="caps"&gt;2GB&lt;/span&gt; is actively changing in any&amp;nbsp;hour.&lt;/p&gt;
&lt;p&gt;The &lt;span class="caps"&gt;OS&lt;/span&gt; could write that mostly-static &lt;span class="caps"&gt;6GB&lt;/span&gt; to disk and free it up for other programs, maybe? Then when the data is needed, the &lt;span class="caps"&gt;OS&lt;/span&gt; reads it back from disk before passing it to the program. Yes, this would mean a slower response time for programs that have been idle for a while, but surely better than hanging because it ran out of&amp;nbsp;memory?&lt;/p&gt;
&lt;p&gt;This is what all modern OSes do. They write unused in-memory data to a file known as the &lt;strong&gt;page file&lt;/strong&gt;. In Windows, the page file&amp;nbsp;is &lt;code&gt;C:\pagefile.sys&lt;/code&gt;. When data is moved from physical memory to the page file, it is said to be &lt;em&gt;paged out&lt;/em&gt;, and when moved from page file to physical memory, it is &lt;em&gt;paged in&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;In older systems or software, you may also see this page file referred to as a &lt;em&gt;swap file&lt;/em&gt;, or &lt;em&gt;swap space&lt;/em&gt;. On Linux, a subregion of storage space can be set aside as a &lt;em&gt;swap partition&lt;/em&gt;.&lt;/p&gt;
&lt;h2&gt;Why is it called the page&amp;nbsp;file?&lt;/h2&gt;
&lt;p&gt;Computer memory is organised into pages, each page typically being 4 KiB (notice that disk sectors are also typically 4 KiB (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue106.html"&gt;Issue 106&lt;/a&gt;)) …). The computer may have only &lt;span class="caps"&gt;8GB&lt;/span&gt; of physical memory, but present &lt;span class="caps"&gt;16GB&lt;/span&gt; of virtual memory (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue056.html"&gt;Issue 56&lt;/a&gt;)) to programs. Kind of like how banks only hold some liquidity but present their assets as being much more&amp;nbsp;…&lt;/p&gt;
&lt;p&gt;So the &lt;span class="caps"&gt;8GB&lt;/span&gt; “shortfall” is actually in the pagefile, not in memory. The pagefile essentially acts like (much slower) memory! The &lt;span class="caps"&gt;OS&lt;/span&gt; reads pages from it and writes pages to it, through virtual memory&amp;nbsp;accesses.&lt;/p&gt;
&lt;h2&gt;This sounds like a waste of space, can I choose not to use&amp;nbsp;it?&lt;/h2&gt;
&lt;p&gt;Though most OSes are configured to use a page file by default, you can configure it to not do so, although this is ill-advised (and I won’t explain why here; this is a newsletter aimed at layfolks). Modern OSes are pretty smart at managing page files, understanding that it is much slower than physical computer memory. They have their own algorithms to decide when to move data to a pagefile, and these days they even forecast when data that was paged out will soon be needed by the&amp;nbsp;program.&lt;/p&gt;
&lt;p&gt;OSes need page space for all kinds of reasons: as a kind of “emergency space” when physical memory is full, as working space for optimising data layout in memory, etc. So that disk space is definitely not going to&amp;nbsp;waste!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Operating systems use a page file on the storage disk as a complement to physical memory. This allows OSes to behave more performantly than they would if they did not have a page file. Data that is rarely accessed is moved to the pagefile (“paged out”), and can be paged in when it is needed later, albeit with a performance&amp;nbsp;hit.&lt;/p&gt;
&lt;p&gt;Pagefiles are pretty amazing, even though they used to be a huge pain in older systems, when they were stored on &lt;em&gt;slowwww&lt;/em&gt; hard disks. These days, page files stored on solid state disks are pretty fast! While the performance hit of a page miss is still noticeable (like when you switch to a Chrome tab that you haven’t touched in a while), it is far from the groan-inducing wait it used to&amp;nbsp;be.&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; S10] Issue 118: When I run two file-copy processes at the same time, why are they much&amp;nbsp;slower?&lt;/p&gt;
&lt;p&gt;Next week, a new season! With operating systems much more fleshed out for you (I hope), I can finally delve into the nuts and bolts of the machine itself: the&amp;nbsp;hardware.&lt;/p&gt;
&lt;p&gt;Since this &lt;em&gt;is&lt;/em&gt; a layman’s guide, I’m going to focus on the interesting bits, the parts that actually answer long-standing questions&amp;nbsp;:)&lt;/p&gt;
&lt;p&gt;Let’s start with a bang: sometimes you are copying a file from one flash drive to your external hard disk. And you need to copy another file from your external hard disk to the same flash drive (or even a different one). You’re scared; can the computer handle it? But this is taking so long; let’s just try it&amp;nbsp;anyway.&lt;/p&gt;
&lt;p&gt;And you notice the speed suddenly plummets. Why does that happen? Even with 117 issues of Layman’s Guide written, I don’t have enough background laid down to explain this. So let’s delve into the hard disk in the first issue of Season&amp;nbsp;10.&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;li&gt;a driver file and why do I need one? [Issue&amp;nbsp;98]&lt;/li&gt;
&lt;li&gt;a video card? [Issue&amp;nbsp;113]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 09"></category><category term="cpu"></category><category term="memory"></category><category term="operating system"></category></entry><entry><title>Issue 116: Hibernation</title><link href="https://ngjunsiang.github.io/laymansguide/issue116.html" rel="alternate"></link><published>2021-04-17T08:00:00+08:00</published><updated>2021-04-17T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-04-17:/laymansguide/issue116.html</id><summary type="html">&lt;p&gt;Hibernation mode causes the computer to store the data configuration into a hibernation file on disk. When powered up, the &lt;span class="caps"&gt;OS&lt;/span&gt; reads the data configuration from the file back into memory. This lets the system avoid having to do a full shutdown and bootup; it performs a shorter version of these two sequences&amp;nbsp;instead.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; When you shut a computer down, it sends an exit signal to all running programs to get them to do their exit routine. This process can sometimes take a long time. To preserve the data configuration in memory while minimising power draw, a computer can go into standby mode: all hardware except the memory gets powered down, until the computer is woken up from&amp;nbsp;standby.&lt;/p&gt;
&lt;p&gt;Okay, so standby/sleep mode lets you keep the data configuration in memory by putting the computer into a sort of low-power mode, where only the memory still has power while the rest of the computer is shut&amp;nbsp;down.&lt;/p&gt;
&lt;p&gt;If you’re not just going for a short jaunt; you’re maybe getting on a flight and don’t have the laptop charger with you and want your laptop to still be in the same configuration (windows open, Spotify playing, etc) &lt;em&gt;without drawing any power&lt;/em&gt; … is that&amp;nbsp;possible?&lt;/p&gt;
&lt;p&gt;By now, you know the answer is &lt;em&gt;yes&lt;/em&gt;! You just put the computer in &lt;strong&gt;hibernation&lt;/strong&gt;&amp;nbsp;mode!&lt;/p&gt;
&lt;h2&gt;Hibernation&lt;/h2&gt;
&lt;p&gt;How is it possible to preserve data configuration in memory without any power at all? Any time you notice magic like this happening, you should immediately suspect that data storage is involved&amp;nbsp;somehow.&lt;/p&gt;
&lt;p&gt;When you put a computer into hibernate, Windows dumps the contents of computer memory into a hibernation file on your storage disk (check if you&amp;nbsp;have &lt;code&gt;C:\hiberfil.sys&lt;/code&gt; on your computer disk; that’s the one), then &lt;em&gt;shuts down&lt;/em&gt; your computer. Yup, it’s a shutdown, except the programs don’t have to exit (because remember, the data configuration is already preserved). So this is much faster than a normal shutdown, but not as fast as standby which involves no shutdown at&amp;nbsp;all.&lt;/p&gt;
&lt;p&gt;When you press the power button again to bring the system back, the computer still has to go through the bootup sequence (memory was completely wiped, remember). But at the point where control is handed over to the &lt;span class="caps"&gt;OS&lt;/span&gt; (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue112.html"&gt;Issue 112&lt;/a&gt;)), the &lt;span class="caps"&gt;OS&lt;/span&gt; does not carry out its usual preparations. Instead, it reads the contents of the hibernation file into memory, then acts as though the system is already booted up! You just log in, and everything is the way it was just before hibernation (keeping fingers crossed&amp;nbsp;…)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Hibernation mode causes the computer to store the data configuration into a hibernation file on disk. When powered up, the &lt;span class="caps"&gt;OS&lt;/span&gt; reads the data configuration from the file back into memory. This lets the system avoid having to do a full shutdown and bootup; it performs a shorter version of these two sequences&amp;nbsp;instead.&lt;/p&gt;
&lt;p&gt;Okay, so that’s one more mystery&amp;nbsp;explained.&lt;/p&gt;
&lt;p&gt;One thing I didn’t think was critical to explain above, but which eventually crops up for most people, is that the hibernation file takes up a lot of space! It needs to contain all the data in memory, so if you have a laptop with &lt;span class="caps"&gt;16GB&lt;/span&gt; of memory, your hibernation file will be around that size too. If you’re wondering why Windows is taking up so much space, this is usually one of those&amp;nbsp;reasons.&lt;/p&gt;
&lt;p&gt;If you&amp;nbsp;found &lt;code&gt;C:\hiberfil.sys&lt;/code&gt;, you might have also&amp;nbsp;found &lt;code&gt;C:\pagefile.sys&lt;/code&gt;, another huge file, though not as huge as the hibernation file. What is this one used for? I’ll explain that in the season finale&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; S9] Issue 117: Swap&amp;nbsp;space&lt;/p&gt;
&lt;p&gt;Sometimes, you get a laptop with 2 or 4 &lt;span class="caps"&gt;GB&lt;/span&gt; of memory, and you wonder how it’s able to run Chrome with 46 tabs open; shouldn’t you have run out of memory by now? In the next issue, I’ll explain this trick that lets computers pretend they have more&amp;nbsp;memory!&lt;/p&gt;
&lt;p&gt;I wanted to write this issue earlier in the season, but it just never presented an opportune moment. So let’s wrap up with&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;li&gt;a driver file and why do I need one? [Issue&amp;nbsp;98]&lt;/li&gt;
&lt;li&gt;a video card? [Issue&amp;nbsp;113]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 09"></category><category term="operating system"></category></entry><entry><title>Issue 115: Shutdown &amp; standby</title><link href="https://ngjunsiang.github.io/laymansguide/issue115.html" rel="alternate"></link><published>2021-04-10T08:00:00+08:00</published><updated>2021-04-10T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-04-10:/laymansguide/issue115.html</id><summary type="html">&lt;p&gt;When you shut a computer down, it sends an exit signal to all running programs to get them to do their exit routine. This process can sometimes take a long time. To preserve the data configuration in memory while minimising power draw, a computer can go into standby mode: all hardware except the memory gets powered down, until the computer is woken up from&amp;nbsp;standby.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Embedded operating systems are unlike user operating systems. They are designed to run the software needed for an appliance’s operation, and are not meant to be used by users directly. Since they are considered somewhere between software and hardware, they are usually referred to as&amp;nbsp;firmware.&lt;/p&gt;
&lt;p&gt;In &lt;a href="https://ngjunsiang.github.io/laymansguide/issue112.html"&gt;Issue 112&lt;/a&gt;), I described the bootup process, and what a process it is! We have sayings in the English language that talk about things taking years to build up, but only seconds to destroy, and that’s certainly the case here. It takes so many steps to get data into computer memory in a way that makes it useable for us humans, and the mere press of a power switch wipes that data configuration once computer memory loses&amp;nbsp;power.&lt;/p&gt;
&lt;p&gt;This is obviously undesirable; your work in progress might not have been saved, data that is being transferred to disks might not be written properly and end up getting corrupted (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue109.html"&gt;Issue 109&lt;/a&gt;)), and you should never switch off a computer at the power socket this&amp;nbsp;way!&lt;/p&gt;
&lt;h2&gt;Forced&amp;nbsp;shutdowns&lt;/h2&gt;
&lt;p&gt;But sometimes, the computer gets itself so stuck that there’s just no other way to do it. On a laptop or smartphone, which has a built-in battery and cant be shut off immediately at the power socket, this is usually done by holding the power button for more than 10 seconds. This will literally cut off power to the mainboard&amp;nbsp;immediately.&lt;/p&gt;
&lt;p&gt;What does a proper shutdown do&amp;nbsp;differently?&lt;/p&gt;
&lt;h2&gt;Shutdown&lt;/h2&gt;
&lt;p&gt;To avoid the Problems described above, we need to give the computer time to wind down. Most programs have a proper exit routine (y’know, the red dot on macOS or the red cross in Windows). This gets the program to write any last bits of data, release any file or database locks (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue082.html"&gt;Issue 82&lt;/a&gt;)), quit, and then release its resources back to the &lt;span class="caps"&gt;OS&lt;/span&gt;. When shutting down, all running programs and services have this exit routine invoked, and they usually quit pretty&amp;nbsp;quickly.&lt;/p&gt;
&lt;p&gt;The exceptions to this usually have to do with disk operations, the slowest of operations on a computer. If a program has lots of data to save to disk, or is waiting for a disk operation to complete, it will remain open while attempting to exit, and prevent the computer from shutting down. If you’re wondering why a folder seems to be stopping the computer from shutting down, this is usually the&amp;nbsp;reason!&lt;/p&gt;
&lt;p&gt;“Wait, I’m not copying anything …” Yep, but File Explorer in Windows does more than just let you copy, paste, and delete. It also generates image and video thumbnails for you, create file indexes to speed up searching, and so on. And these are disk operations&amp;nbsp;too!&lt;/p&gt;
&lt;p&gt;On rare occasions, these disk operations can mean your computer takes up to an hour to shutdown! My best advice, if you’re not in a hurry, is to just leave it alone and let it do its thing. Much safer than having to scan for errors&amp;nbsp;later.&lt;/p&gt;
&lt;h2&gt;Standby/Sleep&lt;/h2&gt;
&lt;p&gt;On older computers, shutting down and booting up took more than 10 seconds, which is quite a killjoy when you are getting ready for a presentation and just need to stuff your laptop into a bag, get up to the conference room, and switch it on again. That feeling when you’re looking at a room full of people looking back at you, waiting for your laptop to boot up … &lt;em&gt;awkwardddddd&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Some of us just keep our laptops open (because closing the lid causes it to shut down, but you can change that in the settings by the way), and hold it that way while running around. And the purpose of that is just to keep the computer memory powered so we don’t lose the precious data configuration of the computer&amp;nbsp;memory!&lt;/p&gt;
&lt;p&gt;What if there was a way to keep power going to computer memory, but have the rest of the computer system powered off, to save on power? That would be perfect for hopping from coffee joint to coffee&amp;nbsp;joint!&lt;/p&gt;
&lt;p&gt;This is exactly what happens when you put a computer into &lt;strong&gt;standby&lt;/strong&gt; (some systems also refer to this as &lt;strong&gt;sleep&lt;/strong&gt;). The computer processor goes into a power state where only the computer memory remains powered (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue112.html"&gt;Issue 112&lt;/a&gt;)). Everything else is powered off—screen, network hardware, storage disks, … until you power the system on again. The memory configuration remains intact, and everything is exactly the way you left it at the moment you put the laptop into standby. Best of all, you didn’t have to go through the long and tedious shutdown-bootup sequence&amp;nbsp;again!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; When you shut a computer down, it sends an exit signal to all running programs to get them to do their exit routine. This process can sometimes take a long time. To preserve the data configuration in memory while minimising power draw, a computer can go into standby mode: all hardware except the memory gets powered down, until the computer is woken up from&amp;nbsp;standby.&lt;/p&gt;
&lt;p&gt;Lots of people don’t know about computer sleep, and resort to workarounds to keep their computer running while they have to move around. But now you&amp;nbsp;know.&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; S9] Issue 116:&amp;nbsp;Hibernation&lt;/p&gt;
&lt;p&gt;Sleep and hibernate; what’s the difference? As it turns out, a&amp;nbsp;lot!&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;li&gt;a driver file and why do I need one? [Issue&amp;nbsp;98]&lt;/li&gt;
&lt;li&gt;a video card? [Issue&amp;nbsp;113]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 09"></category><category term="operating system"></category></entry><entry><title>Issue 114: In the beginning (firmware)</title><link href="https://ngjunsiang.github.io/laymansguide/issue114.html" rel="alternate"></link><published>2021-04-03T08:00:00+08:00</published><updated>2021-04-03T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-04-03:/laymansguide/issue114.html</id><summary type="html">&lt;p&gt;Embedded operating systems are unlike user operating systems. They are designed to run the software needed for an appliance’s operation, and are not meant to be used by users directly. Since they are considered somewhere between software and hardware, they are usually referred to as&amp;nbsp;firmware.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; If you can’t get to a &lt;span class="caps"&gt;BIOS&lt;/span&gt; screen, it is likely a hardware problem and has to be solved by a technician. If you can’t get the the &lt;span class="caps"&gt;OS&lt;/span&gt; loading screen, it’s a bootloader problem and needs to be solved with more geekery. If something goes wrong with &lt;span class="caps"&gt;OS&lt;/span&gt; loading, and fails to fix itself on subsequent reboots, it’s probably time for a system refresh or&amp;nbsp;reinstall.&lt;/p&gt;
&lt;p&gt;In &lt;a href="https://ngjunsiang.github.io/laymansguide/issue111.html"&gt;Issue 111&lt;/a&gt;), I described the bootup process. These days, anything more complex than a calculator typically has an operating system (&lt;span class="caps"&gt;OS&lt;/span&gt;) running it. Your &lt;span class="caps"&gt;TV&lt;/span&gt; set-top box, your router, even your (high-end) printer and your car have an operating system running them these&amp;nbsp;days!&lt;/p&gt;
&lt;h2&gt;Embedded operating&amp;nbsp;systems&lt;/h2&gt;
&lt;p&gt;That &lt;span class="caps"&gt;OS&lt;/span&gt; is quite different from the one running on your laptop. It’s not meant for users to interact with directly. It primarily runs services which the appliance provides; you’re not allowed to install your own apps on it unless it has a manufacturer-approved app store or you are hacking&amp;nbsp;it.&lt;/p&gt;
&lt;p&gt;We call these &lt;strong&gt;embedded &lt;span class="caps"&gt;OS&lt;/span&gt;&lt;/strong&gt;es.&lt;/p&gt;
&lt;h2&gt;Hardware and&amp;nbsp;Software&lt;/h2&gt;
&lt;p&gt;We often see the term “hardware” used to refer to physical tools and implements that are needed for a job; they’re “hard” in the sense that they often come fixed into a certain configuration, are not easily changeable, and remain that way for the rest of their&amp;nbsp;lifetime.&lt;/p&gt;
&lt;p&gt;“Software”, on the other hand, is … fuzzier, more malleable, less clearly defined. Almost anything goes for software! This is usually the user-facing side of a&amp;nbsp;system.&lt;/p&gt;
&lt;h2&gt;Firmware&lt;/h2&gt;
&lt;p&gt;We usually consider laptop OSes to be software, because it has an installation process, you get small regular updates on it, you can add and remove features … if it looks like software, talks like software, and behaves like software, you might as well call it&amp;nbsp;software.&lt;/p&gt;
&lt;p&gt;Embedded OSes are kinda different. They come preinstalled; if they don’t, you won’t know how to install it yourself on a brand new, unprogrammed appliance. You don’t get small hotfixes and updates, only big version changes. And you can’t control what features it&amp;nbsp;has.&lt;/p&gt;
&lt;p&gt;If &lt;em&gt;soft&lt;/em&gt;ware sits at the layer nearest the user, and &lt;em&gt;hard&lt;/em&gt;ware sits at the layer nearest the machine, then I guess we’ll call the middle layer &lt;em&gt;firm&lt;/em&gt;ware.&lt;/p&gt;
&lt;p&gt;So when you see the word &lt;strong&gt;firmware&lt;/strong&gt; used in an interface, I guess you can just think of it as the “&lt;span class="caps"&gt;OS&lt;/span&gt; of the device”&amp;nbsp;:)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Embedded operating systems are unlike user operating systems. They are designed to run the software needed for an appliance’s operation, and are not meant to be used by users directly. Since they are considered somewhere between software and hardware, they are usually referred to as&amp;nbsp;firmware.&lt;/p&gt;
&lt;p&gt;Okay, that’s one thing out of the way. Now we can move on to shutdowns, sleeps, and&amp;nbsp;hibernates!&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; S9] Issue 115: Shutdown &lt;span class="amp"&gt;&amp;amp;&lt;/span&gt;&amp;nbsp;standby&lt;/p&gt;
&lt;p&gt;I often hear a lot of confusion about this in my workplaces, and from folks too. This is often the cause of many problems-that-happen-when-I-press-the-power-button. Let’s see what we can&amp;nbsp;uncover.&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;&lt;del&gt;firmware? [Issue 34]&lt;/del&gt;&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;li&gt;a driver file and why do I need one? [Issue&amp;nbsp;98]&lt;/li&gt;
&lt;li&gt;a video card? [Issue&amp;nbsp;113]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 09"></category><category term="operating system"></category></entry><entry><title>Issue 113: A computer’s existential crisis (boot failure)</title><link href="https://ngjunsiang.github.io/laymansguide/issue113.html" rel="alternate"></link><published>2021-03-27T08:00:00+08:00</published><updated>2021-03-27T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-03-27:/laymansguide/issue113.html</id><summary type="html">&lt;p&gt;f you can’t get to a &lt;span class="caps"&gt;BIOS&lt;/span&gt; screen, it is likely a hardware problem and has to be solved by a technician. If you can’t get the &lt;span class="caps"&gt;OS&lt;/span&gt; loading screen, it’s a bootloader problem and needs to be solved with more geekery. If something goes wrong with &lt;span class="caps"&gt;OS&lt;/span&gt; loading, and fails to fix itself on subsequent reboots, it’s probably time for a system refresh or&amp;nbsp;reinstall.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; When a computer is booted up, it runs the &lt;span class="caps"&gt;BIOS&lt;/span&gt; from a chip on the motherboard. The chip checks that core parts are present, checks for a storage disk containing a bootloader, loads it into memory, and hands over control. The bootloader loads the operating system kernel. The operating system kernel then does whatever it needs to do to get the system ready for&amp;nbsp;use.&lt;/p&gt;
&lt;p&gt;In this issue, doom and&amp;nbsp;gloom.&lt;/p&gt;
&lt;h2&gt;Nothing&amp;nbsp;happens&lt;/h2&gt;
&lt;p&gt;Sometimes, you press the power button and nothing happens. Absolute&amp;nbsp;stillness.&lt;/p&gt;
&lt;p&gt;This is not a software problem; something is wrong with the computer’s power source (the power supply unit of a desktop, or the battery/charging system of a laptop), and you have to bring it to a&amp;nbsp;technician.&lt;/p&gt;
&lt;h2&gt;Something happens, and then nothing&amp;nbsp;happens&lt;/h2&gt;
&lt;p&gt;If you hear fans spinning, the power source works. But if nothing appears on screen after that, and then the system seems to reboot again, it may mean the &lt;span class="caps"&gt;BIOS&lt;/span&gt; has failed; if you attempted to upgrade the &lt;span class="caps"&gt;BIOS&lt;/span&gt; recently, that might be a possible cause. A friendly geek might be able to fix this for&amp;nbsp;you.&lt;/p&gt;
&lt;p&gt;If you hear fans spinning for a long time, and things &lt;em&gt;seem&lt;/em&gt; to be happening, but nothing is showing on screen, your video card (future issue, I promise) may be borked. Can’t do anything other than sending it in to a&amp;nbsp;technician.&lt;/p&gt;
&lt;p&gt;If you have attempted a driver upgrade recently (again, future issue), that might be a possible&amp;nbsp;cause.&lt;/p&gt;
&lt;p&gt;When the &lt;span class="caps"&gt;BIOS&lt;/span&gt; works, you should see the startup screen—always a comforting&amp;nbsp;sight.&lt;/p&gt;
&lt;h2&gt;Bootloader&amp;nbsp;issues&lt;/h2&gt;
&lt;p&gt;Bootloaders are reliable as anything, so seldom anything goes wrong&amp;nbsp;here.&lt;/p&gt;
&lt;p&gt;The most common bootloader problem is that it does not detect any OSes to boot—may be the case the first time you attempt dual-boot, or get advanced enough to start playing with bootloaders (Windows and Mac don’t let you do that, so these are almost always Linux users). This is … something that can only be solved with more geekery, and is beyond the scope of this newsletter. Sorry&amp;nbsp;😬&lt;/p&gt;
&lt;h2&gt;&lt;span class="caps"&gt;OS&lt;/span&gt; booting&amp;nbsp;problems&lt;/h2&gt;
&lt;p&gt;The &lt;span class="caps"&gt;OS&lt;/span&gt;, being the most complex part of the bootup process, is often where things go&amp;nbsp;wrong.&lt;/p&gt;
&lt;p&gt;If nothing has changed in the system since the last bootup, usually things go smoothly. So it’s almost always changes to the system that cause&amp;nbsp;this.&lt;/p&gt;
&lt;p&gt;Sometimes you installed a program that dabbles in the system innards—a system-optimising program maybe—and it attempts to change some settings but without propagating them to all the required places. This leaves the system in an inconsistent&amp;nbsp;state.&lt;/p&gt;
&lt;p&gt;Sometimes you attempted a Windows Upgrade&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;, possibly a major one, and it did not go as hoped. Windows usually will attempt to undo the damage it wrought, and may or may not succeed in leaving your system in a bootable&amp;nbsp;state.&lt;/p&gt;
&lt;p&gt;Sometimes some system files get corrupted—remember that this can happen if you force a computer to power off before it has finished its shutdown properly. If the &lt;span class="caps"&gt;OS&lt;/span&gt; can’t find that file, it sometimes initiates a search for it in the system disk, which can take … really&amp;nbsp;long.&lt;/p&gt;
&lt;p&gt;In my opinion, the best way to resolve these issues, especially if they are recurring, is with a system refresh or&amp;nbsp;reinstall.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; If you can’t get to a &lt;span class="caps"&gt;BIOS&lt;/span&gt; screen, it is likely a hardware problem and has to be solved by a technician. If you can’t get the &lt;span class="caps"&gt;OS&lt;/span&gt; loading screen, it’s a bootloader problem and needs to be solved with more geekery. If something goes wrong with &lt;span class="caps"&gt;OS&lt;/span&gt; loading, and fails to fix itself on subsequent reboots, it’s probably time for a system refresh or&amp;nbsp;reinstall.&lt;/p&gt;
&lt;p&gt;I told you, gloom and doom. Modern OSes are getting more sensible at not requiring human intervention, so when they fail to resolve their own issues, there is often little a layperson can do on their&amp;nbsp;own.&lt;/p&gt;
&lt;p&gt;The best thing you can do for yourself and your data is to ensure you have a copy of your critical data elsewhere. Always have backups of things you are working&amp;nbsp;on.&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; S9] Issue 114: In the beginning&amp;nbsp;(firmware)&lt;/p&gt;
&lt;p&gt;I tried to find a place to talk about firmware in this and the previous issue, but couldn’t do so without taking the story in weird directions. So we’ll take a short detour to do that next issue, before I talk about shutdowns, sleeps, and&amp;nbsp;hibernates.&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;firmware? [Issue&amp;nbsp;34]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;li&gt;a driver file and why do I need one? [Issue&amp;nbsp;98]&lt;/li&gt;
&lt;li&gt;a video card? [Issue&amp;nbsp;113]&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 days it’s more like you attempted to stop a Windows Upgrade, but did not manage to do so or it is unskippable.&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 09"></category><category term="operating system"></category></entry><entry><title>Issue 112: Bootstrapping into existence (bootup)</title><link href="https://ngjunsiang.github.io/laymansguide/issue112.html" rel="alternate"></link><published>2021-03-20T08:00:00+08:00</published><updated>2021-03-20T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-03-20:/laymansguide/issue112.html</id><summary type="html">&lt;p&gt;When a computer is booted up, it runs the &lt;span class="caps"&gt;BIOS&lt;/span&gt; from a chip on the motherboard. The chip checks that core parts are present, checks for a storage disk containing a bootloader, loads it into memory, and hands over control. The bootloader loads the operating system kernel. The operating system kernel then does whatever it needs to do to get the system ready for&amp;nbsp;use.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Moving a file (within the same disk region) merely updates its file table record, and this happens really quickly. Copying a file, or moving it to a different disk/region, involves copying the contents and then updating the file table record, and is considerably slower. Deleting a file only requires that its file table record be removed, and is a very fast operation (if it does not involve the Recycle&amp;nbsp;Bin).&lt;/p&gt;
&lt;p&gt;We humans wake up in the morning and magically there is information in our heads. We open our eyes, trust that all our limbs and body parts are there, and we just get up and make&amp;nbsp;coffee.&lt;/p&gt;
&lt;p&gt;Computers, they are different in that regard. After they light up the power &lt;span class="caps"&gt;LED&lt;/span&gt;, there is just … nothing. Computer memory needs power to hold its information&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;, so once you really power down your computer, all data in memory is gone. Your operating system (&lt;span class="caps"&gt;OS&lt;/span&gt;), your open programs, your file data … all that now resides only in your hard disk. Whatever was not written to hard disk would have been lost by now (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue108.html"&gt;Issue 108&lt;/a&gt;)).&lt;/p&gt;
&lt;p&gt;Before anything can be done, the computer needs to read all that information back in to memory. But there’s &lt;em&gt;nothing&lt;/em&gt; in memory … you need a program loaded in memory to do that, but that program is still residing in file storage—it’s a Catch-22! The &lt;span class="caps"&gt;OS&lt;/span&gt; has to &lt;em&gt;bootstrap&lt;/em&gt; itself into existence first, in a process known as the &lt;strong&gt;bootup&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;Bootup&lt;/h2&gt;
&lt;p&gt;The way to sidestep the bootup paradox is to have a very tiny chip perform the bootstrap. This tiny chip is already wired up in a particular way from birth; it contains a program called the &lt;span class="caps"&gt;BIOS&lt;/span&gt; (short for Basic Input/Output System)&lt;sup id="fnref:2"&gt;&lt;a class="footnote-ref" href="#fn:2"&gt;2&lt;/a&gt;&lt;/sup&gt;, which does only three&amp;nbsp;things:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check that the core parts are present: &lt;span class="caps"&gt;CPU&lt;/span&gt;, memory, video card, keyboard, storage disk.&lt;br /&gt;
   At the &lt;span class="caps"&gt;BIOS&lt;/span&gt; screen&lt;sup id="fnref:3"&gt;&lt;a class="footnote-ref" href="#fn:3"&gt;3&lt;/a&gt;&lt;/sup&gt;, you can press a button to configure &lt;span class="caps"&gt;BIOS&lt;/span&gt;&amp;nbsp;settings.&lt;/li&gt;
&lt;li&gt;The &lt;span class="caps"&gt;BIOS&lt;/span&gt; checks the available disks to see if they are “bootable”, i.e. contain information in a specific part of the disk that contains a &lt;strong&gt;bootloader&lt;/strong&gt;. In modern BIOSes, you can override this process by specifying a valid disk containing the&amp;nbsp;bootloader.&lt;/li&gt;
&lt;li&gt;The &lt;span class="caps"&gt;BIOS&lt;/span&gt; loads the bootloader into memory, and runs&amp;nbsp;it.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;The&amp;nbsp;bootloader&lt;/h2&gt;
&lt;p&gt;The &lt;span class="caps"&gt;BIOS&lt;/span&gt; is not optimised—it’s only a &lt;em&gt;basic&lt;/em&gt; system after all—and would take forever to try to get the &lt;span class="caps"&gt;OS&lt;/span&gt; running on its own. So, with its limited resources, the &lt;span class="caps"&gt;BIOS&lt;/span&gt; calls in bigger guns: the &lt;strong&gt;bootloader&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The bootloader is not the &lt;span class="caps"&gt;OS&lt;/span&gt;! It has only one job: to &lt;em&gt;load&lt;/em&gt; the &lt;span class="caps"&gt;OS&lt;/span&gt; during the &lt;em&gt;boot&lt;/em&gt; process, and carry out whatever is necessary before&amp;nbsp;that.&lt;/p&gt;
&lt;p&gt;Usually, the first thing that needs to be loaded is the filesystem (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue106.html"&gt;Issue 106&lt;/a&gt;)). Without that, no program will know how to read in data from the storage disks! At this point, if the bootloader detects disk errors or uncompleted operations in the journal (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue110.html"&gt;Issue 110&lt;/a&gt;)), it may attempt to scan for errors or complete those operations before proceeding with the rest of the bootup&amp;nbsp;process.&lt;/p&gt;
&lt;p&gt;Some systems may contain multiple OSes: Mac users may want to run Windows using Parallels Desktop, Windows users may want to dabble in Linux, and many Linux users dual-boot Windows as well. The bootloader, with the help of the filesystem, detects other operating systems on the storage disks, and offers the user a choice of which one to boot. If there is only one &lt;span class="caps"&gt;OS&lt;/span&gt; found, this step might be&amp;nbsp;skipped.&lt;/p&gt;
&lt;p&gt;Once an operating system is selected, the bootloader loads the &lt;span class="caps"&gt;OS&lt;/span&gt; &lt;strong&gt;kernel&lt;/strong&gt;, which contains its core instructions, and hands control over. The bootup sequence is not yet complete, but the bootloader has completed its&amp;nbsp;job.&lt;/p&gt;
&lt;h2&gt;The operating system&amp;nbsp;startup&lt;/h2&gt;
&lt;p&gt;The operating system is not ready to accept user input at this point yet. It still has to mount other storage disks and their subregions, check that other hardware is available and working properly (such as hardware timers, which are very important for an operating system), start up various necessary services, start up programs which asked to be started up when the system boots (like the annoying Adobe Updater, or your sound card drivers and utility),&amp;nbsp;etc.&lt;/p&gt;
&lt;p&gt;Finally, when it is ready, it displays the login&amp;nbsp;screen.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; When a computer is booted up, it runs the &lt;span class="caps"&gt;BIOS&lt;/span&gt; from a chip on the motherboard. The chip checks that core parts are present, checks for a storage disk containing a bootloader, loads it into memory, and hands over control. The bootloader loads the operating system kernel. The operating system kernel then does whatever it needs to do to get the system ready for&amp;nbsp;use.&lt;/p&gt;
&lt;p&gt;This a prelude to the next issue, which is where I attempt to explain, as simply as possible, the usual things that go wrong in the bootup&amp;nbsp;process.&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; S9] Issue 113: A computer’s existential crisis (boot&amp;nbsp;failure)&lt;/p&gt;
&lt;p&gt;We’ve all been there. The computer doesn’t get to the login screen. We are shocked that our daily driver, our churner of spreadsheets, can do this to us. Worse, it has left us in an environment we are wholly unfamiliar with: a blinking cursor in a sea of black, cryptic text explaining nothing, and the unbearable pressure of a system silently begging us: fix&amp;nbsp;me.&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;del&gt;booting up? [Issue 15]&lt;/del&gt;&lt;/li&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;firmware? [Issue&amp;nbsp;34]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;li&gt;a driver file and why do I need one? [Issue&amp;nbsp;98]&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;Memory comprises lots of capacitors wired together, and capacitors slowly leak charge when they are not powered. Memory chips need periodic “refreshing” every few milliseconds to avoid losing data due to this charge leakage.&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;Modern BIOSes are no longer stored permanently on a chip, but written to flash storage (similar to a thumbdrive) that is soldered directly to the motherboard.&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;Today, this process is hidden by a branded startup screen on machines that come with Windows pre-installed. You can usually disable that screen if you like to see this bootstrap process happening.&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 09"></category><category term="memory"></category><category term="operating system"></category></entry><entry><title>Issue 111: Copying, moving, and deleting files</title><link href="https://ngjunsiang.github.io/laymansguide/issue111.html" rel="alternate"></link><published>2021-03-13T08:00:00+08:00</published><updated>2021-03-13T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-03-13:/laymansguide/issue111.html</id><summary type="html">&lt;p&gt;Moving a file (within the same disk region) merely updates its file table record, and this happens really quickly. Copying a file, or moving it to a different disk/region, involves copying the contents and then updating the file table record, and is considerably slower. Deleting a file only requires that its file table record be removed, and is a very fast operation (if it does not involve the Recycle&amp;nbsp;Bin).&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Filesystem journals are a record of changes made to the disk, so as to enable those changes to be rolled back, or to be completed properly in case of sudden&amp;nbsp;interruption.&lt;/p&gt;
&lt;p&gt;Okay, that’s enough of a look at the nitty-gritty of moving data around. In this issue, let’s turn our attention to the file table, where interesting things happen as&amp;nbsp;well.&lt;/p&gt;
&lt;h2&gt;What happens when we copy a&amp;nbsp;file?&lt;/h2&gt;
&lt;p&gt;A copy of the data is made, and moved to an available location (series of sectors) on the disk, and a new file table record is created. No magic&amp;nbsp;yet.&lt;/p&gt;
&lt;h2&gt;What happens when we move a&amp;nbsp;file?&lt;/h2&gt;
&lt;p&gt;Okay, this is slightly more complex, but not&amp;nbsp;difficult.&lt;/p&gt;
&lt;p&gt;First of all, if we are moving the data within the same disk &amp;#8230; do we really need to move the data? In layman terms, when we “move” a file, we are not actually changing its physical location in the disk. We are basically updating a file so that its stated location, which used to be something&amp;nbsp;like &lt;code&gt;C:\Users\myusername\Desktop\video.mp4&lt;/code&gt;, will&amp;nbsp;become &lt;code&gt;C:\Users\myusername\Videos\video.mp4&lt;/code&gt;. This is information &lt;em&gt;about&lt;/em&gt; the data, and is not stored with the data—it is actually stored in the file&amp;nbsp;table!&lt;/p&gt;
&lt;p&gt;So when we “move” a file within the same disk region (i.e. within the warehouse, in our earlier analogy), we are actually just updating the file table record, without copying or writing any of its contents. This is why it can seem so amazingly fast to “move” a multi-gigabyte&amp;nbsp;file.&lt;/p&gt;
&lt;p&gt;But if we are “moving” the data to a different disk, or to a different region on the same disk (e.g. moving something from&amp;nbsp;the &lt;code&gt;C:\&lt;/code&gt; region to&amp;nbsp;the &lt;code&gt;D:\&lt;/code&gt; region), it is like moving cargo from one warehouse to another. Each warehouse keeps its own file table, so we can’t merely update the file table and keep the contents on the same pallet on the rack. The cargo needs to be moved to a different warehouse, and the file table record copied over as well. For data, this means the contents are copied to the new location, the file table is updated, and if both happen without error, the original contents and file table record are&amp;nbsp;deleted.&lt;/p&gt;
&lt;h2&gt;What happens when we delete a&amp;nbsp;file?&lt;/h2&gt;
&lt;p&gt;Ah, fun times. Okay, so I suppose most of you keep your computers on the default setting, where pressing&amp;nbsp;the &lt;code&gt;Delete&lt;/code&gt; key doesn’t actually delete a file irretrievably, but simply puts it in the Recycle&amp;nbsp;Bin.&lt;/p&gt;
&lt;p&gt;And when you are deleting a lot of files &amp;#8230; you notice this can take a long time. Obviously the contents are still around (so that you can still restore them), but the file table records are now &lt;em&gt;hidden&lt;/em&gt; from the user, so that they appear to be deleted. If you are deleting 100,000 files, that is 100,000 different file table records to&amp;nbsp;update.&lt;/p&gt;
&lt;p&gt;You can, of course, change this setting (and I won’t teach you how to do that here, but it’s just a Google search away). If you disable Recycle Bin, or use&amp;nbsp;the &lt;code&gt;Shift+Delete&lt;/code&gt; hotkey combination to force a permanent deletion, something different happens instead. Intuitively, it seems like the &lt;span class="caps"&gt;OS&lt;/span&gt; should actually clear out the (digital) space previously occupied by the file contents. But this offers no advantage; to change&amp;nbsp;a &lt;code&gt;1&lt;/code&gt; to&amp;nbsp;a &lt;code&gt;0&lt;/code&gt;, you have to &lt;em&gt;write&lt;/em&gt; a 0 to it; there is no &lt;em&gt;erasing&lt;/em&gt; in the world of&amp;nbsp;storage!&lt;/p&gt;
&lt;p&gt;The faster way is to simply tell the filesystem that this file no longer exists, and the space it used to take up can now be overwritten. And that is done &amp;#8230; by simply deleting the file table record. This is a simpler operation than updating, which is why permanent deletes are so much faster than Recycle-Bin&amp;nbsp;deletes.&lt;/p&gt;
&lt;p&gt;This is also why, if you accidentally permanently deleted a file, you still have a chance of recovering it with file recovery software! The recovery software ignores the file table, and instead scans the entire disk for its actual contents, trying to see if there are any valid fragments of files left. If the space has not been overwritten by anything else, you just might be lucky enough to recover its contents. The chances of this decrease as you use the disk and write over parts of the disk which contained the file data, so this has to be done as soon as&amp;nbsp;possible.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Moving a file (within the same disk region) merely updates its file table record, and this happens really quickly. Copying a file, or moving it to a different disk/region, involves copying the contents and then updating the file table record, and is considerably slower. Deleting a file only requires that its file table record be removed, and is a very fast operation (if it does not involve the Recycle&amp;nbsp;Bin).&lt;/p&gt;
&lt;p&gt;I’ve been waiting a long time to explain this, and can finally get it out on screen.&amp;nbsp;Phew!&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; S9] Issue 112: Bootstrapping into&amp;nbsp;existence&lt;/p&gt;
&lt;p&gt;Now I can move on to something closer to the hardware, and talk about what happens when the power button is&amp;nbsp;pressed.&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;booting up? [Issue&amp;nbsp;15]&lt;/li&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;firmware? [Issue&amp;nbsp;34]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;li&gt;a driver file and why do I need one? [Issue&amp;nbsp;98]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 09"></category></entry><entry><title>Issue 110: Safeguarding against data corruption with a journal</title><link href="https://ngjunsiang.github.io/laymansguide/issue110.html" rel="alternate"></link><published>2021-03-06T08:00:00+08:00</published><updated>2021-03-06T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-03-06:/laymansguide/issue110.html</id><summary type="html">&lt;p&gt;Filesystem journals are a record of changes made to the disk, so as to enable those changes to be rolled back, or to be completed properly in case of sudden&amp;nbsp;interruption.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Fast writes dump the data to a write cache (in computer memory), then update the file table to look like the file is already written to disk. However, if power is cut before all data is properly moved from the write cache to disk, the data in memory is lost, and file corruption usually&amp;nbsp;results.&lt;/p&gt;
&lt;p&gt;Last issue, I showed how a write cache can “speed up” file write operations by allowing data to be dumped to a write cache in memory first. The &lt;span class="caps"&gt;OS&lt;/span&gt; “completes” the operation, making it look the file has been successfully written to disk, when in actuality parts of it are still in memory waiting to be written. This works fine as long as we don’t suffer catastrophic power loss before everything gets put on disk; once power is cut, all the contents of the write cache in memory are&amp;nbsp;lost!&lt;/p&gt;
&lt;p&gt;All right, we are into worst-case scenarios here. How do we recover from something like&amp;nbsp;this?&lt;/p&gt;
&lt;p&gt;The first thing we’ll need to know is what had happened; what data made it through and was written, and what data didn’t make it. We need a record of changes to the&amp;nbsp;disk.&lt;/p&gt;
&lt;h2&gt;File&amp;nbsp;journals&lt;/h2&gt;
&lt;p&gt;This record, in a filesystem, is called a journal. Keeping a journal requires more &lt;span class="caps"&gt;CPU&lt;/span&gt; cycles and can slow down file write operations somewhat, but as disk performance increases, this is increasingly considered a worthwhile tradeoff for data&amp;nbsp;reliability.&lt;/p&gt;
&lt;p&gt;The default filesystems on major OSes today are all journalled, and &lt;span class="caps"&gt;NTFS&lt;/span&gt; is no exception. I’m not going into details of how this is done, and instead will list the things that a journal enables Windows 10 to&amp;nbsp;do.&lt;/p&gt;
&lt;h2&gt;Disk recovery with a&amp;nbsp;journal&lt;/h2&gt;
&lt;p&gt;So what happens when power is cut and a computer reboots? It goes into recovery mode, where it checks the log for incomplete operations, and attempts to complete them. Any files that were “lost” (i.e. file table records that have been separated or desynced from the actual data) get moved to a separate folder, and the disk is considered okay for use&amp;nbsp;again.&lt;/p&gt;
&lt;h2&gt;Disk transaction&amp;nbsp;rollbacks&lt;/h2&gt;
&lt;p&gt;When installing a new application, sometimes you encounter that odd screen where the installation fails because something that needed to happen couldn’t happen. Oh great, the application could not complete installing, and now we have to remove it &amp;#8230; how do we undo all the things that were&amp;nbsp;done?&lt;/p&gt;
&lt;p&gt;The journal lets you see a list of all the changes that were made to the disk from the start of the installation, so that you can perform the equivalent steps to reverse their&amp;nbsp;effect.&lt;/p&gt;
&lt;h2&gt;System restore with&amp;nbsp;journals&lt;/h2&gt;
&lt;p&gt;The same thing happens with some Windows updates. Windows stores a lot of the old data as backup, in case you ever want to roll back some system changes, or return to an older version of Windows (minus some breaking updates, for example). And again, the filesystem journal lets you do that, by identifying which changes were responsible for the&amp;nbsp;update.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Filesystem journals are a record of changes made to the disk, so as to enable those changes to be rolled back, or to be completed properly in case of sudden&amp;nbsp;interruption.&lt;/p&gt;
&lt;p&gt;Journals are serious magic, and are what enable OSes to recover gracefully from a crash. They are kind of divorced from everyday experience, because it is usually unwise to mess with them directly, but I hope the past few issues explain why it is important to not get impatient with your computer when it seems a little slow moving data&amp;nbsp;round.&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; S9] Issue 111: Copying, moving, and deleting&amp;nbsp;files&lt;/p&gt;
&lt;p&gt;I am done with the more technical stuff! Now we can really move on to more everyday experiences, like copying, deleting, and moving files&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;booting up? [Issue&amp;nbsp;15]&lt;/li&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;firmware? [Issue&amp;nbsp;34]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;li&gt;a driver file and why do I need one? [Issue&amp;nbsp;98]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 09"></category><category term="memory"></category></entry><entry><title>Issue 109: Speeding up data operations</title><link href="https://ngjunsiang.github.io/laymansguide/issue109.html" rel="alternate"></link><published>2021-02-27T08:00:00+08:00</published><updated>2021-02-27T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-02-27:/laymansguide/issue109.html</id><summary type="html">&lt;p&gt;Fast writes dump the data to a write cache (in computer memory), then update the file table to look like the file is already written to disk. However, if power is cut before all data is properly moved from the write cache to disk, the data in memory is lost, and file corruption usually&amp;nbsp;results.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Safe writes ensure that all the data is written to disk sectors properly first before updating the file table. The result is that write operations take a longer time to&amp;nbsp;complete.&lt;/p&gt;
&lt;p&gt;If there’s anything to take away from the previous issue, it’s that &lt;em&gt;doing things the right way takes time&lt;/em&gt;. And sometimes we are okay with taking shortcuts to get something done faster, the &lt;em&gt;left&lt;/em&gt;&amp;nbsp;way.&lt;/p&gt;
&lt;h2&gt;The write&amp;nbsp;cache&lt;/h2&gt;
&lt;p&gt;If you have a shipment coming in that urgently needs to be dumped into the warehouse quickly (e.g. because the ship needs to leave quickly for another delivery, or to free up space on the docks), how do we speed this&amp;nbsp;up?&lt;/p&gt;
&lt;p&gt;What usually happens is the goods will be offloaded onto some empty space &lt;strong&gt;outside the warehouse&lt;/strong&gt;. The ship will leave first, and &lt;em&gt;assume&lt;/em&gt; that the warehouse will be able to get the goods in just&amp;nbsp;fine.&lt;/p&gt;
&lt;p&gt;What is the &lt;span class="caps"&gt;OS&lt;/span&gt; equivalent of this? Hard disk writes are actually pretty slow; they can get up to 100 &lt;span class="caps"&gt;MB&lt;/span&gt;/s, but usually hit a sustained speed of 60 &lt;span class="caps"&gt;MB&lt;/span&gt;/s for system disks, and about 20 &lt;span class="caps"&gt;MB&lt;/span&gt;/s over &lt;span class="caps"&gt;USB&lt;/span&gt;. The operating system therefore sets up a “dumping space” in memory; files can be read from other disks at up to 200 &lt;span class="caps"&gt;MB&lt;/span&gt;/s, and written to memory at &lt;strong&gt;a few &lt;span class="caps"&gt;GB&lt;/span&gt;/s&lt;/strong&gt;!&lt;/p&gt;
&lt;p&gt;This space is known as the &lt;strong&gt;write cache&lt;/strong&gt;. (I’ve previously covered the idea of caches in Issues &lt;a href="https://ngjunsiang.github.io/laymansguide/issue039.html"&gt;39&lt;/a&gt;) and &lt;a href="https://ngjunsiang.github.io/laymansguide/issue057.html"&gt;57&lt;/a&gt;), and the write cache works on a similar&amp;nbsp;idea.)&lt;/p&gt;
&lt;h2&gt;Speeding up file access &amp;#8230; and its&amp;nbsp;drawbacks&lt;/h2&gt;
&lt;p&gt;So how do we speed up the process of copying data to a disk? We could dump the data into the write cache (assuming there is enough space), then update the file table first, and let the &lt;span class="caps"&gt;OS&lt;/span&gt; slowly copy the data from the write cache into the disk. Anyone who needs access to the file records will then be able to go about their merry way, and if they need data from the file, they can just copy it from the disk cache instead of the disk. Easy&amp;nbsp;peasy!&lt;/p&gt;
&lt;p&gt;This was what happened in Windows &lt;span class="caps"&gt;XP&lt;/span&gt;. File copying appears to be speeded up, and users are&amp;nbsp;happy.&lt;/p&gt;
&lt;p&gt;But remember what happens when power to the computer is accidentally cut, or if a program suddenly hangs, or the computer sometimes runs out of&amp;nbsp;memory.&lt;/p&gt;
&lt;p&gt;Yup &amp;#8230; it shuts down (or reboots), and the contents of memory are wiped clean. And any data that has not been written to disk is &lt;em&gt;lost forever&lt;/em&gt;. And &amp;#8230; the file table has &lt;strong&gt;already been updated to look like there is valid data&lt;/strong&gt;!&lt;/p&gt;
&lt;p&gt;This is when things look really&amp;nbsp;bad.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Fast writes dump the data to a write cache (in computer memory), then update the file table to look like the file is already written to disk. However, if power is cut before all data is properly moved from the write cache to disk, the data in memory is lost, and file corruption usually&amp;nbsp;results.&lt;/p&gt;
&lt;p&gt;Well okay &amp;#8230; it’s not a lost cause right? Yup, we do have ways to mitigate this kind of damage, and one such way is called a&amp;nbsp;journal.&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; S9] Issue 110: Safeguarding against data corruption with a&amp;nbsp;journal&lt;/p&gt;
&lt;p&gt;Woot, answered another sometime-in-the-future question, albeit in a slightly different fashion from how I thought I would do&amp;nbsp;it.&lt;/p&gt;
&lt;p&gt;Next issue, I explain how we can still do things the fast way, &lt;em&gt;carefully&lt;/em&gt;.&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;booting up? [Issue&amp;nbsp;15]&lt;/li&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;firmware? [Issue&amp;nbsp;34]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;li&gt;a driver file and why do I need one? [Issue&amp;nbsp;98]&lt;/li&gt;
&lt;li&gt;&lt;del&gt;why does computer memory exist when apps can read directly from the hard disk? [Issue 105]&lt;/del&gt;&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 09"></category><category term="cache"></category><category term="memory"></category></entry><entry><title>Issue 108: Safeguarding data operations</title><link href="https://ngjunsiang.github.io/laymansguide/issue108.html" rel="alternate"></link><published>2021-02-20T08:00:00+08:00</published><updated>2021-02-20T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-02-20:/laymansguide/issue108.html</id><summary type="html">&lt;p&gt;Safe writes ensure that all the data is written to disk sectors properly first before updating the file table. The result is that write operations take a longer time to&amp;nbsp;complete.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; When write operations are interrupted prematurely, filesystem corruption often&amp;nbsp;results.&lt;/p&gt;
&lt;p&gt;When a batch of data (shipment of cargo)) arrives at our warehouse, there are two things that need&amp;nbsp;doing:&lt;/p&gt;
&lt;p&gt;1) The data needs to be written into sectors (the smallest unit of storage that the disk handles),
2) The file table needs to be&amp;nbsp;updated.&lt;/p&gt;
&lt;h2&gt;Writing data the safe&amp;nbsp;way&lt;/h2&gt;
&lt;p&gt;If the write operation gets interrupted, it is preferable that our file table is not updated; this way, we will not find any reference to the data in the file table, and we can attempt the write operation&amp;nbsp;again.&lt;/p&gt;
&lt;p&gt;This will appear strange in a warehouse analogy; the cargo, damaged or intact, is still occupying space on the racks! But remember that when we are talking about a hard disk storing data, there is no &lt;em&gt;physical cargo&lt;/em&gt;; the data exists as a specific arrangement of electrons/atoms. We can override the existing arrangement of electrons/atoms without having to reset it&amp;nbsp;first.&lt;/p&gt;
&lt;h2&gt;Drawbacks of safe&amp;nbsp;writing&lt;/h2&gt;
&lt;p&gt;This way of storing data first before updating the file table is advantageous in its security; if the write operation is interrupted halfway, we are less likely to suffer filesystem&amp;nbsp;corruption.&lt;/p&gt;
&lt;p&gt;But for large batches of data (or large shipments of cargo), this means a long wait &amp;#8230; and in the meantime, nothing else can happen! Hard drives only have one writing needle, which is like a warehouse only having one forklift. If you have other applications waiting for that file (similar to other employees waiting for the file record to appear in the file table), they will be twiddling their thumbs until the last sector of data is written, the last pallet of cargo loaded onto the&amp;nbsp;racks.&lt;/p&gt;
&lt;p&gt;But this is the &lt;em&gt;right thing to do&lt;/em&gt;, isn’t it? It doesn’t matter; &lt;a href="https://blog.codinghorror.com/actual-performance-perceived-performance/"&gt;Windows Vista did it this way&lt;/a&gt;, waiting for write operations to complete before updating the file metadata in the file table, and the result is that &lt;em&gt;people complained that it was slower&lt;/em&gt;. People do not like things&amp;nbsp;slow!&lt;/p&gt;
&lt;p&gt;Why did Windows &lt;span class="caps"&gt;XP&lt;/span&gt; feel faster, then? Because it did it the other way&amp;nbsp;round!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Safe writes ensure that all the data is written to disk sectors properly first before updating the file table. The result is that write operations take a longer time to&amp;nbsp;complete.&lt;/p&gt;
&lt;p&gt;Actually, Windows 10 uses a system similar to this for mounting portable devices (&lt;span class="caps"&gt;USB&lt;/span&gt; hard drives, flash drives, etc) by default. They sped it up in other ways. So if you accidentally unplug a drive before it is completely done writing &amp;#8230; usually it won’t completely screw things&amp;nbsp;up.&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; S9] Issue 109: Speeding up data&amp;nbsp;operations&lt;/p&gt;
&lt;p&gt;If you want, there are settings you can adjust to make Windows 10 access a portable device &lt;em&gt;the fast way&lt;/em&gt;. I don’t teach it here, because this is not the newsletter for it. But we’ll see how &lt;em&gt;the fast way&lt;/em&gt; works in the 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;booting up? [Issue&amp;nbsp;15]&lt;/li&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;firmware? [Issue&amp;nbsp;34]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;li&gt;a driver file and why do I need one? [Issue&amp;nbsp;98]&lt;/li&gt;
&lt;li&gt;why does computer memory exist when apps can read directly from the hard disk? [Issue&amp;nbsp;105]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 09"></category></entry><entry><title>Issue 107: The challenges of storage</title><link href="https://ngjunsiang.github.io/laymansguide/issue107.html" rel="alternate"></link><published>2021-02-13T08:00:00+08:00</published><updated>2021-02-13T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-02-13:/laymansguide/issue107.html</id><summary type="html">&lt;p&gt;When write operations are interrupted prematurely, filesystem corruption often&amp;nbsp;results.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; A hard disk is organised into sectors, which are the smallest unit of storage. The &lt;span class="caps"&gt;OS&lt;/span&gt;’s filesystem determines how and where to store each file on the hard disk. The filesystem manages the file metadata in a file table, separate from the actual contents of the&amp;nbsp;file.&lt;/p&gt;
&lt;p&gt;Last issue I painted the picture of a warehouse, where cargo gets stored in racks, their contents and details are stored in the file table (in the warehouse office), and we can easily look up the details of each shipment of cargo without having to inspect rack by&amp;nbsp;rack.&lt;/p&gt;
&lt;p&gt;Let’s screw things up here, shall&amp;nbsp;we?&lt;/p&gt;
&lt;h2&gt;Read/write&amp;nbsp;failure&lt;/h2&gt;
&lt;p&gt;As mechanical devices, hard disks are prone to failure; I’ll go into detail why in a future season on hardware. Remember that when this hard drive is housed in a computer, that computer can get disturbed by shocks or jolts. If it is housed in an external &lt;span class="caps"&gt;USB&lt;/span&gt; enclosure, sometimes we do terrible things to that enclosure &amp;#8230; like when we drop them (usually accidentally&amp;nbsp;😬).&lt;/p&gt;
&lt;p&gt;This is like the warehouse experiencing an earthquake. Sometimes, a small earthquake may be uneventful &amp;#8230; other times, we might even get away with a moderate earthquake, if nothing is happening in the warehouse. But if it happens while a forklift is carrying out a precarious loading operation &amp;#8230;&amp;nbsp;🙈&lt;/p&gt;
&lt;p&gt;Well, that’s terrible. We’ll have to write off that shipment. Luckily, we can analogy here; data can always be re-copied again. The problem is &amp;#8230; when a shipment comes in, we have to load the shipment onto the rack, &lt;em&gt;and&lt;/em&gt; update the file table, so that its contents match whatever is on the racks. Which should we do first? If the loading is uneventful, it doesn’t really matter; after 5 minutes or so, both the file table and the racks will be in sync. But if the earthquake happens during this loading, they won’t&amp;nbsp;be!&lt;/p&gt;
&lt;p&gt;We don’t need an earthquake to screw things up. Remember that a hard drive, or even a flash drive, needs power to run. When we unplug a hard disk or flash drive while it is still operating, it’s like cutting power to the entire warehouse (including its forklifts) at the same time. If nothing is happening in the warehouse, it is safe to do so. But if there are ongoing operations, well you don’t need me to tell you that’s not a good&amp;nbsp;idea.&lt;/p&gt;
&lt;h2&gt;Reads are usually&amp;nbsp;safe&lt;/h2&gt;
&lt;p&gt;Okay, we’ll have to step away from the warehouse analogy for a bit when we talk about reading data from a hard drive; this is usually safe, because unlike cargo, reading data does not destroy the existing copy. We can mount a filesystem (i.e. gain access to it) for reading only, which will protect it from accidentally having its data&amp;nbsp;overwritten.&lt;/p&gt;
&lt;p&gt;It is the writes that always get us. When a write operation does not go smoothly, the result is usually filesystem corruption; the file table is no longer up to date, or worse, some parts of it might be improperly written, resulting in the company no longer knowing what is on the warehouse&amp;nbsp;racks.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; When write operations are interrupted prematurely, filesystem corruption often&amp;nbsp;results.&lt;/p&gt;
&lt;p&gt;There are two ways we can try to get data onto the disk (get cargo into the warehouse): Write the data first, then update the file table, or vice-versa. Which way is better? We’ll compare the pros and cons in the next&amp;nbsp;issue.&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; S9] Issue 108: Safeguarding data&amp;nbsp;operations&lt;/p&gt;
&lt;p&gt;That remove-safely thing we all hate to do when we unplug our hard drives? Yeah I’m getting to that&amp;nbsp;part.&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;booting up? [Issue&amp;nbsp;15]&lt;/li&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;firmware? [Issue&amp;nbsp;34]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;li&gt;a driver file and why do I need one? [Issue&amp;nbsp;98]&lt;/li&gt;
&lt;li&gt;why does computer memory exist when apps can read directly from the hard disk? [Issue&amp;nbsp;105]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 09"></category></entry><entry><title>Issue 106: Organising storage</title><link href="https://ngjunsiang.github.io/laymansguide/issue106.html" rel="alternate"></link><published>2021-02-06T08:00:00+08:00</published><updated>2021-02-06T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-02-06:/laymansguide/issue106.html</id><summary type="html">&lt;p&gt;A hard disk is organised into sectors, which are the smallest unit of storage. The &lt;span class="caps"&gt;OS&lt;/span&gt;’s filesystem determines how and where to store each file on the hard disk. The filesystem manages the file metadata in a file table, separate from the actual contents of the&amp;nbsp;file.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; The &lt;span class="caps"&gt;OS&lt;/span&gt; takes care of booting up, login and user management, window management, memory allocation, storage interfaces, background services, peripheral management, and much more. Access to these services, where allowed, is provided in the form of software libraries that developers can&amp;nbsp;use.&lt;/p&gt;
&lt;p&gt;So far, what we understand about storage is that apps send data to an operating system (&lt;span class="caps"&gt;OS&lt;/span&gt;), which then stores it on storage devices (such as hard disks, solid state disks, etc) for later retrieval. And in &lt;a href="https://ngjunsiang.github.io/laymansguide/issue099.html"&gt;Issues 99&lt;/a&gt;) &lt;span class="amp"&gt;&amp;amp;&lt;/span&gt; &lt;a href="https://ngjunsiang.github.io/laymansguide/issue100.html"&gt;100&lt;/a&gt;), I explained that eventually everything gets stored as a&amp;nbsp;file.&lt;/p&gt;
&lt;p&gt;What exactly is a&amp;nbsp;file?&lt;/p&gt;
&lt;h2&gt;Files in operating&amp;nbsp;systems&lt;/h2&gt;
&lt;p&gt;Let’s start from what we know about files. When we open File Explorer in Windows and open any folder (aka &lt;strong&gt;directory&lt;/strong&gt;), we see a bunch of things with colourful icons, that we know of as files. And we also see things with folder icons that we know as folders (or&amp;nbsp;directories).&lt;/p&gt;
&lt;p&gt;They also have additional details displayed alongside them, such as the date/time (henceforth referred to as datetime) it was created, the last datetime it was modified, and the last datetime it was accessed. You might also get additional information, such as what type of file it is, its size, the user who owns that file, etc—in other words, the &lt;strong&gt;metadata&lt;/strong&gt; of the file. That’s a fancy word to refer to data (datetime, filetype, size, …) &lt;em&gt;about&lt;/em&gt; the data (the&amp;nbsp;files).&lt;/p&gt;
&lt;p&gt;Now, a brief introduction to the hardware, where the actual files get&amp;nbsp;stored.&lt;/p&gt;
&lt;h2&gt;Introducing&amp;nbsp;storage&lt;/h2&gt;
&lt;p&gt;When you buy a hard drive (or solid state drive) and connect it up to your computer (or laptop), the computer does not have fine-grained control over every bit of storage. Instead, the hard drive gets presented as a huge volume of space, like a&amp;nbsp;warehouse.&lt;/p&gt;
&lt;p&gt;This volume is organised into &lt;strong&gt;sectors&lt;/strong&gt; (these days, a modern hard drive sector is 4KiB), which are the smallest unit of storage on a hard disk. If you have to store 1KiB of data, it will still take up an entire sector; the rest of the space is filled with zeroes. This is similar to the way a warehouse is managed by pallets, and not by single cardboard boxes. If your shipment does not fill the entire pallet, the rest of the space is&amp;nbsp;“wasted”.&lt;/p&gt;
&lt;p&gt;Each sector has an address (yes, just like memory!). To store data on the hard disk, the &lt;span class="caps"&gt;OS&lt;/span&gt; has to “tell” the hard disk a) what data to store, and b) the address at which to store the&amp;nbsp;data.&lt;/p&gt;
&lt;p&gt;The hard drive itself does not inherently have any system for managing your files or folders; it can’t tell you&amp;nbsp;where &lt;code&gt;draft1.docx&lt;/code&gt; is stored, nor tell you what the size is. It only takes care of storing data at addresses, and retrieving data from&amp;nbsp;addresses!&lt;/p&gt;
&lt;h2&gt;Managing&amp;nbsp;storage&lt;/h2&gt;
&lt;p&gt;And this is where the operating system comes in. An operating system installing itself is like a company occupying a warehouse. You’ve got to impose some kind of order on the&amp;nbsp;space!&lt;/p&gt;
&lt;p&gt;In an operating system, this job is delegated to the &lt;strong&gt;file system&lt;/strong&gt;, a sort of facility director who manages the storage space. Windows uses &lt;a href="https://en.wikipedia.org/wiki/NTFS"&gt;&lt;span class="caps"&gt;NT&lt;/span&gt; File System&lt;/a&gt; (&lt;strong&gt;&lt;span class="caps"&gt;NTFS&lt;/span&gt;&lt;/strong&gt;) for its own space, MacOS uses &lt;a href="https://en.wikipedia.org/wiki/High_Performance_File_System"&gt;High Performance File System&lt;/a&gt; (&lt;strong&gt;&lt;span class="caps"&gt;HPFS&lt;/span&gt;&lt;/strong&gt;), while portable storage devices (e.g. &lt;span class="caps"&gt;USB&lt;/span&gt; drives) often use &lt;a href="https://en.wikipedia.org/wiki/File_Allocation_Table"&gt;File Allocation Table&lt;/a&gt; (&lt;span class="caps"&gt;FAT&lt;/span&gt;).&lt;/p&gt;
&lt;p&gt;An operating system that is not “aware” of other filesystems will not be able to read storage devices formatted with those filesystems. This is why you can’t just take out a disk from a Mac system and expect it to open in Windows when plugged in. Windows can read &lt;span class="caps"&gt;HPFS&lt;/span&gt; disks, but cannot write data to them. Both OSes can handle &lt;span class="caps"&gt;FAT&lt;/span&gt; (phew!), which is why it is possible to pass files from a Windows user to a Mac user with a portable flash&amp;nbsp;disk.&lt;/p&gt;
&lt;h2&gt;How filesystems&amp;nbsp;work&lt;/h2&gt;
&lt;p&gt;Intuitively, we might imagine that the metadata for each file gets stored with its data. This is like storing the shipment details of each package with the package itself. But when you need to find a particular shipment in the warehouse, you can’t be checking every single&amp;nbsp;rack!&lt;/p&gt;
&lt;p&gt;Instead, you would store shipment records in a master file, usually in some kind of separate office, which would list the shipment details alongside the location of the cargo (e.g. by rack number and level). The equivalent of this master file on a filesystem is the &lt;strong&gt;file table&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In &lt;span class="caps"&gt;NTFS&lt;/span&gt;, this is the Master File Table (&lt;span class="caps"&gt;MFT&lt;/span&gt;). The &lt;span class="caps"&gt;MFT&lt;/span&gt; lists all the files on the disk (by their full path,&amp;nbsp;e.g. &lt;code&gt;C:\Windows\system32\notepad.exe&lt;/code&gt;), along with its metadata. This makes it easy for Windows to show you the data quickly when you open any folder in File Explorer; it can get all this data from the &lt;span class="caps"&gt;MFT&lt;/span&gt;&amp;nbsp;easily!&lt;/p&gt;
&lt;p&gt;Sounds peachy. What can go wrong with this&amp;nbsp;picture?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; A hard disk is organised into sectors, which are the smallest unit of storage. The &lt;span class="caps"&gt;OS&lt;/span&gt;’s filesystem determines how and where to store each file on the hard disk. The filesystem manages the file metadata in a file table, separate from the actual contents of the&amp;nbsp;file.&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; S9] Issue 107: The challenges of&amp;nbsp;storage&lt;/p&gt;
&lt;p&gt;This is where I talk about all the ways we make life difficult for computers, but easier for ourselves. Like unplugging &lt;span class="caps"&gt;USB&lt;/span&gt; drives before removing them safely&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;booting up? [Issue&amp;nbsp;15]&lt;/li&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;firmware? [Issue&amp;nbsp;34]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;li&gt;&lt;del&gt;How do apps know where a file starts and ends? [Issue 49]&lt;/del&gt;&lt;/li&gt;
&lt;li&gt;a driver file and why do I need one? [Issue&amp;nbsp;98]&lt;/li&gt;
&lt;li&gt;why does computer memory exist when apps can read directly from the hard disk? [Issue&amp;nbsp;105]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 09"></category><category term="operating system"></category></entry><entry><title>Issue 105: Operating Systems</title><link href="https://ngjunsiang.github.io/laymansguide/issue105.html" rel="alternate"></link><published>2021-01-30T08:00:00+08:00</published><updated>2021-01-30T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-01-30:/laymansguide/issue105.html</id><summary type="html">&lt;p&gt;The &lt;span class="caps"&gt;OS&lt;/span&gt; takes care of booting up, login and user management, window management, memory allocation, storage interfaces, background services, peripheral management, and much more. Access to these services, where allowed, is provided in the form of software libraries that developers can&amp;nbsp;use.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Shared secrets allow secured access to resources, such as databases or other services. These shared secrets are typically kept on a server controlled by the app developer. For mobile apps, they are usually stored with the operating system, inaccessible to other&amp;nbsp;apps.&lt;/p&gt;
&lt;p&gt;Last season, I explained the differences between web apps, mobile apps, and laptop apps. Web apps operate in a browser environment, mobile apps operate in a mobile operating system (&lt;span class="caps"&gt;OS&lt;/span&gt;) environment, and laptop apps operate in a desktop &lt;span class="caps"&gt;OS&lt;/span&gt;&amp;nbsp;environment.&lt;/p&gt;
&lt;p&gt;The &lt;span class="caps"&gt;OS&lt;/span&gt; is that complex piece of software between the apps and the hardware that runs it all. The hardware speaks its own special code, while apps are run in machine code written for the &lt;span class="caps"&gt;CPU&lt;/span&gt;. The &lt;span class="caps"&gt;OS&lt;/span&gt; makes sure that everything runs&amp;nbsp;smoothly.&lt;/p&gt;
&lt;p&gt;What does &lt;strong&gt;everything&lt;/strong&gt;&amp;nbsp;entail?&lt;/p&gt;
&lt;h2&gt;What an operating system&amp;nbsp;does&lt;/h2&gt;
&lt;h3&gt;1.&amp;nbsp;Boot-up&lt;/h3&gt;
&lt;p&gt;When the machine is powered on, how does it know what hardware is available? This hardware discovery is done by the bootloader (which for the purposes of explanation we can consider as part of the &lt;span class="caps"&gt;OS&lt;/span&gt;). It checks for the available hardware resources, and compiles a list of them for the operating system. Added some memory? Added a new hard drive? The bootloader should detect&amp;nbsp;it.&lt;/p&gt;
&lt;h3&gt;2. Login and user&amp;nbsp;management&lt;/h3&gt;
&lt;p&gt;While a personal computer (&lt;span class="caps"&gt;PC&lt;/span&gt;) might have only one user, many PCs are used by more than one person. Multiple login accounts allow each user to have their own space on the computer for their&amp;nbsp;files.&lt;/p&gt;
&lt;p&gt;In addition to the user accounts, an operating system also creates multiple system accounts to manage services on the &lt;span class="caps"&gt;OS&lt;/span&gt;.&lt;/p&gt;
&lt;h3&gt;3. Window&amp;nbsp;management&lt;/h3&gt;
&lt;p&gt;Ever wondered how apps on a &lt;span class="caps"&gt;PC&lt;/span&gt; can have their windows styled so similarly? That’s because the &lt;span class="caps"&gt;OS&lt;/span&gt; provides a standardised window style for apps, with standardised actions that can be performed (maximise, minimise, close, resize, …). Apps can choose not to use this standardised window style, but then they are on their own when it comes to window styling, and they will have to write their own code for all of these&amp;nbsp;actions.&lt;/p&gt;
&lt;h3&gt;4. Memory allocation and&amp;nbsp;deallocation&lt;/h3&gt;
&lt;p&gt;Applications primarily run off computer memory, which is a hundred times faster than the hard disk (I’ll explain more in a future season). When an application is first launched, it is allocated a small amount of memory space for its data. If it wants more, it can’t just reach for the memory space and grab more chunks as needed; other apps are using memory as well, and it might inadvertently overwrite data stored by other&amp;nbsp;apps.&lt;/p&gt;
&lt;p&gt;So instead, access to memory is mediated by the &lt;span class="caps"&gt;OS&lt;/span&gt;. All requests for more memory are sent to the &lt;span class="caps"&gt;OS&lt;/span&gt;, which will return addresses for available chunks of memory. And any memory that the app frees up is released back into the common pool, for use by other&amp;nbsp;apps.&lt;/p&gt;
&lt;h3&gt;5. Storage&amp;nbsp;interfaces&lt;/h3&gt;
&lt;p&gt;Applications do not need to know how the user has their computer set up: what kind of disks they have, or which disk they put the &lt;span class="caps"&gt;OS&lt;/span&gt; on. But what if they need to allow the user to save a file, or load an existing file? The &lt;span class="caps"&gt;OS&lt;/span&gt; provides standard interfaces for doing so—you would likely have seen the “Select A File” interface on any &lt;span class="caps"&gt;OS&lt;/span&gt;. The &lt;span class="caps"&gt;OS&lt;/span&gt; takes care of file reading and writing, sparing the application developers from having to worry about the&amp;nbsp;details.&lt;/p&gt;
&lt;h3&gt;6. Background&amp;nbsp;services&lt;/h3&gt;
&lt;p&gt;Applications run by the user typically expect input only from one user; if you are running Microsoft Word at the same time as your sister, each instance of Microsoft Word expects to interact with either you or sister. However, there are special system applications that often have to deal with input from multiple users. For example, antivirus software or Windows Printer Management need to run for all users at the same time, and should not be terminated like a typical&amp;nbsp;program.&lt;/p&gt;
&lt;p&gt;These applications thus run differently: they run as background services, which are special applications which do not interact with the desktop. Background services are managed differently from applications, and typically can only be terminated by the system&amp;nbsp;administrator.&lt;/p&gt;
&lt;h3&gt;7. Peripheral&amp;nbsp;management&lt;/h3&gt;
&lt;p&gt;Do you use Bluetooth wireless headphones? &lt;span class="caps"&gt;USB&lt;/span&gt; devices of any sort? Did you just buy a new gamepad? The &lt;span class="caps"&gt;OS&lt;/span&gt; detects them and takes care of driver installation (usually). You can see all detected devices and installed drivers in the Device Manager, under Control Panel, in Windows&amp;nbsp;10.&lt;/p&gt;
&lt;p&gt;I’ve just covered the main ones that most users would use on a regular basis. The &lt;span class="caps"&gt;OS&lt;/span&gt; manages much more stuff, including &lt;span class="caps"&gt;OS&lt;/span&gt; updates, per-user settings, etc—remember the Registry Editor? (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue100.html"&gt;Issue 100&lt;/a&gt;)) For a look at what else the &lt;span class="caps"&gt;OS&lt;/span&gt; manages, take a peek in the Control Panel or System Preferences of your &lt;span class="caps"&gt;OS&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;These form a supporting network of services that applications can draw on. Instead of having to work out the full details of implementation for each of these features, they can use the &lt;span class="caps"&gt;OS&lt;/span&gt;’s provided functions to do the work for them. These functions are typically bundled in a standard library (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue017.html"&gt;Issue 17&lt;/a&gt;)) provided by the &lt;span class="caps"&gt;OS&lt;/span&gt; manufacturer. For example, &lt;a href="https://dotnet.microsoft.com/"&gt;.&lt;span class="caps"&gt;NET&lt;/span&gt;&lt;/a&gt; is a collection of libraries for Windows applications that developers can use to simplify their&amp;nbsp;work.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; The &lt;span class="caps"&gt;OS&lt;/span&gt; takes care of booting up, login and user management, window management, memory allocation, storage interfaces, background services, peripheral management, and much more. Access to these services, where allowed, is provided in the form of software libraries that developers can&amp;nbsp;use.&lt;/p&gt;
&lt;p&gt;I’ve touched on per-user data storage in Season 8, and on memory allocation in Season 5, so I will skip those for the rest of this season. Window management and background services isn’t going to be interesting for a layman’s guide, so let’s skip those too. Instead, I will try to set the stage for a next season about hardware, by explaining more about how storage and computer peripherals work, and how the operating system simplifies access to them. and then I’ll get to booting up—how a computer gets ready from the moment you press the power&amp;nbsp;button.&lt;/p&gt;
&lt;p&gt;If I still have issues left after that, I might geek out a bit and talk about fonts&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; S9] Issue 106: Organising&amp;nbsp;storage&lt;/p&gt;
&lt;p&gt;First up: How exactly is data organised in the hard disk? How does an operating system manage it&amp;nbsp;all?&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;booting up? [Issue&amp;nbsp;15]&lt;/li&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;firmware? [Issue&amp;nbsp;34]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;li&gt;How do apps know where a file starts and ends? [Issue&amp;nbsp;49]&lt;/li&gt;
&lt;li&gt;a driver file and why do I need one? [Issue&amp;nbsp;98]&lt;/li&gt;
&lt;li&gt;why does computer memory exist when apps can read directly from the hard disk? [Issue&amp;nbsp;105]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 09"></category><category term="memory"></category><category term="operating system"></category></entry></feed>