<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Layman's Guide to Computing - Season 10</title><link href="https://ngjunsiang.github.io/laymansguide/" rel="alternate"></link><link href="https://ngjunsiang.github.io/laymansguide/feeds/season-10.atom.xml" rel="self"></link><id>https://ngjunsiang.github.io/laymansguide/</id><updated>2021-07-24T08:00:00+08:00</updated><entry><title>Issue 130: Power limits</title><link href="https://ngjunsiang.github.io/laymansguide/issue130.html" rel="alternate"></link><published>2021-07-24T08:00:00+08:00</published><updated>2021-07-24T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-07-24:/laymansguide/issue130.html</id><summary type="html">&lt;p&gt;&lt;span class="caps"&gt;AC&lt;/span&gt; power from the wall uses electric current that alternates directions, while &lt;span class="caps"&gt;DC&lt;/span&gt; power from batteries uses electric current that flows in one direction only. All electronics are &lt;span class="caps"&gt;DC&lt;/span&gt;-only, and require an &lt;span class="caps"&gt;AC&lt;/span&gt;-&lt;span class="caps"&gt;DC&lt;/span&gt; adapter to be powered from the wall. The &lt;span class="caps"&gt;AC&lt;/span&gt;-&lt;span class="caps"&gt;DC&lt;/span&gt; conversion produces a significant amount of heat; &lt;span class="caps"&gt;AC&lt;/span&gt;-&lt;span class="caps"&gt;DC&lt;/span&gt; adapters are usually external unless the device has sufficient space or cooling capacity for&amp;nbsp;it.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; The larger the surface area, the faster an object loses heat. The larger the temperature difference between an object and its surroundings, the faster the object loses heat. Heat is bad for computers, and CPUs will need cooling to be able to process computations quickly. A mobile phone thus typically uses no more than 4 W of power, a laptop can use 25–45 W, and a desktop can usually use 65 W and more. Two popular ways of increasing the cooling capacity of a device is to attach a larger piece of metal to the chip (passive cooling), or use a fan to force air over the heatsink (active&amp;nbsp;cooling).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Point 1:&lt;/strong&gt; A powerful device produces lots of heat.&lt;br /&gt;
&lt;strong&gt;Point 2:&lt;/strong&gt; A device that produces lots of heat needs a large surface area (directly in contact with the heat source) to stay (relatively)&amp;nbsp;cool.&lt;/p&gt;
&lt;p&gt;These are two of the primary factors determining how tiny a computer can be. Can something the size of an iPhone be as powerful as something the size of a Macbook? It depends on how much cooling is available to&amp;nbsp;it!&lt;/p&gt;
&lt;p&gt;One more factor to add in this issue: power. Without power, none of your devices would work &amp;#8230; and that is one more source of heat to be dissipated,&amp;nbsp;incidentally.&lt;/p&gt;
&lt;h2&gt;Batteries and &lt;span class="caps"&gt;DC&lt;/span&gt;&amp;nbsp;power&lt;/h2&gt;
&lt;p&gt;Some devices need to carry their own stored energy (in the form of batteries); the devices are powered by direct current (&lt;span class="caps"&gt;DC&lt;/span&gt;) from batteries. In this form of power transmission, electric current only flows one way—this is why it is important to put batteries in the right way! Electric current comes out from one end, and re-enters from the other end, marked with + and –&amp;nbsp;symbols.&lt;/p&gt;
&lt;p&gt;Batteries seldom provide power at the voltage required by devices and CPUs. For example, smartphone batteries usually have a voltage of about 3.7 V, even though the &lt;span class="caps"&gt;CPU&lt;/span&gt; usually requires about 1 V to operate. This allows the batteries to power the device with a low current&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;, so as to minimise the heating effect of current in the&amp;nbsp;wires.&lt;/p&gt;
&lt;p&gt;That means some power conversion has to take place on the smartphone’s mainboard. Fortunately, &lt;span class="caps"&gt;DC&lt;/span&gt;-to-&lt;span class="caps"&gt;DC&lt;/span&gt; conversion is highly efficient (though not 100%), so it doesn’t contribute much heat in the&amp;nbsp;device.&lt;/p&gt;
&lt;h2&gt;Wall sockets and &lt;span class="caps"&gt;AC&lt;/span&gt;&amp;nbsp;power&lt;/h2&gt;
&lt;p&gt;On the other hand, alternating current (&lt;span class="caps"&gt;AC&lt;/span&gt;) from wall sockets has electric current flowing both ways—the current switches directions 50 or 60 times a second (see &lt;a href="https://www.oaktreeproducts.com/img/product/description/List%20of%20Worldwide%20AC%20Voltages.pdf"&gt;this &lt;span class="caps"&gt;PDF&lt;/span&gt; of Worldwide &lt;span class="caps"&gt;AC&lt;/span&gt; Voltages &lt;span class="amp"&gt;&amp;amp;&lt;/span&gt; Frequencies&lt;/a&gt;). Connecting this directly to a device that needs &lt;span class="caps"&gt;DC&lt;/span&gt; is looking for trouble! This &lt;span class="caps"&gt;AC&lt;/span&gt; power source has to be converted to &lt;span class="caps"&gt;DC&lt;/span&gt; through an &lt;strong&gt;&lt;span class="caps"&gt;AC&lt;/span&gt;-&lt;span class="caps"&gt;DC&lt;/span&gt; converter&lt;/strong&gt; (a.k.a. “power brick”, “power supply”, “&lt;span class="caps"&gt;AC&lt;/span&gt; adapter”, …), and that process currently only goes up to 90% peak efficiency&lt;sup id="fnref:2"&gt;&lt;a class="footnote-ref" href="#fn:2"&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;That means if you have a desktop running at 100W (maybe while gaming or encoding video files), the &lt;em&gt;&lt;span class="caps"&gt;AC&lt;/span&gt;-&lt;span class="caps"&gt;DC&lt;/span&gt; converter alone&lt;/em&gt; draws 111W at the wall socket, &lt;strong&gt;wastes 11W&lt;/strong&gt; (in the form of heat), and provides 100W of power to the&amp;nbsp;desktop.&lt;/p&gt;
&lt;p&gt;And heat is the enemy of&amp;nbsp;CPUs.&lt;/p&gt;
&lt;h2&gt;External vs internal power&amp;nbsp;supplies&lt;/h2&gt;
&lt;p&gt;Ughh, power bricks … so many different types, with different connectors, and we never quite know if we can use one laptop’s power brick on another laptop (at least, until &lt;span class="caps"&gt;USB&lt;/span&gt; Type-C power for laptops came along; more in &lt;a href="https://ngjunsiang.github.io/laymansguide/issue127.html"&gt;Issue 127&lt;/a&gt;))&lt;/p&gt;
&lt;p&gt;In a laptop, you really do not want the power supply dumping this heat &lt;em&gt;into the laptop&lt;/em&gt;! The laptop already has enough work to do getting heat from the &lt;span class="caps"&gt;CPU&lt;/span&gt; out of that cramped space into the surroundings. You don’t want to give it more heat to remove, and risk throttling the &lt;span class="caps"&gt;CPU&lt;/span&gt;’s performance (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue129.html"&gt;Issue 129&lt;/a&gt;)). It’s better that the &lt;span class="caps"&gt;AC&lt;/span&gt; converter/power brick remains external to the laptop, dumping that heat into the surroundings directly without heating up the laptop’s internal&amp;nbsp;space.&lt;/p&gt;
&lt;p&gt;&lt;img alt="An Apple power adapter, with the cover removed" src="https://ngjunsiang.github.io/laymansguide/issue130_01.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;The internals of the Apple &lt;span class="caps"&gt;AC&lt;/span&gt; converter (i.e. power adapter)&lt;br /&gt;Source: &lt;a href="http://www.righto.com/2015/11/macbook-charger-teardown-surprising.html"&gt;Ken&amp;nbsp;Shiriff&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;In larger devices—the Mac Mini, game consoles (e.g. &lt;span class="caps"&gt;PS4&lt;/span&gt; or Xbox One), and larger desktops, there’s plenty of space in the device’s internals, and they have sufficiently powerful cooling systems that can remove this heat. In desktops especially, the power supply may be large enough that it has its own cooling&amp;nbsp;fan!&lt;/p&gt;
&lt;p&gt;&lt;img alt="A desktop power supply, with the cover removed" src="https://ngjunsiang.github.io/laymansguide/issue130_02.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;The internals of a desktop power supply.&lt;br /&gt;Notice the cooling fan mounted on the back with 4 silver screws, and the two silver heatsinks mounted vertically&lt;br /&gt;Source: &lt;a href="https://en.wikipedia.org/wiki/Power_supply_unit_(computer)"&gt;Wikipedia&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;So for large devices, it makes sense to hide the power supply within the device for a sleeker&amp;nbsp;look.&lt;/p&gt;
&lt;p&gt;In fact, for high-power devices, a power adapter is a poor option. Since power adapters don’t have their own cooling fans, they have limited cooling ability, and are liable to overheat easily if they have to provide &amp;gt;100 W to a device (remember that this means they release at least 11 W of heat, while passive cooling can typically dissipate up to 8&amp;nbsp;W).&lt;/p&gt;
&lt;h2&gt;Device&amp;nbsp;categories&lt;/h2&gt;
&lt;p&gt;Putting together the information from &lt;a href="https://ngjunsiang.github.io/laymansguide/issue129.html"&gt;Issue 129&lt;/a&gt;) and this issue, we can deduce that devices seem to sort themselves into form-factor categories depending on how much power they draw, and how much heat they put&amp;nbsp;out:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Devices drawing &amp;gt;100W at peak, and putting out &amp;gt;80 W of&amp;nbsp;heat:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Generally large, directly powered from the wall (by &lt;span class="caps"&gt;AC&lt;/span&gt;), with power supply within the&amp;nbsp;device.&lt;/p&gt;
&lt;p&gt;In rare cases they do use external &lt;span class="caps"&gt;AC&lt;/span&gt; adapters (such as high-power gaming&amp;nbsp;laptops).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Devices drawing 12–65W at peak, putting out 25–45W of&amp;nbsp;heat:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;These devices cannot be passively cooled, and thus require active cooling (i.e. a cooling fan and&amp;nbsp;heatsink).&lt;/p&gt;
&lt;p&gt;To avoid adding heat to the device from the &lt;span class="caps"&gt;AC&lt;/span&gt;-&lt;span class="caps"&gt;DC&lt;/span&gt; conversion process, they usually use external &lt;span class="caps"&gt;AC&lt;/span&gt;&amp;nbsp;adapters.&lt;/p&gt;
&lt;p&gt;Even in devices as small as the Nintendo Switch, you can usually spot the cooling vents where the cooling fan blows warm air from the device into the&amp;nbsp;surroundings.&lt;/p&gt;
&lt;p&gt;These may be safely powered by &lt;span class="caps"&gt;USB&lt;/span&gt;&amp;nbsp;Type-C.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Devices drawing &amp;lt;12W at peak, putting out &amp;lt;10W of&amp;nbsp;heat:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;These devices can be passively&amp;nbsp;cooled.&lt;/p&gt;
&lt;p&gt;Large devices, such as tablets, have a larger surface area to dissipate heat and can afford to draw as much as 8–10W, while smaller devices such as smartphones typically have to remain under&amp;nbsp;5W.&lt;/p&gt;
&lt;p&gt;These are usually powered by &lt;span class="caps"&gt;USB&lt;/span&gt; (at a voltage of 5V), though some may draw power at&amp;nbsp;9V.&lt;/p&gt;
&lt;p&gt;The M1 Macbook Air is passively cooled and thus in this category because its M1 processor is configured to limit its maximum heat output to approx. 10W or less; the M1 Macbook Pro has a cooling fan and a higher max heat output configuration, which allows it to perform at greater&amp;nbsp;capacity.&lt;/p&gt;
&lt;hr /&gt;

&lt;p&gt;If you spot a device in the wild that claims to have performance much greater than its form factor—its shape, size, footprint—suggests, you would be wise to suspect over-optimism or a scam! At least until it is clear how they plan to provide that power and get rid of that heat&amp;nbsp;…&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; &lt;span class="caps"&gt;AC&lt;/span&gt; power from the wall uses electric current that alternates directions, while &lt;span class="caps"&gt;DC&lt;/span&gt; power from batteries uses electric current that flows in one direction only. All electronics are &lt;span class="caps"&gt;DC&lt;/span&gt;-only, and require an &lt;span class="caps"&gt;AC&lt;/span&gt;-&lt;span class="caps"&gt;DC&lt;/span&gt; adapter to be powered from the wall. The &lt;span class="caps"&gt;AC&lt;/span&gt;-&lt;span class="caps"&gt;DC&lt;/span&gt; conversion produces a significant amount of heat; &lt;span class="caps"&gt;AC&lt;/span&gt;-&lt;span class="caps"&gt;DC&lt;/span&gt; adapters are usually external unless the device has sufficient space or cooling capacity for&amp;nbsp;it.&lt;/p&gt;
&lt;p&gt;I’m noticing a pattern: issues where I explain concepts tend to be shorter than issues where I explain limits due to engineering and the physics of reality. I hope I can shorten the latter without sacrificing practical knowledge. Let me know how you’re finding these issues&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; S11] Issue 131: What do early CPUs and startup founders have in&amp;nbsp;common?&lt;/p&gt;
&lt;p&gt;This season was focused on firmware and computer components; it is part 1 of a set of concepts I need, so as to explain why the Apple M1 processor is a game-changer for personal computers. I explained what a graphics card is and what it does, I explained why some laptops are upgradeable and why some are not, I explained why some devices need cooling fans and others don’t, and I summarised the relationship between device form factors and their power&amp;nbsp;limits.&lt;/p&gt;
&lt;p&gt;Part 2 will extend this exploration inside the computer. I noticed that layfolks’ mental concept of a computer typically includes the idea that there is a &lt;span class="caps"&gt;CPU&lt;/span&gt;, memory, a hard disk/solid state drive, and maybe a graphics card inside a computer. That’s plenty good enough for everyday life; it’s like understanding that all the employees of a company are in a particular building. But it is insufficient for understanding &lt;em&gt;why the M1 is so much faster&lt;/em&gt;; you’re going to need to know where the employees are situated, and what their workflow is&amp;nbsp;like!&lt;/p&gt;
&lt;p&gt;It’s a tempting but misleading story to imagine that Apple simply has much better engineers; I would say that their engineers were instead under the influence of incentives that allowed them to imagine a more coherent architecture. Let’s get into it starting next issue, again beginning from first principles: how exactly does the &lt;span class="caps"&gt;CPU&lt;/span&gt;, memory, and storage disk work&amp;nbsp;together?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;Power = Voltage × Current, so to provide the same power with a lower current, you have to provide it at a higher voltage&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;&lt;span class="caps"&gt;AC&lt;/span&gt;-&lt;span class="caps"&gt;DC&lt;/span&gt; converters typically have a range of input power they can convert (e.g. 0–65 W for laptop adapters, 0–500 W for desktops). The efficiency is highest at about 50% of that load, and efficiency drops as the load increases or decreases from that point.&amp;#160;&lt;a class="footnote-backref" href="#fnref:2" title="Jump back to footnote 2 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><category term="Season 10"></category></entry><entry><title>Issue 129: Cooling</title><link href="https://ngjunsiang.github.io/laymansguide/issue129.html" rel="alternate"></link><published>2021-07-17T08:00:00+08:00</published><updated>2021-07-17T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-07-17:/laymansguide/issue129.html</id><summary type="html">&lt;p&gt;The larger the surface area, the faster an object loses heat. The larger the temperature difference between object and surroundings, the faster the object loses heat. Heat is bad for computers, and CPUs will need cooling to be able to process computations quickly. A mobile phone thus typically uses no more than 4 W of power, a laptop can use 25–45 W, and a desktop can usually use 65 W and more. Two popular ways of increasing the cooling capacity of a device is to attach a larger piece of metal to the chip (passive cooling), or use a fan to force air over the heatsink (active&amp;nbsp;cooling).&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Upgradable parts need a slot or socket to be inserted into; these slots/sockets need to be made robust enough, causing them to take up more space than a soldered part. Devices which were designed to be small and portable generally eliminate these as far as possible, opting to have parts directly soldered to the board&amp;nbsp;instead.&lt;/p&gt;
&lt;p&gt;Why do computers need&amp;nbsp;power?&lt;/p&gt;
&lt;p&gt;Other home appliances I can understand. They need to heat up air/water, move air/water around, or extract heat from air/water to move it elsewhere. These things all need energy. But a computer … all it does is move electrons around! All the information in a computer that changes is just electrons moving; that should not need so much power, should&amp;nbsp;it?&lt;/p&gt;
&lt;p&gt;As it turns out, energy-information equivalence theories posit that manipulating information does increase entropy which does involve energy—but this is the Layman’s Guide to Computing, not a physics newsletter. Let’s just say that managing information, in its abstract sense, needs very little&amp;nbsp;energy.&lt;/p&gt;
&lt;h2&gt;Energy usage in&amp;nbsp;computers&lt;/h2&gt;
&lt;p&gt;What happens to all the energy that a computer uses, then? Some miniscule amount of it goes to manipulating information. A tiny amount goes to lighting up LEDs (these devices somehow always have LEDs), and maybe running the cooling fans. The rest of it is wasted as &lt;strong&gt;heat&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The history of computing is also a history of less and less wasted heat. The Cray 2 supercomputer, in 1985, needed 195 kW to produce 1.9 gigaflops (1.9 billion &lt;strong&gt;fl&lt;/strong&gt;oating-point &lt;strong&gt;o&lt;/strong&gt;perations &lt;strong&gt;p&lt;/strong&gt;er &lt;strong&gt;s&lt;/strong&gt;econd; more context in &lt;a href="https://ngjunsiang.github.io/laymansguide/issue123.html"&gt;Issue 123&lt;/a&gt;)) of computational performance. The iPhone &lt;span class="caps"&gt;XS&lt;/span&gt;, in 2016, needed less than 1 W to produce 1&amp;nbsp;gigaflop.&lt;/p&gt;
&lt;p&gt;No, I’m not going into the environmental concerns and carbon footprint of computing. We have more tangible and immediate concerns&amp;nbsp;here.&lt;/p&gt;
&lt;p&gt;Because heat is bad for computers. When microprocessor chips heat up, the semiconductor material they are made of no longer behaves as it should; it gets “leaky”, allowing electrons to go where they shouldn’t. The data it handles starts to get corrupted, and it eventually&amp;nbsp;crashes.&lt;/p&gt;
&lt;h2&gt;Thermal&amp;nbsp;throttling&lt;/h2&gt;
&lt;p&gt;In the past, microprocessors were simpler, and had no thermal controls whatsoever; if you allowed them to run as-is, without any cooling assistance, they would just run until they began smoking and sometimes even catch fire (enjoy this &lt;a href="https://www.youtube.com/watch?v=Xf0VuRG7MN4&amp;amp;t=99s"&gt;2005 video of a &lt;span class="caps"&gt;CPU&lt;/span&gt; doing just that&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Today, CPUs are somewhat more sophisticated. Once they start heating up to their thermal limit, onboard thermal control circuitry will attempt to &lt;strong&gt;throttle&lt;/strong&gt; the &lt;span class="caps"&gt;CPU&lt;/span&gt;’s performance to keep it at a safe temperature. So you will have a laggy and unresponsive &lt;span class="caps"&gt;CPU&lt;/span&gt;, but at least it’s not on&amp;nbsp;fire!&lt;/p&gt;
&lt;p&gt;Still, most CPUs are going to need some sort of heatsink that helps to draw heat away from it, and dissipate the heat into the&amp;nbsp;surroundings.&lt;/p&gt;
&lt;h2&gt;Getting rid of&amp;nbsp;heat&lt;/h2&gt;
&lt;p&gt;There are two things you need to know about heat loss to the&amp;nbsp;surroundings:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The larger the surface area, the faster an object loses&amp;nbsp;heat.&lt;/li&gt;
&lt;li&gt;The larger the temperature difference between object and surroundings, the faster the object loses&amp;nbsp;heat.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;CPUs are kind of at a disadvantage&amp;nbsp;here.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;They are really small; the part that is in contact with the heatsink is usually about 400 sq mm (approx. 2 cm by 2 cm, or 0.64 sq in)&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;
&lt;li&gt;The thermal limit for most CPUs is only about 100 °C (212 F), compared to most metals which have theirs in the hundreds or even over a thousand&amp;nbsp;°C&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Heatsinks&lt;/h2&gt;
&lt;p&gt;In practice, this means that a bare chip can only run about 4 W before it starts to run into its thermal limits (we call this &lt;strong&gt;overheating&lt;/strong&gt;). Anything more powerful than a basic home router or smart device (such as the Amazon Echo or Google Home Assistant) will need some sort of heatsink to avoid&amp;nbsp;overheating.&lt;/p&gt;
&lt;p&gt;The simplest way to cool a chip is to slap a piece of metal on it to increase the surface area (factor 2). This is known as &lt;strong&gt;passive cooling&lt;/strong&gt;. A paste called &lt;strong&gt;thermal paste&lt;/strong&gt; is applied between the heatsink and chip to improve the transfer of heat. To pack as much surface area as possible into a tiny space, this piece of metal usually has long, thin fins, giving the characteristic look of&amp;nbsp;heatsinks:&lt;/p&gt;
&lt;p&gt;&lt;img alt="A passive heatsink on a chip" src="https://ngjunsiang.github.io/laymansguide/issue129_01.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;A passive heatsink on the northbridge chip of a computer mainboard&lt;br /&gt;Source: found on &lt;a href="https://superuser.com/questions/1043094/difference-between-active-and-passive-heatsink"&gt;Superuser&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;The effectiveness of passive heatsinks depends on the ambient airflow around it. Some creative setups that manage to get &lt;em&gt;the metal case itself&lt;/em&gt; in contact with the &lt;span class="caps"&gt;CPU&lt;/span&gt; can readily cool up to 45 W, with zero fan&amp;nbsp;noise!&lt;/p&gt;
&lt;p&gt;For mobile phones, tablets, and laptops, such heatsinks would add too much to the device thickness. Instead, the CPUs are usually in direct contact with a larger metal surface, sometimes even the metal back of the device; this is why they feel warm to you in the first place. This allows tablets to use up to approx. 8 W of&amp;nbsp;power.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Logic board cover in an iPad" src="https://ngjunsiang.github.io/laymansguide/issue129_02.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;The logic board cover in an iPad Pro 11 has copper inside; it helps to spread heat to the rest of the device instead of concentrating it all in one spot&lt;br /&gt;Source: &lt;a href="https://www.ifixit.com/Teardown/iPad+Pro+11-Inch+Teardown/115457"&gt;iFixit&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Where there isn’t this luxury of space, another option is to use a slim heatsink, and increase its cooling ability by forcing air through it. This form of cooling is called &lt;strong&gt;active cooling&lt;/strong&gt;, and usually done with a fan of some sort, a popular option for thicker laptops. This allows laptops to run between 25–45 W, and desktop computers to run 65 W and hotter (with larger heatsinks, of&amp;nbsp;course)&lt;/p&gt;
&lt;p&gt;&lt;img alt="An active heatsink on a chip" src="https://ngjunsiang.github.io/laymansguide/issue129_03.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;An active heatsink on the &lt;span class="caps"&gt;CPU&lt;/span&gt; of a computer mainboard&lt;br /&gt;Source: found on &lt;a href="https://superuser.com/questions/1043094/difference-between-active-and-passive-heatsink"&gt;Superuser&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;These numbers are for stereotypical mobile devices, laptops, and desktops; stranger or hybrid designs may have different cooling capacities (e.g. a tiny cube desktop might only have 25–35 W of cooling&amp;nbsp;capacity).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; The larger the surface area, the faster an object loses heat. The larger the temperature difference between object and surroundings, the faster the object loses heat. Heat is bad for computers, and CPUs will need cooling to be able to process computations quickly. A mobile phone thus typically uses no more than 4 W of power, a laptop can use 25–45 W, and a desktop can usually use 65 W and more. Two popular ways of increasing the cooling capacity of a device is to attach a larger piece of metal to the chip (passive cooling), or use a fan to force air over the heatsink (active&amp;nbsp;cooling).&lt;/p&gt;
&lt;p&gt;If you walk away with only one thing from this issue, it’s that heat dissipation constrains the max performance for any device, and heat dissipation is usually constrained by the surface area available for&amp;nbsp;cooling.&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 130: Power&amp;nbsp;limits&lt;/p&gt;
&lt;p&gt;Computers turn electrical power to heat, drawing a miniscule amount off for computation. But where does that power come from? In the last issue of Season 10, I’ll touch on a highly underrated hardware component: the power&amp;nbsp;supply.&lt;/p&gt;
&lt;p&gt;This and more, next&amp;nbsp;issue!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;Multiple CPUs are produced from a single semiconductor wafer. Keeping CPUs small maximises the yield from manufacturing, and reduces the chance of a manufacturing error on any single &lt;span class="caps"&gt;CPU&lt;/span&gt;. This is going to take a whole ’nother season to explain …&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 10"></category></entry><entry><title>Issue 128: Upgradeability</title><link href="https://ngjunsiang.github.io/laymansguide/issue128.html" rel="alternate"></link><published>2021-07-10T08:00:00+08:00</published><updated>2021-07-10T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-07-10:/laymansguide/issue128.html</id><summary type="html">&lt;p&gt;Upgradable parts need a slot or socket to be inserted into; these slots/sockets need to be made robust enough, causing them to take up more space than a soldered part. Devices which were designed to be small and portable generally eliminate these as far as possible, opting to have parts directly soldered to the board&amp;nbsp;instead.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; &lt;span class="caps"&gt;USB&lt;/span&gt; Power Delivery is a specification that describes how much voltage and current can be supplied by different categories of &lt;span class="caps"&gt;USB&lt;/span&gt; cables. It allows power delivery at different levels for all kids of connected devices, up to 100W. This should help to simplify cable setups that otherwise require multiple kinds of cables between two closely interconnected devices (such as a laptop and an external&amp;nbsp;monitor).&lt;/p&gt;
&lt;p&gt;At some point in the past, computers could be upgraded with all kinds of parts: you could upgrade to a better network card, a better processor, or add more memory, without changing out the entire&amp;nbsp;computer!&lt;/p&gt;
&lt;h2&gt;The short history of personal&amp;nbsp;computers&lt;/h2&gt;
&lt;p&gt;After &lt;span class="caps"&gt;IBM&lt;/span&gt; released the &lt;span class="caps"&gt;IBM&lt;/span&gt; 360, the first mainframe that was meant to be used in both large-scale and small-scale applications, it quickly realised that providing service support for it was going to be a nightmare if each version required its own specialised support. In the 1970s, it was already thinking of a family-of-parts concept that allowed its products to use a set of interchangeable parts to reduce the number of these&amp;nbsp;parts.&lt;/p&gt;
&lt;p&gt;But Intel, founded in 1971, had made a major breakthrough in manufacturing low cost microprocessors. The price of computers dropped steadily in response, allowing the personal computer (&lt;span class="caps"&gt;PC&lt;/span&gt;) to become affordable to home users, and the family-of-parts concept came along for the&amp;nbsp;ride.&lt;/p&gt;
&lt;p&gt;The early computers, when purchased, needed a network card to connect to a network, needed a sound card to produce sound, needed a graphics card to view graphics … you basically needed a card for&amp;nbsp;everything!&lt;/p&gt;
&lt;h2&gt;Upgradeable&amp;nbsp;parts&lt;/h2&gt;
&lt;p&gt;On a desktop, you could upgrade a number of&amp;nbsp;components.&lt;/p&gt;
&lt;p&gt;Desktop CPUs were purchased separately, and had to be installed into a socket on a mainboard (also called a&amp;nbsp;motherboard).&lt;/p&gt;
&lt;p&gt;&lt;img alt="Intel CPU socket" src="https://ngjunsiang.github.io/laymansguide/issue128_01.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;A &lt;span class="caps"&gt;CPU&lt;/span&gt; socket on a mainboard&lt;br /&gt;Source: &lt;a href="https://www.digitaltrends.com/computing/what-are-intels-lga-processor-sockets/"&gt;Digital&amp;nbsp;Trends&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Desktop computer memory was likewise purchased separately, and slotted&amp;nbsp;in:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Desktop memory slots" src="https://ngjunsiang.github.io/laymansguide/issue128_02.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;Memory slots on a desktop mainboard&lt;br /&gt;Source: &lt;a href="https://bleuwire.com/how-to-determine-memory-slots-motherboard-windows-10/"&gt;Bleuwire&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;On top of that, you still had to buy your own &lt;span class="caps"&gt;DVD&lt;/span&gt;/Bluray drives, storage disks, and other peripherals, to be plugged in laboriously to the mainboard. Many of these features made it into laptops as&amp;nbsp;well.&lt;/p&gt;
&lt;h2&gt;Laptop&amp;nbsp;upgrades&lt;/h2&gt;
&lt;p&gt;Because of the smaller space available, the &lt;span class="caps"&gt;CPU&lt;/span&gt; socket had to go. Most laptops have their CPUs soldered directly to the mainboard, and the &lt;span class="caps"&gt;CPU&lt;/span&gt; cannot be upgraded separately. Buying a laptop with a better &lt;span class="caps"&gt;CPU&lt;/span&gt; often means buying it with a different configuration, mainboard and&amp;nbsp;all.&lt;/p&gt;
&lt;p&gt;But laptops retained the ability to upgrade memory through the use of memory slots. These were oriented flat along the board to reduce&amp;nbsp;space.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Laptop memory slots" src="https://ngjunsiang.github.io/laymansguide/issue128_03.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;Memory slots on a laptop&lt;br /&gt;Source: &lt;a href="https://www.laptopmag.com/articles/ram-upgrade-tutorial"&gt;Laptopmag&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;And they also retained the ability to swap out or replace their disks, whether hard disk or solid state&amp;nbsp;drive.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Laptop hard disk slot" src="https://ngjunsiang.github.io/laymansguide/issue128_04.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;The hard disk slot on a laptop&lt;br /&gt;Source: &lt;a href="https://www.tweaktown.com/tweakipedia/2/upgrading-your-laptop-to-a-new-high-performance-ssd-and-ram/index.html"&gt;TweakTown&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;&lt;img alt="Laptop SSD slots" src="https://ngjunsiang.github.io/laymansguide/issue128_05.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;The &lt;span class="caps"&gt;SSD&lt;/span&gt; slots on a laptop&lt;br /&gt;Source: &lt;a href="https://www.easeus.com/backup-utility/clone-m2-ssd-to-larger-m2-ssd.html"&gt;EaseUS&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;h2&gt;Limitations of upgradable&amp;nbsp;parts&lt;/h2&gt;
&lt;p&gt;A common limitation here is that replaceable components take up more space than directly-soldered ones, because the sockets and slots cannot be manufactured too thin if they are to be robust. As the industry moves towards thin-and-light designs, and hardware support moves to a system that replaces the whole device rather than individual parts, these replaceable parts are already on their way&amp;nbsp;out.&lt;/p&gt;
&lt;p&gt;On the Apple Macbook, Apple has already soldered down the &lt;span class="caps"&gt;CPU&lt;/span&gt;, memory, and &lt;span class="caps"&gt;SSD&lt;/span&gt;, allowing for no upgrades. This is also the case for many other thin-and-light laptop&amp;nbsp;manufacturers.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Upgradable parts need a slot or socket to be inserted into; these slots/sockets need to be made robust enough, causing them to take up more space than a soldered part. Devices which were designed to be small and portable generally eliminate these as far as possible, opting to have parts directly soldered to the board&amp;nbsp;instead.&lt;/p&gt;
&lt;p&gt;There are of course other reasons for this transition, economic as well as financial, which I will not tackle here. I just wanted the chance to show some upgrade slots so if you ever get to see an old laptop opened up, you know what they are&amp;nbsp;for!&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 129:&amp;nbsp;Cooling&lt;/p&gt;
&lt;p&gt;Next issue, another dive into another issue: why is my laptop running so hot? Why is it so loud? Why can’t I get a more powerful processor in this tiny &lt;span class="caps"&gt;PC&lt;/span&gt;? Why is my i7 slower than my friend’s&amp;nbsp;i5?&lt;/p&gt;
&lt;p&gt;This and more, next&amp;nbsp;issue!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 10"></category><category term="memory"></category></entry><entry><title>Issue 127: USB Type-C Power Delivery</title><link href="https://ngjunsiang.github.io/laymansguide/issue127.html" rel="alternate"></link><published>2021-07-03T08:00:00+08:00</published><updated>2021-07-03T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-07-03:/laymansguide/issue127.html</id><summary type="html">&lt;p&gt;&lt;span class="caps"&gt;USB&lt;/span&gt; Power Delivery is a specification that describes how much voltage and current can be supplied by different categories of &lt;span class="caps"&gt;USB&lt;/span&gt; cables. It allows power delivery at different levels for all kinds of connected devices, up to 100W. This should help to simplify cable setups that otherwise require multiple kinds of cables between two closely interconnected devices (such as a laptop and an external&amp;nbsp;monitor).&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; &lt;span class="caps"&gt;USB&lt;/span&gt; is a (licensed) technical standard that describes how devices connect to each other through a cable. &lt;span class="caps"&gt;USB&lt;/span&gt; Type-C is a new connector standard that supports &lt;span class="caps"&gt;USB&lt;/span&gt; 3, DisplayPort, &lt;span class="caps"&gt;HDMI&lt;/span&gt;, and Thunderbolt. It is able to carry multiple types of data simultaneously, in limited combinations. In a &lt;span class="caps"&gt;USB&lt;/span&gt; connection, one device acts as the host while the other acts as the device; the host initiates all&amp;nbsp;communication.&lt;/p&gt;
&lt;p&gt;Last week, I differentiated the &lt;span class="caps"&gt;USB&lt;/span&gt; Type-C &lt;strong&gt;cable&lt;/strong&gt; specification from the &lt;span class="caps"&gt;USB3&lt;/span&gt; &lt;strong&gt;data&lt;/strong&gt; specification; the former describes how the cable and connector should be, while the latter describes how to transmit &lt;span class="caps"&gt;USB&lt;/span&gt; data over a Type-C cable. Remember that in addition to &lt;span class="caps"&gt;USB3&lt;/span&gt; data, the Type-C cable can also transmit &lt;span class="caps"&gt;HDMI&lt;/span&gt; or DisplayPort video&amp;nbsp;data!&lt;/p&gt;
&lt;p&gt;What else can a Type-C cable do? Oh, right—provide power to devices. In other words, charge&amp;nbsp;them.&lt;/p&gt;
&lt;h2&gt;What’s wrong with &lt;span class="caps"&gt;USB2&lt;/span&gt;&amp;nbsp;charging?&lt;/h2&gt;
&lt;p&gt;Absolutely nothing! At this point, it was not expected that &lt;span class="caps"&gt;USB&lt;/span&gt; would be needed for powering anything more than some basic peripherals, like keyboards, mice, and anything less power-consuming than a small external hard disk. 5V (volts) of voltage with 0.5A (amperes) could provide 2.5W of power, and that was considered plenty&amp;nbsp;enough.&lt;/p&gt;
&lt;p&gt;The &lt;span class="caps"&gt;USB&lt;/span&gt; Implementers’ Forum (&lt;span class="caps"&gt;USB&lt;/span&gt;-&lt;span class="caps"&gt;IF&lt;/span&gt;) didn’t want to set too high a standard for &lt;span class="caps"&gt;USB&lt;/span&gt; devices and peripherals (&lt;em&gt;including&lt;/em&gt; &lt;span class="caps"&gt;USB&lt;/span&gt;-certified cables); original equipment manufacturers (OEMs), the ones who &lt;em&gt;actually had to manufacture the goods&lt;/em&gt;, would complain about the high cost. Nobody likes being undercut by cheap knockoffs that don’t bother applying for the license and following the specs (do you notice the official &lt;span class="caps"&gt;USB&lt;/span&gt; logo when buying?). So for a long time, we had up to 2.5W of power from &lt;span class="caps"&gt;USB&lt;/span&gt;&amp;nbsp;ports.&lt;/p&gt;
&lt;p&gt;And then tablets came along, drawing 8–12W of power to do whatever they have to. Aside from the iPad, which used its own connector, these were charged over &lt;span class="caps"&gt;USB&lt;/span&gt;. So their manufacturers had to come up with &lt;em&gt;kludges&lt;/em&gt; to work around &lt;span class="caps"&gt;USB&lt;/span&gt; limitations. They had Quick Charge, Dash Charge, and all kinds of other standards which were not approved by the &lt;span class="caps"&gt;USB&lt;/span&gt;-&lt;span class="caps"&gt;IF&lt;/span&gt;, just to allow their cables to provide up to 12W of power (3A of current, more in some cases) to their tablets while&amp;nbsp;charging.&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;USB&lt;/span&gt; 3.0 bumped the limit up to 0.9A (providing 4.5W), which was nice but far from enough. The hard limit was the cable itself though: drawing anything more than 5A over the usual thin &lt;span class="caps"&gt;USB&lt;/span&gt; cables would cause them to heat up to unsafe levels. Clearly, something more was&amp;nbsp;needed.&lt;/p&gt;
&lt;h2&gt;&lt;span class="caps"&gt;USB&lt;/span&gt; Power&amp;nbsp;Delivery&lt;/h2&gt;
&lt;p&gt;From 2012, the &lt;span class="caps"&gt;USB&lt;/span&gt;-&lt;span class="caps"&gt;IF&lt;/span&gt; finally added a Power Delivery (&lt;span class="caps"&gt;PD&lt;/span&gt;) specification, which allowed power to be delivered over &lt;span class="caps"&gt;USB&lt;/span&gt; cables at &lt;em&gt;different voltages&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;In addition to 5V, which is used by phones, tablets, and their power banks, the &lt;span class="caps"&gt;PD&lt;/span&gt; spec also allows charging at 9V (fast charging for some devices), 15V (for higher-power devices like the Nintendo Switch), and 20V (what most laptops use for &lt;span class="caps"&gt;PD&lt;/span&gt; charging). With a current of up to 5A, this technically allows up to 100W of power to be delivered—sufficient for pretty much all&amp;nbsp;laptops.&lt;/p&gt;
&lt;h3&gt;Which voltage is&amp;nbsp;used?&lt;/h3&gt;
&lt;p&gt;The actual voltage to be delivered by the charging host is &lt;em&gt;negotiated&lt;/em&gt; with the host. When a charging device is connected, it communicates the voltages it can support, the host compares it with the voltages it can supply, and power at a supported voltage is&amp;nbsp;delivered.&lt;/p&gt;
&lt;h3&gt;Can any cable be&amp;nbsp;used?&lt;/h3&gt;
&lt;p&gt;Greater current requires a thicker cable to be used, as thinner cables have more resistance and will heat up to unsafe levels. A cable following the &lt;span class="caps"&gt;USB&lt;/span&gt;-&lt;span class="caps"&gt;PD&lt;/span&gt; specification will negotiate the correct voltage and current in any case, so if your cable is not charging at a level you know is supported by both your devices, do check the cable rating. You may have to buy a higher-rated&amp;nbsp;cable.&lt;/p&gt;
&lt;h2&gt;Are there any advantages to buying a more expensive&amp;nbsp;cable?&lt;/h2&gt;
&lt;p&gt;Users of external monitor screens and docking bays often have to connect multiple cables from those devices to their laptops for power, (&lt;span class="caps"&gt;USB&lt;/span&gt;) data, and video output. With &lt;span class="caps"&gt;USB&lt;/span&gt; Type-C and &lt;span class="caps"&gt;USB&lt;/span&gt;-&lt;span class="caps"&gt;PD&lt;/span&gt; specifications unifying these three requirements into one cable, we will (eventually) be able to connect a laptop to a Type-C monitor using a Type-C cable, and this cable will supply power plus allow the laptop to use all devices connected to the&amp;nbsp;monitor.&lt;/p&gt;
&lt;p&gt;It’s supposed to simplify the physical cable mess, at the cost of having to manage a more complicated specification. Let’s see how that plays out in the next&amp;nbsp;decade.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; &lt;span class="caps"&gt;USB&lt;/span&gt; Power Delivery is a specification that describes how much voltage and current can be supplied by different categories of &lt;span class="caps"&gt;USB&lt;/span&gt; cables. It allows power delivery at different levels for all kinds of connected devices, up to 100W. This should help to simplify cable setups that otherwise require multiple kinds of cables between two closely interconnected devices (such as a laptop and an external&amp;nbsp;monitor).&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 128:&amp;nbsp;Upgradeability&lt;/p&gt;
&lt;p&gt;Millennials and other older computer users may remember the glory days of the desktop, when almost any component could be removed and swapped out for another. Laptops used to enjoy this upgradability to a lesser extent; the laptop memory and hard disk came as separate slotted cards that could be replaced with upgraded versions for increased&amp;nbsp;performance.&lt;/p&gt;
&lt;p&gt;What happened to that trend today? The reason mainly lies in the realm of economics, but I figured I’d use the chance to dig a little deeper and explain what is going on with the hardware that no longer allows this to&amp;nbsp;happen.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 10"></category></entry><entry><title>Issue 126: USB Type-C</title><link href="https://ngjunsiang.github.io/laymansguide/issue126.html" rel="alternate"></link><published>2021-06-26T08:00:00+08:00</published><updated>2021-06-26T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-06-26:/laymansguide/issue126.html</id><summary type="html">&lt;p&gt;&lt;span class="caps"&gt;USB&lt;/span&gt; is a (licensed) technical standard that describes how devices connect to each other through a cable. &lt;span class="caps"&gt;USB&lt;/span&gt; Type-C is a new connector standard that supports &lt;span class="caps"&gt;USB&lt;/span&gt; 3, DisplayPort, &lt;span class="caps"&gt;HDMI&lt;/span&gt;, and Thunderbolt. It is able to carry multiple types of data simultaneously, in limited combinations. In a &lt;span class="caps"&gt;USB&lt;/span&gt; connection, one device acts as the host while the other acts as the device; the host initiates all&amp;nbsp;communication.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Analog formats such as &lt;span class="caps"&gt;VGA&lt;/span&gt; mostly contain the control signals that the &lt;span class="caps"&gt;CRT&lt;/span&gt; needs to operate, while digital formats such as &lt;span class="caps"&gt;HDMI&lt;/span&gt; and DisplayPort contain image data that the device must convert to control signals. Analog signals need a digital-analog-conversion (&lt;span class="caps"&gt;DAC&lt;/span&gt;) chip to be converted to digital signals, hence &lt;span class="caps"&gt;VGA&lt;/span&gt;-&lt;span class="caps"&gt;HDMI&lt;/span&gt; adapters tend to be more costly than DisplayPort-&lt;span class="caps"&gt;HDMI&lt;/span&gt; adapters. Dedicated graphics cards generally support more simultaneous output video streams than integrated graphics&amp;nbsp;cards.&lt;/p&gt;
&lt;p&gt;This week, I attempt to untangle the confusion around &lt;strong&gt;&lt;span class="caps"&gt;USB&lt;/span&gt; Type-C&lt;/strong&gt;, informally also referred to as &lt;span class="caps"&gt;USB&lt;/span&gt;-C.&lt;/p&gt;
&lt;h2&gt;What is &lt;span class="caps"&gt;USB&lt;/span&gt;&amp;nbsp;Type-C?&lt;/h2&gt;
&lt;p&gt;It is a connector standard. It sets standards for &lt;em&gt;this&lt;/em&gt;&amp;nbsp;connector:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Picture of a USB-C plug" src="https://ngjunsiang.github.io/laymansguide/issue126_01.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;&lt;span class="caps"&gt;USB&lt;/span&gt;-C plug&lt;br /&gt;Image via &lt;a href="https://en.wikipedia.org/wiki/USB-C"&gt;Wikipedia&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;What does a connector standard do? It determines how many pins the connector should have, and what each of the pins should be used for, how the connector should be shaped, how the docking port (where the cable gets plugged into) should be designed, and other similar details. It’s all about the&amp;nbsp;docking.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Pinout diagram of a USB-C plug" src="https://ngjunsiang.github.io/laymansguide/issue126_02.png" /&gt;&lt;br /&gt;
&lt;em&gt;Pinout diagram of a &lt;span class="caps"&gt;USB&lt;/span&gt;-C plug&lt;br /&gt;Image via &lt;a href="https://en.wikipedia.org/wiki/USB-C"&gt;Wikipedia&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;h2&gt;But won’t somebody think about the&amp;nbsp;data?!&lt;/h2&gt;
&lt;p&gt;Ah, now we’re going back in history&amp;nbsp;…&lt;/p&gt;
&lt;p&gt;Universal Serial Bus (&lt;strong&gt;&lt;span class="caps"&gt;USB&lt;/span&gt;&lt;/strong&gt;) is a (set of) industry standards that sets requirements and protocols for—well, how data is transferred from one device to another. It is maintained by the &lt;span class="caps"&gt;USB&lt;/span&gt; Implementers Forum (&lt;span class="caps"&gt;USB&lt;/span&gt;-&lt;span class="caps"&gt;IF&lt;/span&gt;). The first version of the standard was released in 1996, second version (&lt;span class="caps"&gt;USB&lt;/span&gt; 2.0) in 2000, and third version (&lt;span class="caps"&gt;USB&lt;/span&gt; 3.0) in&amp;nbsp;2008.&lt;/p&gt;
&lt;p&gt;While &lt;span class="caps"&gt;USB&lt;/span&gt; 2.0 (or Hi-Speed &lt;span class="caps"&gt;USB&lt;/span&gt;) supported a transfer rate of &lt;em&gt;up to&lt;/em&gt; 60 &lt;span class="caps"&gt;MB&lt;/span&gt;/s, &lt;span class="caps"&gt;USB&lt;/span&gt; 3.0 supports &lt;em&gt;up to&lt;/em&gt; 625 &lt;span class="caps"&gt;MB&lt;/span&gt;/s, allowing for much faster transfers from external disks and other&amp;nbsp;devices.&lt;/p&gt;
&lt;p&gt;We don’t have to worry so much about these versions, because &lt;span class="caps"&gt;USB&lt;/span&gt; is designed to be backward-compatible. That means all devices that support &lt;span class="caps"&gt;USB2&lt;/span&gt; also support &lt;span class="caps"&gt;USB1&lt;/span&gt;, and all devices supporting &lt;span class="caps"&gt;USB3&lt;/span&gt; also support &lt;span class="caps"&gt;USB2&lt;/span&gt;. The primary advantage that each successive &lt;span class="caps"&gt;USB&lt;/span&gt; version has over previous versions is higher throughput, more supported features, and more connectors to confuse (okay, that last isn’t an advantage&amp;nbsp;😛).&lt;/p&gt;
&lt;p&gt;&lt;img alt="Connector shapes for different USB versions" src="https://ngjunsiang.github.io/laymansguide/issue126_03.png" /&gt;&lt;br /&gt;
&lt;em&gt;Comparison of &lt;span class="caps"&gt;USB&lt;/span&gt; connector plugs, excluding &lt;span class="caps"&gt;USB&lt;/span&gt; Type-C plugs&lt;br /&gt;Image via &lt;a href="https://en.wikipedia.org/wiki/USB_hardware"&gt;Wikipedia&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;As you can see, this makes for a lot of confusion, especially when compatibility is mixed: &lt;span class="caps"&gt;USB2&lt;/span&gt; ‘A’ connectors are meant to go into &lt;span class="caps"&gt;USB3&lt;/span&gt; ‘A’ receptacles, but &lt;span class="caps"&gt;USB2&lt;/span&gt; ‘B’ connectors aren’t meant to go into &lt;span class="caps"&gt;USB3&lt;/span&gt; ‘B’ receptacles&amp;nbsp;…!&lt;/p&gt;
&lt;p&gt;So &lt;span class="caps"&gt;USB&lt;/span&gt; Type-C is meant to be the one connector standard to rule them all. It even has rotational symmetry, so it shouldn’t matter which way you plug it&amp;nbsp;in!&lt;/p&gt;
&lt;h2&gt;So what is a &lt;span class="caps"&gt;USB&lt;/span&gt;&amp;nbsp;device?&lt;/h2&gt;
&lt;p&gt;Technically speaking, it is a device whose manufacturer has paid for a &lt;span class="caps"&gt;USB&lt;/span&gt; license, sent their device for certification, and passed the &lt;span class="caps"&gt;USB&lt;/span&gt;-&lt;span class="caps"&gt;IF&lt;/span&gt;’s certification requirements, allowing the manufacturer to put the &lt;span class="caps"&gt;USB&lt;/span&gt; logo on the&amp;nbsp;packaging.&lt;/p&gt;
&lt;p&gt;Practically speaking, it is any device that has a &lt;span class="caps"&gt;USB&lt;/span&gt; port, allows &lt;span class="caps"&gt;USB&lt;/span&gt; devices to be connected to it, or allows itself to be connected to other &lt;span class="caps"&gt;USB&lt;/span&gt; devices, and basically behaves like a &lt;span class="caps"&gt;USB&lt;/span&gt; device. (If it walks like a duck and talks like a duck&amp;nbsp;…)&lt;/p&gt;
&lt;p&gt;Furthermore, it is important to differentiate between a &lt;strong&gt;&lt;span class="caps"&gt;USB&lt;/span&gt; host&lt;/strong&gt; and a &lt;strong&gt;&lt;span class="caps"&gt;USB&lt;/span&gt; device&lt;/strong&gt;. The host acts as the controller of the device, and initiates all communication between the two. For instance, if you attempt to connect two Android phones to each other with a &lt;span class="caps"&gt;USB&lt;/span&gt; cable, one must act as the host and the other as a device, even if both are capable of acting as hosts. The host decides what can be done through the&amp;nbsp;connection.&lt;/p&gt;
&lt;p&gt;This helps to explain why a &lt;span class="caps"&gt;USB&lt;/span&gt;-charging battery pack cannot also be an external storage device &lt;em&gt;at the same time&lt;/em&gt;, i.e. you cannot combine a phone battery pack with an external hard disk and hope to charge your phone + access the external hard disk at the same time. When your phone charges from the battery pack, it acts as the &lt;span class="caps"&gt;USB&lt;/span&gt; device (in charging mode); when it accesses a hard disk, it is acting as the &lt;span class="caps"&gt;USB&lt;/span&gt; host. It cannot do both&amp;nbsp;simultaneously!&lt;/p&gt;
&lt;h2&gt;Data supported over &lt;span class="caps"&gt;USB&lt;/span&gt; Type-C&amp;nbsp;cables&lt;/h2&gt;
&lt;p&gt;In addition to &lt;span class="caps"&gt;USB3&lt;/span&gt;.0 data (and later versions of &lt;span class="caps"&gt;USB&lt;/span&gt; 3), the &lt;span class="caps"&gt;USB&lt;/span&gt; Type-C specification also allows the Type-C connector to carry other kinds of data, if supported by the&amp;nbsp;device:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;DisplayPort video data for monitors and computer display devices (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue124.html"&gt;Issue 124&lt;/a&gt;))&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;HDMI&lt;/span&gt; video data for monitors and consumer electronics devices (also covered in Issue&amp;nbsp;124)&lt;/li&gt;
&lt;li&gt;Thunderbolt 3 data, for high-data-transfer&amp;nbsp;devices&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Type-C specification even supports modes that allow a Type-C cable to carry multiple types of data simultaneously. For instance, a Type-C connector that connects a laptop to a monitor&amp;nbsp;can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;carry DisplayPort video data, enabling the laptop to use the monitor as an external&amp;nbsp;display,&lt;/li&gt;
&lt;li&gt;carry &lt;span class="caps"&gt;USB&lt;/span&gt; 3 data, enabling the laptop to use &lt;span class="caps"&gt;USB&lt;/span&gt; ports and other features (such as audio inputs/outputs) on the&amp;nbsp;monitor&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;… All this comes with the caveat that one must read the manufacturers’ fine print to see if these features are supported on the respective devices. Just because the &lt;span class="caps"&gt;USB&lt;/span&gt; spec &lt;em&gt;allows&lt;/em&gt; it, doesn’t mean that a particular device &lt;em&gt;implements&lt;/em&gt;&amp;nbsp;it!&lt;/p&gt;
&lt;p&gt;For example, some laptops may have two Type-C ports, but &lt;em&gt;only one&lt;/em&gt; of those ports will support Thunderbolt and DisplayPort; the other port sometimes only supports &lt;span class="caps"&gt;USB3&lt;/span&gt;&amp;nbsp;data.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; &lt;span class="caps"&gt;USB&lt;/span&gt; is a (licensed) technical standard that describes how devices connect to each other through a cable. &lt;span class="caps"&gt;USB&lt;/span&gt; Type-C is a new connector standard that supports &lt;span class="caps"&gt;USB&lt;/span&gt; 3, DisplayPort, &lt;span class="caps"&gt;HDMI&lt;/span&gt;, and Thunderbolt. It is able to carry multiple types of data simultaneously, in limited combinations. In a &lt;span class="caps"&gt;USB&lt;/span&gt; connection, one device acts as the host while the other acts as the device; the host initiates all&amp;nbsp;communication.&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 127: &lt;span class="caps"&gt;USB&lt;/span&gt; Type-C Power&amp;nbsp;Delivery&lt;/p&gt;
&lt;p&gt;This issue was about how data is handled over &lt;span class="caps"&gt;USB&lt;/span&gt; Type-C. Next issue, how &lt;em&gt;power&lt;/em&gt; is handled over &lt;span class="caps"&gt;USB&lt;/span&gt; Type-C. After all, every day, millions of devices are getting powered over Type-C: from smartphones, to Internet-of-Things (IoT) devices, to full-size laptops. How is a single type of cable able to cover such a wide range, when earlier cable types could&amp;nbsp;not?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 10"></category></entry><entry><title>Issue 125: Analog and digital conversion</title><link href="https://ngjunsiang.github.io/laymansguide/issue125.html" rel="alternate"></link><published>2021-06-19T08:00:00+08:00</published><updated>2021-06-19T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-06-19:/laymansguide/issue125.html</id><summary type="html">&lt;p&gt;Analog formats such as &lt;span class="caps"&gt;VGA&lt;/span&gt; mostly contain the control signals that the &lt;span class="caps"&gt;CRT&lt;/span&gt; needs to operate, while digital formats such as &lt;span class="caps"&gt;HDMI&lt;/span&gt; and DisplayPort contain image data that the device must convert to control signals. Analog signals need a digital-analog-conversion (&lt;span class="caps"&gt;DAC&lt;/span&gt;) chip to be converted to digital signals, hence &lt;span class="caps"&gt;VGA&lt;/span&gt;-&lt;span class="caps"&gt;HDMI&lt;/span&gt; adapters tend to be more costly than DisplayPort-&lt;span class="caps"&gt;HDMI&lt;/span&gt; adapters. Dedicated graphics cards generally support more simultaneous output video streams than integrated graphics&amp;nbsp;cards.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; The &lt;span class="caps"&gt;VGA&lt;/span&gt; video format originated in the time of cathode-ray televisions (CRTs). It was superseded by &lt;span class="caps"&gt;HDMI&lt;/span&gt;, a video format standardised by consumer electronics companies. DisplayPort, on the other hand, is a video format standardised by computer display&amp;nbsp;companies.&lt;/p&gt;
&lt;p&gt;The bulk of the story has been written in &lt;a href="https://ngjunsiang.github.io/laymansguide/issue123.html"&gt;Issue 123&lt;/a&gt;), so this issue will be&amp;nbsp;short.&lt;/p&gt;
&lt;h2&gt;Why two digital formats? &lt;span class="caps"&gt;HDMI&lt;/span&gt; vs&amp;nbsp;DisplayPort&lt;/h2&gt;
&lt;p&gt;&lt;span class="caps"&gt;HDMI&lt;/span&gt; is a consumer electronics standard, and is thus heavily focused on broadcast and home video needs. &lt;span class="caps"&gt;HDMI&lt;/span&gt; primarily supports video and audio data. It also carries some control signals through &lt;span class="caps"&gt;CEC&lt;/span&gt; (for Consumer Electronics Control) capability, enabling a video game console or set-top box to send remote-control commands to a television set via the &lt;span class="caps"&gt;HDMI&lt;/span&gt;&amp;nbsp;connection.&lt;/p&gt;
&lt;p&gt;DisplayPort is a computer display standard, focused on computing needs. DisplayPort supports video data, optionally audio data, and additional data (such as &lt;span class="caps"&gt;USB&lt;/span&gt;). Since 2014, compatible devices can also transmit DisplayPort signal format over &lt;span class="caps"&gt;USB&lt;/span&gt;-C, provided both the transmitting and receiving devices support&amp;nbsp;it.&lt;/p&gt;
&lt;h2&gt;Analog vs digital formats: a&amp;nbsp;recap&lt;/h2&gt;
&lt;p&gt;Digital formats differ from analog formats, because they do not carry the raw signal for the device. Instead, they carry information about the image, encoding the image data (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue043.html"&gt;Issue 43&lt;/a&gt;)) into video form; after all, video is just a series of moving images! The device takes on the responsibility of figuring out how to make the images appear on-screen, which is why digital TVs require significantly more electronics than &lt;span class="caps"&gt;CRT&lt;/span&gt;&amp;nbsp;TVs.&lt;/p&gt;
&lt;h2&gt;Analog to digital&amp;nbsp;conversion&lt;/h2&gt;
&lt;p&gt;An analog signal does not easily convert to a digital signal! Analog-to-digital converters, such as the &lt;span class="caps"&gt;VGA&lt;/span&gt;-&lt;span class="caps"&gt;HDMI&lt;/span&gt; adapters that seem to be needed universally, have to figure out how to process a wave-like (analog) signal, and convert it into the pixel data that constitute an image. These adapters need a digital-analog conversion (&lt;span class="caps"&gt;DAC&lt;/span&gt;) chip to carry out that&amp;nbsp;conversion.&lt;/p&gt;
&lt;p&gt;In contrast with analog signals, digital signals usually carry uncompressed video data. Digital-to-digital converters thus do not need to carry out any conversion—it’s the same image! Most of these converters merely need pins to be mapped to each other, which makes them cheaper (e.g. DisplayPort-&lt;span class="caps"&gt;HDMI&lt;/span&gt;&amp;nbsp;converters).&lt;/p&gt;
&lt;p&gt;A chip that is able to handle multiple formats and produce a robust output is costly, and it is expected that a good adapter will cost quite a bit. That is no guarantee, however, that a costly adapter will always be a good&amp;nbsp;adapter.&lt;/p&gt;
&lt;h2&gt;Annddddd &amp;#8230; back to graphics&amp;nbsp;cards&lt;/h2&gt;
&lt;p&gt;The graphics card is in charge of converting the final rasterised signal (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue122.html"&gt;Issue 122&lt;/a&gt;)) to a video signal, depending on the video format that is required. Naturally, this requires additional chips. Most integrated graphics chips support &lt;span class="caps"&gt;VGA&lt;/span&gt; and &lt;span class="caps"&gt;HDMI&lt;/span&gt;, while DisplayPort support is usually reserved for higher-end&amp;nbsp;devices.&lt;/p&gt;
&lt;p&gt;Higher-end graphics cards offer support for more video formats. Furthermore, they also have the capability to rasterise and output video streams for multiple screens, enabling multi-screen support for those who need it. If you find that you need more than two screens for work or play, you are likely going to need a dedicated video card that supports three or more simultaneous video output&amp;nbsp;ports.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Analog formats such as &lt;span class="caps"&gt;VGA&lt;/span&gt; mostly contain the control signals that the &lt;span class="caps"&gt;CRT&lt;/span&gt; needs to operate, while digital formats such as &lt;span class="caps"&gt;HDMI&lt;/span&gt; and DisplayPort contain image data that the device must convert to control signals. Analog signals need a digital-analog-conversion (&lt;span class="caps"&gt;DAC&lt;/span&gt;) chip to be converted to digital signals, hence &lt;span class="caps"&gt;VGA&lt;/span&gt;-&lt;span class="caps"&gt;HDMI&lt;/span&gt; adapters tend to be more costly than DisplayPort-&lt;span class="caps"&gt;HDMI&lt;/span&gt; adapters. Dedicated graphics cards generally support more simultaneous output video streams than integrated graphics&amp;nbsp;cards.&lt;/p&gt;
&lt;p&gt;I hope this sufficiently explains a question I hear so often: why do &lt;span class="caps"&gt;VGA&lt;/span&gt;-&lt;span class="caps"&gt;HDMI&lt;/span&gt; adapters cost so much? I’m also glad this issue ended up much shorter than I&amp;nbsp;expected.&lt;/p&gt;
&lt;p&gt;In general, if your adapter/cable needs a chip to carry out signal conversion, it’s going to cost more than a plain&amp;nbsp;cable.&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 126: &lt;span class="caps"&gt;USB&lt;/span&gt;&amp;nbsp;Type-C&lt;/p&gt;
&lt;p&gt;Next issue, let’s zap some common questions about the latest &lt;span class="caps"&gt;USB&lt;/span&gt; standard! This is going to stretch over two issues. First up: &lt;span class="caps"&gt;USB&lt;/span&gt;-C for&amp;nbsp;data.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 10"></category></entry><entry><title>Issue 124: Video formats</title><link href="https://ngjunsiang.github.io/laymansguide/issue124.html" rel="alternate"></link><published>2021-06-12T08:00:00+08:00</published><updated>2021-06-12T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-06-12:/laymansguide/issue124.html</id><summary type="html">&lt;p&gt;The &lt;span class="caps"&gt;VGA&lt;/span&gt; video format originated in the time of cathode-ray televisions (CRTs). It was superseded by &lt;span class="caps"&gt;HDMI&lt;/span&gt;, a video format standardised by consumer electronics companies. DisplayPort, on the other hand, is a video format standardised by computer display&amp;nbsp;companies.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Graphics cards contain lots of tiny cores that are much better at performing the same calculation for lots of decimal numbers. These cores are organised into compute units; a graphics card with more compute units can perform more calculations every second. Graphics cards have their own onboard memory, separate from the &lt;span class="caps"&gt;CPU&lt;/span&gt;. &lt;span class="caps"&gt;GPU&lt;/span&gt; memory is different from computer memory; it is configured for much higher data throughput. Integrated graphics are GPUs that are integrated into a &lt;span class="caps"&gt;CPU&lt;/span&gt; chip; these do not have their own onboard memory, and share memory with the &lt;span class="caps"&gt;CPU&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Ah, the esoteric, tricky, complicated art of shooting electromagnetic radiation into the eyes of humans … entire tomes have been written about this. And I will attempt to summarise the pertinent parts into a single newsletter issue. The&amp;nbsp;hubris!&lt;/p&gt;
&lt;p&gt;It’s really something when you suddenly remember that television has been around since the 1930s, while computers in some recognisable form were a 1970s invention. The first part of the computer to be invented was the screen!&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;p&gt;How did screens work if computers weren&amp;#8217;t invented? A crash&amp;nbsp;course:&lt;/p&gt;
&lt;h2&gt;Cathode-ray tube (&lt;span class="caps"&gt;CRT&lt;/span&gt;)&amp;nbsp;televisions&lt;/h2&gt;
&lt;p&gt;Early colour television screens had primary-colour (red, blue, and green) phosphor dots embedded in the user-facing portion of the screen. These dots emit coloured light when struck by electrons. At the back of the television, cathodes made of barium oxide are heated, causing them to emit&amp;nbsp;electrons.&lt;/p&gt;
&lt;p&gt;These electrons, when emitted, fly in all directions, but they are shaped into a beam by an electric field (hence the name “cathode &lt;em&gt;ray&lt;/em&gt; tube”, which you might have seen in the form of the acronym &lt;strong&gt;&lt;span class="caps"&gt;CRT&lt;/span&gt;&lt;/strong&gt;).&lt;/p&gt;
&lt;p&gt;&lt;img alt="Cutaway of a CRT, showing the phosphor dot screen" src="https://ngjunsiang.github.io/laymansguide/issue124_01.png" /&gt;&lt;br /&gt;
&lt;small&gt;1: Barium oxide cathode, which is heated to emit electrons (labelled “2”), which are shaped into a a beam by an electric field (labelled “3”)&lt;br /&gt;
4: Deflecting coils, discussed in the next paragraph&lt;br /&gt;
8: Coloured phosphor dots, arranged on a flat screen (labelled “7”).&lt;br /&gt;
Image via &lt;a href="https://en.wikipedia.org/wiki/Cathode-ray_tube"&gt;Wikipedia&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;
&lt;p&gt;This electron beam could be aimed at any of the phosphor dots by a set of electromagnetic deflecting coils mounted along the sides of the &lt;span class="caps"&gt;TV&lt;/span&gt;, on the inside surface. One set, oriented vertically (mounted left-right), controlled the horizontal deflection of the electron beam, while another set, oriented horizontally (mounted top-bottom), controlled the vertical&amp;nbsp;deflection.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Graphic showing an electron beam deflected upwards by deflecting coils in a CRT" src="https://ngjunsiang.github.io/laymansguide/issue124_02.png" /&gt;&lt;br /&gt;
&lt;small&gt;The electron beam produced by the cathode is deflected by (electromagnetic) deflecting coils.&lt;br /&gt;
Image via &lt;a href="https://en.wikipedia.org/wiki/Cathode-ray_tube"&gt;Wikipedia&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;
&lt;p&gt;To produce an image, the electron beam is manipulated to scan across the screen, one line at a time. Each pass across the screen causes it to strike phosphor dots, emitting light in a line. A variety of techniques (microdeflections, masks, and filters) are used to ensure the correct dots are&amp;nbsp;struck.&lt;/p&gt;
&lt;p&gt;Each line of the screen is laboriously scanned with this technique, about 60 times a second. This means that the screen “updates” with a refresh rate of 60&amp;nbsp;Hz.&lt;/p&gt;
&lt;p&gt;To make this happen, a varying voltage is applied across the two sets of deflecting coils. The required pattern for the deflecting coils has to come from the television signal source; the television signal from the broadcasting station, therefore, closely resembles the pattern required by the deflecting coils. The television itself applies almost no processing to this signal! (Remember that the chips used to do this kind of processing had not been invented&amp;nbsp;yet.)&lt;/p&gt;
&lt;p&gt;These are what we call &lt;strong&gt;analog&lt;/strong&gt; signals. Phonographs and early telephones also used analog&amp;nbsp;signals.&lt;/p&gt;
&lt;h2&gt;Video Graphics Array (&lt;span class="caps"&gt;VGA&lt;/span&gt;)&lt;/h2&gt;
&lt;p&gt;So when the computer was first invented, and these screens were widely available, there was no need to reinvent the screen. Graphics cards (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue123.html"&gt;Issue 123&lt;/a&gt;)) simply had to figure out how to emit analog signals that would work with &lt;span class="caps"&gt;CRT&lt;/span&gt;&amp;nbsp;screens.&lt;/p&gt;
&lt;p&gt;The graphics standard for doing so is called &lt;strong&gt;&lt;span class="caps"&gt;VGA&lt;/span&gt;&lt;/strong&gt; (Video Graphics Array), and was first released by &lt;span class="caps"&gt;IBM&lt;/span&gt; in 1986. An organisation, the Video Electronics Standards Association (&lt;strong&gt;&lt;span class="caps"&gt;VESA&lt;/span&gt;&lt;/strong&gt;), was quickly formed in 1989, spearheaded by Nippon Electric Company (&lt;span class="caps"&gt;NEC&lt;/span&gt;), to extend this standard and allow it to support higher resolutions (up to&amp;nbsp;1080p!).&lt;/p&gt;
&lt;h2&gt;LCDs replaced&amp;nbsp;CRTs&lt;/h2&gt;
&lt;p&gt;As CRTs grow larger, they ran into a few problems. CRTs were big, bulky, and heavy. The larger you made them, the longer you had to make the cathode ray tube, which made them immensely&amp;nbsp;heavy!&lt;/p&gt;
&lt;p&gt;By this point, &lt;span class="caps"&gt;LCD&lt;/span&gt; technology had been developed. Instead of using a scanning electron beam, it consisted of a backlight&lt;sup id="fnref:2"&gt;&lt;a class="footnote-ref" href="#fn:2"&gt;2&lt;/a&gt;&lt;/sup&gt; behind a liquid crystal layer (hence the term liquid crystal display, &lt;strong&gt;&lt;span class="caps"&gt;LCD&lt;/span&gt;&lt;/strong&gt;).&lt;/p&gt;
&lt;p&gt;The liquid crystal layer consisted of pixels of each primary colour. Each pixel had an adjustable transparency, which depended on the voltage applied across it (high voltage = transparent, low voltage = opaque); a cluster of red, green, and blue pixels formed a single image pixel on screen. By applying different voltages across each primary-colour pixel, we can put an image&amp;nbsp;together.&lt;/p&gt;
&lt;h2&gt;Digital&amp;nbsp;signals&lt;/h2&gt;
&lt;p&gt;CRTs controlled the voltage plates directly to deflect an electron beam, through an analog signal. But LCDs use an internal processor to determine what voltage to apply across each liquid crystal pixel. As the technology improved, lower voltages could be used to reduce power usage. So LCDs need a different kind of signal: a &lt;strong&gt;digital&lt;/strong&gt; one, consisting of the &lt;em&gt;raw image data&lt;/em&gt; (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue043.html"&gt;Issue 43&lt;/a&gt;)).&lt;/p&gt;
&lt;h2&gt;The exodus to digital&amp;nbsp;formats&lt;/h2&gt;
&lt;p&gt;As digital television became more feasible due to decreasing microprocessor and &lt;span class="caps"&gt;LCD&lt;/span&gt; screen costs, digital formats sprung up to replace &lt;span class="caps"&gt;VGA&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;An early competitor, Digital Visual Interface (&lt;strong&gt;&lt;span class="caps"&gt;DVI&lt;/span&gt;&lt;/strong&gt;), was launched by a working group convened by some computer makers (Intel, Silicon Image, Compaq, Fujitsu, &lt;span class="caps"&gt;HP&lt;/span&gt;, &lt;span class="caps"&gt;IBM&lt;/span&gt;, &lt;span class="caps"&gt;NEC&lt;/span&gt;). It was very quickly superceded by High-Definition Multimedia Interface (&lt;strong&gt;&lt;span class="caps"&gt;HDMI&lt;/span&gt;&lt;/strong&gt;), an interface which implemented standards set by consumer electronics companies (Hitachi, Sanyo, Silicon Image, Sony, Technicolor,&amp;nbsp;Toshiba).&lt;/p&gt;
&lt;p&gt;&lt;img alt="HDMI and mini-HDMI connectors displayed top-to-bottom" src="https://ngjunsiang.github.io/laymansguide/issue124_03.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;&lt;span class="caps"&gt;HDMI&lt;/span&gt; and mini-&lt;span class="caps"&gt;HDMI&lt;/span&gt; connectors displayed from top to bottom. Both support the &lt;span class="caps"&gt;HDMI&lt;/span&gt; video standard&lt;br /&gt;Image via &lt;a href="https://www.datapro.net/techinfo/hdmi_info.html"&gt;DataPro&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;This was followed by the DisplayPort (&lt;strong&gt;&lt;span class="caps"&gt;DP&lt;/span&gt;&lt;/strong&gt;) standard, developed by &lt;span class="caps"&gt;PC&lt;/span&gt; and chip manufacturers and standardised by &lt;span class="caps"&gt;VESA&lt;/span&gt;, and released in in&amp;nbsp;2006.&lt;/p&gt;
&lt;p&gt;&lt;img alt="DisplayPort, mini-DisplayPort, and Thunderbolt Type-C connectors displayed side-by-side" src="https://ngjunsiang.github.io/laymansguide/issue124_04.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;DisplayPort, mini-DisplayPort, and Thunderbolt Type-C connectors displayed from left to right. All three support the DisplayPort video standard&lt;br /&gt;Image via &lt;a href="https://www.datapro.net/techinfo/displayport_info.html"&gt;DataPro&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; The &lt;span class="caps"&gt;VGA&lt;/span&gt; video format originated in the time of cathode-ray televisions (CRTs). It was superseded by &lt;span class="caps"&gt;HDMI&lt;/span&gt;, a video format standardised by consumer electronics companies. DisplayPort, on the other hand, is a video format standardised by computer display&amp;nbsp;companies.&lt;/p&gt;
&lt;p&gt;Phew. This issue is much longer than I would like; there is so much history to these things! The &lt;span class="caps"&gt;HDMI&lt;/span&gt;-vs-DisplayPort question/complaint I keep hearing is one that only made sense for me in the context of the respective industries they sprung from, and this is something I think most layfolks could definitely&amp;nbsp;understand.&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 125: Analog and digital&amp;nbsp;conversion&lt;/p&gt;
&lt;p&gt;Now that I’ve laid out the key differences between &lt;span class="caps"&gt;VGA&lt;/span&gt;, &lt;span class="caps"&gt;HDMI&lt;/span&gt;, and DisplayPort, we can talk about &amp;#8230; video&amp;nbsp;adapters.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;To be pedantic, the first part of the computer to be invented was actually the keyboard, but they were non-electronic and were called typewriters then.&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;Older LCDs used cold-cathode fluorescent lamps (CCFLs) for backlights, but today LEDs are used instead.&amp;#160;&lt;a class="footnote-backref" href="#fnref:2" title="Jump back to footnote 2 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><category term="Season 10"></category></entry><entry><title>Issue 123: Graphics cards: The Pixel Factory</title><link href="https://ngjunsiang.github.io/laymansguide/issue123.html" rel="alternate"></link><published>2021-06-05T08:00:00+08:00</published><updated>2021-06-05T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-06-05:/laymansguide/issue123.html</id><summary type="html">&lt;p&gt;Graphics cards contain lots of tiny cores that are much better at performing the same calculation for lots of decimal numbers. These cores are organised into compute units; a graphics card with more compute units can perform more calculations every second. Graphics cards have their own onboard memory, separate from the &lt;span class="caps"&gt;CPU&lt;/span&gt;. &lt;span class="caps"&gt;GPU&lt;/span&gt; memory is different from computer memory; it is configured for much higher data throughput. Integrated graphics are GPUs that are integrated into a &lt;span class="caps"&gt;CPU&lt;/span&gt; chip; these do not have their own onboard memory, and share memory with the &lt;span class="caps"&gt;CPU&lt;/span&gt;.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Computers are general-purpose machines that usually process integer calculations. The graphics pipeline requires more specialised hardware that can process decimal number calculations. This is why high-performance graphics usually requires a graphics&amp;nbsp;card.&lt;/p&gt;
&lt;p&gt;So why are gamers so agog over &lt;strong&gt;graphics cards&lt;/strong&gt; (also known as video cards)? That’s because they do one thing really well! Unlike CPUs which often have to process an unpredictable workload, the graphics pipeline involves performing the same categories of calculations over and over&amp;nbsp;again.&lt;/p&gt;
&lt;h2&gt;Graphics compute&amp;nbsp;units&lt;/h2&gt;
&lt;p&gt;These calculations, which I gave an overview of in &lt;a href="https://ngjunsiang.github.io/laymansguide/issue122.html"&gt;Issue 122&lt;/a&gt;), take in tables of numbers, crunch them mathematically, and spit out another table of numbers. Since the calculations are predictable, we don&amp;#8217;t need very complicated hardware that enables switching instructions based on the input. We can used specialised cores—clusters of transistors that are custom-fit for the purpose, cram lots of them into a circuit board, and end up with much better performance for the graphics pipeline compared to the &lt;span class="caps"&gt;CPU&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;These cores are organised into groups known as &lt;strong&gt;compute units&lt;/strong&gt;, and graphics card companies often differentiate the lower-end and higher-end cards by the number of compute units they have, which indicate the computation rate (measured in &lt;strong&gt;flops&lt;/strong&gt;, which stand for &lt;strong&gt;fl&lt;/strong&gt;oating-point&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt; &lt;strong&gt;o&lt;/strong&gt;perations &lt;strong&gt;p&lt;/strong&gt;er &lt;strong&gt;s&lt;/strong&gt;econd). Better graphics require more computation, so more flops correlate with better&amp;nbsp;graphics.&lt;/p&gt;
&lt;h2&gt;Graphics&amp;nbsp;memory&lt;/h2&gt;
&lt;p&gt;Graphics cards often come with their own memory chips, based on a different technology (&lt;strong&gt;&lt;span class="caps"&gt;GDDR&lt;/span&gt;&lt;/strong&gt;, standing for “graphics double data rate”, vs &lt;strong&gt;&lt;span class="caps"&gt;DDR&lt;/span&gt;&lt;/strong&gt; for CPUs). Graphics memory chips (&lt;span class="caps"&gt;GDDR&lt;/span&gt;) are optimised for higher bandwidth (more gigabytes transferred per second), while &lt;span class="caps"&gt;CPU&lt;/span&gt; memory chips (&lt;span class="caps"&gt;DDR&lt;/span&gt;) are optimised for lower latency (lower time to response). These are soldered directly onto the graphics card to keep memory readily accessible by the compute&amp;nbsp;units.&lt;/p&gt;
&lt;h2&gt;Power and&amp;nbsp;heat&lt;/h2&gt;
&lt;p&gt;Unlike CPUs, which (for desktops) seldom draw more than 100W by themselves, graphics cards (for desktops) can draw up to 300W. Correspondingly, more of the space on graphics cards are taken up by components that try to keep this immense power under control. Voltage regulation modules help to adjust input voltages to what the compute units and memory&amp;nbsp;requires.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Graphics card without its shroud and cooler" src="https://ngjunsiang.github.io/laymansguide/issue123_01.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;A graphics card, here exposed without its shroud and cooler.&lt;br /&gt;The graphics chip is in the middle, surrounded by graphics memory chips (smaller, black squares) close to the edges of the board. The larger protruding gray rectangles are voltage regulation modules.&lt;br /&gt;Image from &lt;a href="https://www.gamersnexus.net/guides/2826-differences-between-ddr4-and-gddr5"&gt;Gamersnexus&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;h2&gt;Other&amp;nbsp;uses&lt;/h2&gt;
&lt;p&gt;The graphics card excels at carrying out predictable decimal calculations in a pipeline. Besides graphics, what else can it be used&amp;nbsp;for?&lt;/p&gt;
&lt;p&gt;In research, they have been purposed to perform calculations for simulations, which often involve processing the same calculation in&amp;nbsp;bulk.&lt;/p&gt;
&lt;p&gt;For consumer purposes, they have also been used for video decoding (decompressing videos for playback), and lately even video encoding (compressing videos to a smaller size). These also involve performing the same types of calculations in a predictable&amp;nbsp;pipeline.&lt;/p&gt;
&lt;p&gt;Most recently, they are being used for machine learning (also known as “artificial intelligence”) models, again because those involve predictable pipelines (Do you are see a pattern&amp;nbsp;here?)&lt;/p&gt;
&lt;h2&gt;Integrated&amp;nbsp;graphics&lt;/h2&gt;
&lt;p&gt;Not all computers need a full-size &lt;span class="caps"&gt;GPU&lt;/span&gt; to render graphics on screen. Intel processors, and some of the newer &lt;span class="caps"&gt;AMD&lt;/span&gt; ones, contain what is known as &lt;strong&gt;integrated graphics&lt;/strong&gt;. That means that these CPUs have a graphics processor unit (&lt;span class="caps"&gt;GPU&lt;/span&gt;) integrated into the same chip. This integrated &lt;span class="caps"&gt;GPU&lt;/span&gt; provides basic capabilities which allow typical users to use a computer, and even run low-end graphics programs, without needing to buy a higher-end graphics&amp;nbsp;card.&lt;/p&gt;
&lt;p&gt;Integrated GPUs do not have their own memory. They share computer memory with the &lt;span class="caps"&gt;CPU&lt;/span&gt;. That means that they reserve a (configurable) amount of computer memory for graphics use (typically up to 128 &lt;span class="caps"&gt;MB&lt;/span&gt;), and video card drivers (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue120.html"&gt;Issue 120&lt;/a&gt;)) enable the &lt;span class="caps"&gt;GPU&lt;/span&gt; to use more system memory (&lt;a href="https://www.intel.sg/content/www/xa/en/support/articles/000020962/graphics.html"&gt;up to 50% for Intel integrated graphics&lt;/a&gt;). This means that integrated graphics use slower memory compared to dedicated graphics cards that have their own&amp;nbsp;memory.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Graphics cards contain lots of tiny cores that are much better at performing the same calculation for lots of decimal numbers. These cores are organised into compute units; a graphics card with more compute units can perform more calculations every second. Graphics cards have their own onboard memory, separate from the &lt;span class="caps"&gt;CPU&lt;/span&gt;. &lt;span class="caps"&gt;GPU&lt;/span&gt; memory is different from computer memory; it is configured for much higher data throughput. Integrated graphics are GPUs that are integrated into a &lt;span class="caps"&gt;CPU&lt;/span&gt; chip; these do not have their own onboard memory, and share memory with the &lt;span class="caps"&gt;CPU&lt;/span&gt;.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S10] Issue 124: Video&amp;nbsp;formats&lt;/p&gt;
&lt;p&gt;I haven’t talked about the last part, because this issue is long enough already, and because the next part can fill a whole issue by itself. Next up, the last stage: actually displaying pixels on a&amp;nbsp;screen.&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;&lt;del&gt;a video card? [Issue 113]&lt;/del&gt;&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;“Floating-point” is a fancy term for decimal, so-called because the way they are represented allows the decimal point to be placed differently, unlike with integers.&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 10"></category><category term="memory"></category></entry><entry><title>Issue 122: The great flattening</title><link href="https://ngjunsiang.github.io/laymansguide/issue122.html" rel="alternate"></link><published>2021-05-29T08:00:00+08:00</published><updated>2021-05-29T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-05-29:/laymansguide/issue122.html</id><summary type="html">&lt;p&gt;Computers are general-purpose machines that usually process integer calculations. The graphics pipeline requires more specialised hardware that can process decimal number calculations. This is why high-performance graphics usually requires a graphics&amp;nbsp;card.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; 3D models are represented with vertices (points), edges (line segments between points), and faces in a computer. Images known as textures can be mapped to faces to give the impression of&amp;nbsp;detail.&lt;/p&gt;
&lt;p&gt;Having a model represented in a computer as a large set of numbers is cool, but nobody does 3D modelling like that. We need something to look at! We need a way to convert our model into a flat picture, ideally displayed on our monitors. And this conversion process needs to be fast enough that as we rotate or change the view of our model, the computer can keep up, displaying the changes in&amp;nbsp;real-time.&lt;/p&gt;
&lt;p&gt;This process is called &lt;strong&gt;rendering&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;A pipeline for rendering&amp;nbsp;pictures&lt;/h2&gt;
&lt;p&gt;During rendering, data from the modelling program is processed in a series of steps; these steps together are known as the &lt;strong&gt;graphics pipeline&lt;/strong&gt;. If you’ve done perspective drawing or tried to figure out how to create clever camera tricks, you already have a sense of what the computer needs to do&amp;nbsp;here.&lt;/p&gt;
&lt;p&gt;The 3D cube on screen looks different depending on where our eye is, and which direction it is looking. Our distance to the cube affects how much distortion the view undergoes. Lighting also affects how the cube appears, by making shaded areas appear darker, and lit areas appear&amp;nbsp;brighter.&lt;/p&gt;
&lt;p&gt;Finally, this 3D model needs to be “distorted” into a 2D view so it can be displayed on a screen. (We don’t have 3D holo-projectors yet …&amp;nbsp;😢)&lt;/p&gt;
&lt;p&gt;Lastly, since our screens display images as a grid of pixels, we need to figure out the best way to convert the distorted 2D view into a pixel grid. This part of the pipeline is known as &lt;strong&gt;rasterisation&lt;/strong&gt;. Here, the computer figures out what colour each pixel should be, based on which part of the model actually gets projected here. Hidden parts do not need to be rasterised, and neither do parts of the model which are outside the&amp;nbsp;screen.&lt;/p&gt;
&lt;p&gt;All these steps take place in the graphics&amp;nbsp;pipeline.&lt;/p&gt;
&lt;h2&gt;The&amp;nbsp;hardware&lt;/h2&gt;
&lt;p&gt;The pipeline used to be carried out by the &lt;span class="caps"&gt;CPU&lt;/span&gt; (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue053.html"&gt;Issue 53&lt;/a&gt;)), but that isn’t ideal. The &lt;span class="caps"&gt;CPU&lt;/span&gt;’s hardware is optimised for &lt;em&gt;general-purpose processing&lt;/em&gt;: keeping track of integers (i.e. natural numbers like 1, 2, 3, …), adding or subtracting them, and resetting them. It has many more computational units that carry out this&amp;nbsp;calculation.&lt;/p&gt;
&lt;p&gt;Graphics processing, on the other hand, requires a different kind of calculation. The position of vertices do not fit nicely into integers; we have to carry this out using decimal numbers (1.46776, 2.58704, –3.57514, …). The &lt;span class="caps"&gt;CPU&lt;/span&gt; does not encounter these often, and therefore does not have many of these computational&amp;nbsp;units.&lt;/p&gt;
&lt;p&gt;For graphics, we need a different kind of processor, one that is jam-packed with decimal computational units. We need a &lt;strong&gt;graphics card&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Computers are general-purpose machines that usually process integer calculations. The graphics pipeline requires more specialised hardware that can process decimal number calculations. This is why high-performance graphics usually requires a graphics&amp;nbsp;card.&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 123: Graphics cards: The Pixel&amp;nbsp;Factory&lt;/p&gt;
&lt;p&gt;So what does a graphics card do, just pop out pixels like nobody’s&amp;nbsp;business?&lt;/p&gt;
&lt;p&gt;Yep! Next week, a quick intro to graphics cards, and why they are so amazing. And, because this is recent news, some coverage on how the M1 differs from most laptops in the way it manages the &lt;span class="caps"&gt;CPU&lt;/span&gt; and &lt;span class="caps"&gt;GPU&lt;/span&gt; (graphics processing&amp;nbsp;unit).&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 video card? [Issue&amp;nbsp;113]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 10"></category></entry><entry><title>Issue 121: In graphic detail</title><link href="https://ngjunsiang.github.io/laymansguide/issue121.html" rel="alternate"></link><published>2021-05-22T08:00:00+08:00</published><updated>2021-05-22T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-05-22:/laymansguide/issue121.html</id><summary type="html">&lt;p&gt;3D models are represented with vertices (points), edges (line segments between points), and faces in a computer. Images known as textures can be mapped to faces to give the impression of&amp;nbsp;detail.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Driver files provide information about the driver, and instructions on how to receive information from the device, and encode information to be passed to the device. The operating system may come with generic driver files for the device, but custom driver files might provide better performance or additional&amp;nbsp;features.&lt;/p&gt;
&lt;p&gt;This issue, let’s start from scratch with graphics: how does a machine that only processes 1s and 0s work with graphics? For starters, let’s think: what can we represent about graphics if we only have&amp;nbsp;numbers?&lt;/p&gt;
&lt;h2&gt;Representing graphics using&amp;nbsp;numbers&lt;/h2&gt;
&lt;p&gt;Numbers can be used to represent points (a &lt;strong&gt;vertex&lt;/strong&gt;, in graphics-speak). In 3D space, a point can be represented with 3 numbers, usually written in math&amp;nbsp;as &lt;code&gt;(x, y, z)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;A line (&lt;strong&gt;edge&lt;/strong&gt;, in graphics-speak) can be represented as a segment between two points. So we can represent straight-line segments using two points. Curved-line segments are trickier, but for now a lazy way to represent them is just &amp;#8230; using a series of points 😛 like connect-the-dots&amp;nbsp;puzzles!&lt;/p&gt;
&lt;p&gt;Surfaces are &amp;#8230; a bit trickier. What is the minimum number of points we need to represent a flat surface? Turns out the answer is 3 points: if we pick any 3 points that are not along the same line, we can join them along their edges and they form a triangle, which is a flat&amp;nbsp;surface!&lt;/p&gt;
&lt;p&gt;In graphics-speak, we call these surfaces &lt;strong&gt;faces&lt;/strong&gt;. Four points which form a flat four-pointed face are called quads, and we can do the same for polygons with more points too. But most graphics hardware just deals with triangles and quads, because everything else can be represented using triangles and quads&amp;nbsp;anyway.&lt;/p&gt;
&lt;h2&gt;Making 3D&amp;nbsp;models&lt;/h2&gt;
&lt;p&gt;3D modelling software (also referred to as computer-aided design software, or &lt;span class="caps"&gt;CAD&lt;/span&gt; software) helps us with the process of creating vertices (plural for vertex), edges, and faces. Any object we model digitally is just a collection of vertices, edges, and faces: we call such collections a &lt;strong&gt;mesh&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;Textures&lt;/h2&gt;
&lt;p&gt;With just meshes, we quickly run into the limits of what can be represented. For simplicity of calculation, each face can only have one colour. To make really detailed and realistic models, we need very finely detailed meshes. These are problematic because a lot of calculation is needed to make these models appear on screen; the more faces it has, the more calculation is&amp;nbsp;needed!&lt;/p&gt;
&lt;p&gt;One way to reduce the number of faces in the mesh while still creating a decent model is to &lt;em&gt;use images on the face&lt;/em&gt;. (I explained how images are represented in computers in &lt;a href="https://ngjunsiang.github.io/laymansguide/issue043.html"&gt;Issue 43&lt;/a&gt;)) We will need additional information to describe the scale and rotation of the image on the face, but at least we can use the same image across multiple faces if necessary. Instead of having to model a hundred thousand blades of grass, I could just model a few stalks, and use a grassy texture to complete the&amp;nbsp;impression.&lt;/p&gt;
&lt;h2&gt;Scene&amp;nbsp;modelling&lt;/h2&gt;
&lt;p&gt;Just having models is pretty boring. We will usually be putting multiple models in a scene. Besides models, a scene needs to have lighting, a way to model the sky as the background, and other&amp;nbsp;niceties.&lt;/p&gt;
&lt;p&gt;We can use numbers to describe the position, luminosity (i.e. &lt;strong&gt;brightness&lt;/strong&gt;), hue (i.e. &lt;strong&gt;colour&lt;/strong&gt;), and other properties of lighting in our&amp;nbsp;scene.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; 3D models are represented with vertices (points), edges (line segments between points), and faces in a computer. Images known as textures can be mapped to faces to give the impression of&amp;nbsp;detail.&lt;/p&gt;
&lt;p&gt;Great, we have a way to use numbers to describe a 3D model; that’s nice progress. But how do we turn those numbers into a picture on&amp;nbsp;screen?&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 122: The great&amp;nbsp;flattening&lt;/p&gt;
&lt;p&gt;Numbers, numbers, and more numbers … isn’t the &lt;span class="caps"&gt;CPU&lt;/span&gt; great at numbers? Why do gamers and 3D modellers have the hots for graphics cards instead? Stay tuned next&amp;nbsp;week!&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 video card? [Issue&amp;nbsp;113]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 10"></category></entry><entry><title>Issue 120: Drivers, the glue between hardware and firmware</title><link href="https://ngjunsiang.github.io/laymansguide/issue120.html" rel="alternate"></link><published>2021-05-15T08:00:00+08:00</published><updated>2021-05-15T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-05-15:/laymansguide/issue120.html</id><summary type="html">&lt;p&gt;Driver files provide information about the driver, and instructions on how to receive information from the device, and encode information to be passed to the device. The operating system may come with generic driver files for the device, but custom driver files might provide better performance or additional&amp;nbsp;features.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Solid-state disks are much faster than hard disks because they have no moving parts, so no time is wasted waiting for parts to get into the right position. However, they are more expensive than hard disk&amp;nbsp;drives.&lt;/p&gt;
&lt;p&gt;So this issue, we finally get to a question that most folks would have asked at some point after buying a new&amp;nbsp;device:&lt;/p&gt;
&lt;p&gt;“What is a (device) driver and why do I need&amp;nbsp;one?”&lt;/p&gt;
&lt;p&gt;This issue is going to focus on &lt;span class="caps"&gt;USB&lt;/span&gt; devices, since that is by far the largest category of devices that people use. But driver files are needed for all hardware, including disks, monitors, hardware timers, controller chips,&amp;nbsp;…&lt;/p&gt;
&lt;h2&gt;&lt;span class="caps"&gt;USB&lt;/span&gt;&amp;nbsp;Devices&lt;/h2&gt;
&lt;p&gt;The &lt;span class="caps"&gt;USB&lt;/span&gt; specification was first released in 1996, and today it contains 21 categories of devices, each containing even more&amp;nbsp;subcategories.&lt;/p&gt;
&lt;p&gt;Each category of device has its own protocol for sending information to the computer, and receiving information from the&amp;nbsp;computer.&lt;/p&gt;
&lt;p&gt;I don’t think I am over-exaggerating things to say that there are an uncountable number of &lt;span class="caps"&gt;USB&lt;/span&gt; devices in the world today. For this reason, it makes no sense to complain to the &lt;a href="https://en.wikipedia.org/wiki/USB_Implementers_Forum"&gt;&lt;span class="caps"&gt;USB&lt;/span&gt; Implementers’ Forum&lt;/a&gt; (&lt;span class="caps"&gt;USB&lt;/span&gt;-&lt;span class="caps"&gt;IF&lt;/span&gt;), which is responsible for designing the &lt;span class="caps"&gt;USB&lt;/span&gt; specification. Device manufacturers themselves have to be the one responsible for making their device work with our&amp;nbsp;computers.&lt;/p&gt;
&lt;p&gt;They do so by providing driver files with their devices. In a not-so-distant past, every device you bought came with drivers on a &lt;span class="caps"&gt;CD&lt;/span&gt;-&lt;span class="caps"&gt;ROM&lt;/span&gt; or &lt;span class="caps"&gt;DVD&lt;/span&gt;-&lt;span class="caps"&gt;ROM&lt;/span&gt;, which you had to install before use. Today, it is more likely that you’ll download these drivers from the manufacturer’s website. If this is a widely used device (e.g. monitors or input devices like keyboards or mice), it might even make its drivers (and updates to those drivers) available through Windows&amp;nbsp;Update.&lt;/p&gt;
&lt;h2&gt;What is a driver&amp;nbsp;file?&lt;/h2&gt;
&lt;p&gt;Simply put, a driver file tells the&amp;nbsp;computer:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;information about the device (its name, category, and available&amp;nbsp;features)&lt;/li&gt;
&lt;li&gt;how to interpret signals coming from the device (through the &lt;span class="caps"&gt;USB&lt;/span&gt;&amp;nbsp;cable),&lt;/li&gt;
&lt;li&gt;how to encode signals to be sent to the device so that it can understand&amp;nbsp;them.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;span class="caps"&gt;USB&lt;/span&gt;-&lt;span class="caps"&gt;IF&lt;/span&gt; maintains a database of vendors and their products. Companies that wish to have their products recognised should &lt;a href="https://www.usb.org/getting-vendor-id"&gt;get a vendor &lt;span class="caps"&gt;ID&lt;/span&gt;&lt;/a&gt; through the &lt;span class="caps"&gt;USB&lt;/span&gt;-&lt;span class="caps"&gt;IF&lt;/span&gt;; this also allows them to use the &lt;span class="caps"&gt;USB&lt;/span&gt;-&lt;span class="caps"&gt;IF&lt;/span&gt; logo (for &lt;span class="caps"&gt;USB&lt;/span&gt;-certified™) on their product packaging if the product passes&amp;nbsp;certification.&lt;/p&gt;
&lt;p&gt;When a device is inserted, it passes information including its vendor &lt;span class="caps"&gt;ID&lt;/span&gt; and product &lt;span class="caps"&gt;ID&lt;/span&gt; to the computer. Each driver file also includes the vendor &lt;span class="caps"&gt;ID&lt;/span&gt; and product &lt;span class="caps"&gt;ID&lt;/span&gt; it is meant for use with. This allows the computer to verify that the correct driver is installed for the&amp;nbsp;device.&lt;/p&gt;
&lt;p&gt;If you insert a device and Windows says it does not recognise it, you can be sure the problem has something to do with the device file (if the device is otherwise working&amp;nbsp;properly).&lt;/p&gt;
&lt;p&gt;On your computer, you can view a list of your devices and inspect their driver details using Device&amp;nbsp;Manager.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Device Manager in Windows 10" src="https://ngjunsiang.github.io/laymansguide/issue120_01.png" /&gt;&lt;br /&gt;
&lt;em&gt;Device Manager in Windows&amp;nbsp;10&lt;/em&gt;    &lt;/p&gt;
&lt;h2&gt;Generic&amp;nbsp;drivers&lt;/h2&gt;
&lt;p&gt;When you first set up your computer, it is not going to have driver files for devices that are already connected. How are you supposed to use your keyboard, mouse, and monitor, among other&amp;nbsp;things?&lt;/p&gt;
&lt;p&gt;The major operating systems come with &lt;strong&gt;generic driver files&lt;/strong&gt; pre-packaged. These generic driver files support a class of devices (e.g. input devices, pointing devices, display devices, …) for &lt;em&gt;basic features only&lt;/em&gt;. Manufacturers that wish their devices to work upon plugging in (this capability is also known as &lt;strong&gt;Plug-and-Play&lt;/strong&gt;) should aim to support these basic features through the use of generic&amp;nbsp;drivers.&lt;/p&gt;
&lt;p&gt;They can then encourage the customer to install custom drivers which may improve the device performance (e.g. for wifi or &lt;span class="caps"&gt;LAN&lt;/span&gt; networking devices), or provide additional features (e.g. storing mouse button configuration settings, or programmable mouse/keyboard&amp;nbsp;buttons).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Driver files provide information about the driver, and instructions on how to receive information from the device, and encode information to be passed to the device. The operating system may come with generic driver files for the device, but custom driver files might provide better performance or additional&amp;nbsp;features.&lt;/p&gt;
&lt;p&gt;Driver files were one of those mysterious things that made perfect sense once I took the time to think about why they are needed. I hope this issue does that for you&amp;nbsp;too.&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 121: In graphic&amp;nbsp;detail&lt;/p&gt;
&lt;p&gt;One part I’ve always wanted to tackle with this season is explaining the process of getting graphics onto your monitor screen. The explanations I’ve found online are either too vague, trying to paper over the details with metaphors, or far too technical, going into exhaustive detail about the graphics rendering&amp;nbsp;pipeline.&lt;/p&gt;
&lt;p&gt;I want to strike more of a middle ground, to help those who have read the former and are trying to bridge the gap to the latter. The next two issues are going to talk about the processes involved in going from model (the computer’s view of things) to graphics (the final rendered&amp;nbsp;display).&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;&lt;del&gt;a driver file and why do I need one? [Issue 98]&lt;/del&gt;&lt;/li&gt;
&lt;li&gt;a video card? [Issue&amp;nbsp;113]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 10"></category></entry><entry><title>Issue 119: Solid-state disks, an upgrade from hard disks</title><link href="https://ngjunsiang.github.io/laymansguide/issue119.html" rel="alternate"></link><published>2021-05-08T08:00:00+08:00</published><updated>2021-05-08T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-05-08:/laymansguide/issue119.html</id><summary type="html">&lt;p&gt;Solid-state disks are much faster than hard disks because they have no moving parts, so no time is wasted waiting for parts to get into the right position. However, they are more expensive than hard disk&amp;nbsp;drives.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; A hard disk consists of a read arm, and a set of magnetic platters which store data. To read or write data, the read arm must move to the appropriate track of the rotating platter, and detect the magnetic field (for reading), or attempt to magnetise the domains on the platter (for writing). Operations that require the read arm to access different parts of the magnetic platters intermittently result in slower read&amp;nbsp;speeds.&lt;/p&gt;
&lt;p&gt;Hard disks were, for a long time, the best affordable storage technology we had. But then something better came along: the solid state disk&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt; (&lt;span class="caps"&gt;SSD&lt;/span&gt;).&lt;/p&gt;
&lt;h2&gt;What is a solid state&amp;nbsp;disk?&lt;/h2&gt;
&lt;p&gt;It is, to put it simply, a small circuit board with lots of chips, that plugs into your&amp;nbsp;laptop.&lt;/p&gt;
&lt;p&gt;It has multiple storage chips, quite similar to the ones in your thumb drives/flash drives but much faster, and one controller chip to rule em&amp;nbsp;all.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Solid state disk inserted into laptop slot" src="https://ngjunsiang.github.io/laymansguide/issue119_01.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;A solid state disk, plugged into a laptop slot (but not&amp;nbsp;secured)&lt;/em&gt;    &lt;/p&gt;
&lt;h2&gt;Hmm &amp;#8230; like computer&amp;nbsp;memory?&lt;/h2&gt;
&lt;p&gt;Computer memory also consists of chips on a circuit board, right? But memory gets wiped after the computer loses power &amp;#8230; but that doesn’t happen with SSDs;&amp;nbsp;why?&lt;/p&gt;
&lt;p&gt;&lt;img alt="Computer memory inserted into memory slot" src="https://ngjunsiang.github.io/laymansguide/issue119_02.png" /&gt;&lt;br /&gt;
&lt;em&gt;Computer memory sticks, inserted into the memory slot of a computer&amp;nbsp;motherboard&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Computer memory uses capacitors, which are like micro-sized batteries. They hold a charge when powered, and store either a 1 or 0 state by being charged or uncharged,&amp;nbsp;respectively.&lt;/p&gt;
&lt;p&gt;Solid state storage, on the other hand, uses gated transistors instead of capacitors. They lock a bunch of electrons behind a gate to fill a storage cell (storing a 1), and empty it by forcing the electrons out (strong a 0). This is slower than charging/discharging a capacitor, but hey you don’t lose your data when the power goes&amp;nbsp;out!&lt;/p&gt;
&lt;h2&gt;Solid state disks have no moving&amp;nbsp;parts&lt;/h2&gt;
&lt;p&gt;As you can see, there are no read arms or magnetic platters involved. No waiting for a platter to spin up, no waiting for a read arm to move back and forth &amp;#8230; access is almost instantaneous&lt;sup id="fnref:2"&gt;&lt;a class="footnote-ref" href="#fn:2"&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;This is a big deal when reading data from multiple locations; the response is hundreds of times quicker than a hard&amp;nbsp;disk!&lt;/p&gt;
&lt;h2&gt;What’s the&amp;nbsp;drawback?&lt;/h2&gt;
&lt;p&gt;The biggest drawback for now is of course price. Solid state disks cost much more, per &lt;span class="caps"&gt;GB&lt;/span&gt;, than a hard disk drive (&lt;span class="caps"&gt;HDD&lt;/span&gt;).&lt;/p&gt;
&lt;p&gt;Another potential drawback is that SSDs have a limited lifespan. This lifespan is not measured in months or years, but in the amount of data&amp;nbsp;written.&lt;/p&gt;
&lt;p&gt;You see, each time electrons are forced through the gate (called a program-erase cycle), the gate gets weaker. Do it tens of thousands of times, and eventually the gate gets too weak to hold electrons. A budget &lt;span class="caps"&gt;SSD&lt;/span&gt; typically has a lifespan of 30,000 program-erase cycles. For a &lt;span class="caps"&gt;256GB&lt;/span&gt; &lt;span class="caps"&gt;SSD&lt;/span&gt;, that’s 7.68 &lt;strong&gt;million&lt;/strong&gt; GBs of data-writing before it&amp;nbsp;fails!&lt;/p&gt;
&lt;p&gt;This was a big concern for early SSDs, which had program-erase cycles in the low thousands. Today, with technology improving the program-erase cycle lifespan of SSDs, most users would not come close to reaching the end-of-life of an &lt;span class="caps"&gt;SSD&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Solid-state disks are much faster than hard disks because they have no moving parts, so no time is wasted waiting for parts to get into the right position. However, they are more expensive than hard disk&amp;nbsp;drives.&lt;/p&gt;
&lt;p&gt;I managed to write this issue without once mentioning write amplification or &lt;span class="caps"&gt;NAND&lt;/span&gt;, and I consider that a significant personal&amp;nbsp;achievement.&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 120: Drivers, the glue between hardware and&amp;nbsp;firmware&lt;/p&gt;
&lt;p&gt;So &amp;#8230; hard disk drives and solid state disks work pretty differently under the hood, yet when you plug them into a computer they just &amp;#8230; work? How does that&amp;nbsp;happen?&lt;/p&gt;
&lt;p&gt;For that matter, how do devices just work when we plug them into a&amp;nbsp;computer?&lt;/p&gt;
&lt;p&gt;This next week, when I finally talk about &amp;#8230;&amp;nbsp;drivers!&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;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;The name has to do with the fact that its working principles are based on &lt;a href="https://en.wikipedia.org/wiki/Solid-state_physics"&gt;solid state physics&lt;/a&gt;, and not on the solidity of the disk itself.&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;Feels almost instantaneous to humans &amp;#8230; but this still takes a few microseconds, which is considered slow for a computer!&amp;#160;&lt;a class="footnote-backref" href="#fnref:2" title="Jump back to footnote 2 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><category term="Season 10"></category></entry><entry><title>Issue 118: When I run two file-copy processes at the same time, why are they much slower?</title><link href="https://ngjunsiang.github.io/laymansguide/issue118.html" rel="alternate"></link><published>2021-05-01T08:00:00+08:00</published><updated>2021-05-01T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2021-05-01:/laymansguide/issue118.html</id><summary type="html">&lt;p&gt;A hard disk consists of a read arm, and a set of magnetic platters which store data. To read or write data, the read arm must move to the appropriate track of the rotating platter, and detect the magnetic field (for reading), or attempt to magnetise the domains on the platter (for writing). Operations that require the read arm to access different parts of the magnetic platters intermittently result in slower read&amp;nbsp;speeds.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&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;It’s kind of funny the moment you realise how much of what an operating system (&lt;span class="caps"&gt;OS&lt;/span&gt;) does is try to mitigate the slowness of hard disks. But why are they so &lt;em&gt;slow&lt;/em&gt;? There’s an actual explanation for that, and along the way it will help us understand a few things about why OSes sometimes behave&amp;nbsp;funny.&lt;/p&gt;
&lt;h2&gt;What is a hard&amp;nbsp;disk?&lt;/h2&gt;
&lt;p&gt;A hard disk is a magnetic platter that stores data. This platter contains trillions of magnetic atoms; yep, they’re atom-sized magnets! These atoms are grouped into clusters called magnetic domains; they are so tiny that 500 of these placed in a straight line would stretch the diameter of a human hair! These domains can align themselves in one of two different ways: let’s call them “up” and “down”. Each bit (as in, 8 bits = 1 byte) is stored as the alignment of a magnetic domain: up represents 1, and down represents&amp;nbsp;0.&lt;/p&gt;
&lt;p&gt;To read data, all you need to do is move a tiny electromagnet over each domain, and use it to see which way the domain is aligned. This can be done by measuring the current flowing through the electromagnet, a detailed explanation of which is beyond the scope of this newsletter (perhaps in a future newsletter titled “Layman’s Guide to Physics” or&amp;nbsp;something).&lt;/p&gt;
&lt;p&gt;To write data, you pass a current through the electromagnet to magnetise the domain below it whichever way you want; just spin the platter and keep changing the current to write a series of 1s or&amp;nbsp;0s.&lt;/p&gt;
&lt;p&gt;Put 3-5 platters together, attach the electromagnet to a moving arm (called the read arm), control the whole thing with some microchips, and you have a hard&amp;nbsp;disk.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Open hard disk" src="https://ngjunsiang.github.io/laymansguide/issue118_01.gif" /&gt;&lt;br /&gt;
&lt;em&gt;A picture of an opened hard disk, showing the read arms and magnetic&amp;nbsp;platters&lt;/em&gt;    &lt;/p&gt;
&lt;h2&gt;Characteristics of a hard&amp;nbsp;disk&lt;/h2&gt;
&lt;p&gt;A hard disk spins at a constant speed, because it is much more complicated to figure out how to read/write stuff when the speed can vary. The larger hard disks, which go into desktops and use 3.5-inch platters, spin at 7200rpm, while the smaller hard disks, which go into laptops and use 2.5-inch platters, spin at&amp;nbsp;5400rpm.&lt;/p&gt;
&lt;p&gt;Data stored near the circumference of a magnetic platter is faster to read than data stored near its centre. For this reason, OSes that are installed on hard disks usually attempt to partition the storage space so that the operating system is stored on domains closer to the&amp;nbsp;circumference.&lt;/p&gt;
&lt;p&gt;The read arm moves really close to the platters during disk operation! The gap between them (called the head gap or flying height) is half the thickness of a human hair. This is why you do not want to drop hard disks while they are in operation; the slightest movement of the read arm towards the magnetic platter causes it to gouge the platter surface and damage it permanently: this is called a head&amp;nbsp;crash.&lt;/p&gt;
&lt;h2&gt;Read and write&amp;nbsp;operations&lt;/h2&gt;
&lt;p&gt;The hard disk is ultimately a mechanical device; each operation involves moving&amp;nbsp;parts.&lt;/p&gt;
&lt;p&gt;Reading from or writing to a domain&amp;nbsp;involves:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Spinning up the platter (if it isn’t already&amp;nbsp;spinning)&lt;/li&gt;
&lt;li&gt;Moving the read arm to the correct&amp;nbsp;position&lt;/li&gt;
&lt;li&gt;Measuring or inducing a&amp;nbsp;current&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This means that each time the hard disk needs to access data from a different region of the disk, there is significant lag time (~5ms; see &lt;a href="https://ngjunsiang.github.io/laymansguide/issue057.html"&gt;Issue 57&lt;/a&gt;)). This is the time needed for all those movement described above. It is thus advantageous to try to put all the data you need in contiguous domains&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;, to minimise read arm&amp;nbsp;movement.&lt;/p&gt;
&lt;p&gt;So when an &lt;span class="caps"&gt;OS&lt;/span&gt; tries to perform two data operations at the same time (instead of sequentially), the read arm has to move a lot more to access data from different regions. And this is why, if you have multiple data operations to perform on a hard disk, you should try to do them sequentially instead of&amp;nbsp;simultaneously!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; A hard disk consists of a read arm, and a set of magnetic platters which store data. To read or write data, the read arm must move to the appropriate track of the rotating platter, and detect the magnetic field (for reading), or attempt to magnetise the domains on the platter (for writing). Operations that require the read arm to access different parts of the magnetic platters intermittently result in slower read&amp;nbsp;speeds.&lt;/p&gt;
&lt;p&gt;This was something that took me a while to figure out; first, to notice that it was actually happening, and second, to read up enough about hard drives and take some (nonworking) ones apart to understand. And now I can explain it to you&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; S10] Issue 119: Solid-state disks, an upgrade from hard&amp;nbsp;disks&lt;/p&gt;
&lt;p&gt;Next, we look at the technology that has been steadily replacing hard disks as system disks in most desktops and laptops. These have managed to eliminate the latency due to moving parts, and enable much higher read and write&amp;nbsp;speeds.&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;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;This process is what millennials might remember as &lt;strong&gt;defragmentation&lt;/strong&gt;, or defragging.&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 10"></category></entry></feed>