{"id":105541,"date":"2021-08-10T07:00:00","date_gmt":"2021-08-10T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=105541"},"modified":"2021-08-10T06:52:26","modified_gmt":"2021-08-10T13:52:26","slug":"20210810-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20210810-00\/?p=105541","title":{"rendered":"Why did the old RAID database use a signed 16-bit integer for its record count? Why not unsigned, or a 32-bit integer?"},"content":{"rendered":"<p>Some time ago, I noted that <a href=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/20200317-00\/?p=103566\"> the RAID defect tracking system from the early 1990&#8217;s had a limit of 32767 records<\/a>. I noted that for large projects, like Windows 95, a new database had to be created when the bug count limit was reached. Why did the authors of RAID pick a signed 16-bit integer as their record counter? Why not an unsigned integer, which doubled the range, or a 32-bit integer, which took you to two billion?<\/p>\n<p>You have to remember that all decisions are made in a particular context. At the time, bugs were tracked in a text file that everybody edited.\u00b9 I don&#8217;t know exactly, but let&#8217;s say that there were a few hundred bugs in that file for Windows 1.0. The goal was to solve the problems and limitations of that system:<\/p>\n<ul>\n<li>Concurrent editing resulted in changes being lost.<\/li>\n<li>No reporting. &#8220;How many bugs are assigned to Chris?&#8221;<\/li>\n<li>No auditing. &#8220;Who edited the bug priority?&#8221;<\/li>\n<li>Low capacity.<\/li>\n<\/ul>\n<p>A database with a front-end interface could solve these problems. And as for capacity, well, you&#8217;re going to be running it on an IBM PC with 640KB of memory and an 8086 processor, so a 16-bit integer is a natural size for that architecture. And your target audience is a large project with <i>over a hundred issues<\/i>. A 16-bit integer will handle that with two orders of magnitude to spare!<\/p>\n<p>Why not an <code>unsigned int<\/code>? What a ridiculous question. Windows 1.0 had a few hundred issues in its defect tracker. Reaching 32,767 records was unthinkable. You&#8217;ve already beaten the target by a factor of over 300 with the most natural data type for the language you&#8217;re using. And if you use a back-of-the-envelope calculation that each record is about 1KB in size, your 20MB hard drive won&#8217;t be able to hold more than 20,000 records anyway.<\/p>\n<p>As I noted in the original article, the authors of the RAID bug tracking system had no intention of having their little hack become the <i>de facto<\/i> bug tracking system for the entire company for over a decade. They just wanted a way to track bugs in their day job in a manner that&#8217;s a bit better than a shared text file. If they had known that they were designing the future of Microsoft internal bug tracking, they would have been too scared to write it!<\/p>\n<p>\u00b9 Sure, a text file seems unsophisticated, but it does the job, and it&#8217;s a step up from using <a href=\"http:\/\/marathon.bungie.org\/story\/_files\/Marathon_Scrapbook.pdf\"> the inside of a Domino pizza box top<\/a> (unnumbered page 20).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You have to understand decisions in context, and that includes knowing the problem it was trying to solve.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[2],"class_list":["post-105541","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>You have to understand decisions in context, and that includes knowing the problem it was trying to solve.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/105541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=105541"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/105541\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=105541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=105541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=105541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}