Man With Dog

Tue, 05 Mar 2024

Rethinking Computering

With the ongoing iPad-ification of Apple computer systems, it’s time to rethink how to properly deploy modern compute devices.

TL;DR: Forget the internal SSD. Everything that is yours should be on a fast external bus.

Computering is the term I use for all the various things we now do with computers. We don’t just compute, we watch, we listen, we play, we chat—all of these things comprise computering.

I recently lost all my data on my Apple M1 MacBook Air (see The Day My MacBook Died). I have been operating under old assumptions about what a computer system is. That is, everything in a single box with the dearest bits backed up externally. The increasing reliability of hard drives and now SSDs have provided a false sense of complacency thus greatly reducing any urgency to perform this vital task on a regular basis.

Sure, I could have completely avoided my drama had I simply backed things up on a weekly, or even monthly, basis. But I didn’t. I was, as we all are in modern life, pre-occupied.

Temptation of St. Anthony

This engraving from the 15th century captures our modern life perfectly. Each of the gremlins tugging, sniping, pokingm, grabbing at St. Anthony represent all the distractions from our obligations, habits, needs, and desires we are bombarded with daily. Not to mention all of the external noise from media and advertisements.

Put your phone away: one gremlin gone. Leave the phablet/tablet at home: another gremlin gone. Turn off the TV: another gremlin gone. Stay off of social media: yet another gone. Don’t buy all that stuff they keep telling you to buy: several gremlins gone. Find quiet time for yourself and spend focused time with loved ones: even more gremlins gone. This is our modern life. All of these distractions are consuming us in unpleasant, unwanted ways.

Now that I have recovered much, but not all of my data, I’ve been reflecting on my assumptions about how I use computers and whether my thinking is outdated—it is. So now is the time not only to rethink my usage patterns, specifically how to preserve my data, but also to rethink how the computers I use should be configured.

Where we were

Computers developed from the model of a fast internal bus which connected the CPU and memory to all other I/O, storage, peripherals, and network. Moving data to and fro I/O devices, storage, peripherals, and networks were much slower because of the inherent limitations of those devices. It made sense, therefore to keep as much as possible internally connected to the system bus. Additionally, the overall system was made up of many individual components and interfaces to each of the subsystems.

Then, everything got faster, not just CPUs, memory, and the internal bus. Slow hard disks were replaced with fast SSDs. Networks got a lot faster. Connections to external devices got a LOT faster.

Where we are

A parallel development was the reduction of sub-components both for cost savings and for speed. This has culminated in the system-on-a-chip architecture where the CPU, memory, i/o subsystems and their controllers are etched into a single chip instead of many small, special-purpose chips. A single chip meant a lot less soldering, lower cost, and much higher performance. The only downside is if any part of the chip failed, the chip was basically useless.

One example of this architecture is the Raspberry Pi. For under $100, you can get a complete system board that has more compute power than computers of just 10 years ago. Hook up your own i/o devices and your favorite storage device and you have a fully usable system.

The evolution of Apple computer systems went from traditional lines of desktop and laptop systems to much smaller devices: iPods, iPhones, and iPads. These are all essentially systems-on-a-chip with no moving parts and few, if any, replaceable parts. In recent years, this approach has appeared in almost all of Apple’s computer systems; what I call the iPad-ification of Apple computers. Everything is on a single board or a single chip. No moving parts; with very few exceptions, no fans. Nothing to upgrade—the configuration is fixed. Very little to repair or replace. Most people never needed to change their initial configuration which made this approach viable.

This is attractive because of lower cost, higher performance, less energy consumption, low heat, and slimness/compactness of these designs. This is the computing landscape today. There is no going back to bulky, noisy, hot computers regardless how configurable, or repairable those systems would be.

Where we want to go

In this modern scenario where the SSD, or backing store, is irreplaceable, new thinking about the backing store and longevity of your data is in order. When any component of the single-board system fails, all data is forfeit.

The traditional solution is to have a back up process that is performed on a regular schedule. The backed up data may be to a server on the network locally or remotely (cloud) or to an external storage device connected directly to the system to be backed up.

The downsides of this are its regularity and its accessibility. There will always be a gap between the last backup and whenever the storage system fails. The system to be backed up must be accessible to the remote store. That means always on. Or it means an external device must be manually attached and then the process initiated.

Sure, there are other solutions, such as Apple’s Time Machine. But again, the backup device must be manually attached.

An alternate way to think about modern, irreplaceable internal storage is to think about the internal storage differently.

My new thinking

The approach I will adopt is to think of the internal SSD as a kind of level-X cache. Apps get installed there and launched from there as they currently do.

  • The system still uses it for page swapping (page swapping should ideally use much more resilient circuitry than the SSD).

  • Bootable storage backups done only occasionally, since apps are not updated frequently.

  • No data stored there, or if so, is only moved there temporarily and moved off as soon as possible.

  • All personal data is stored on a fast external SSD enclosure connnected via a fast USB-C (Thunderbolt 3 or 4) connection.

  • External data storage backup up on a regular, frequent schedule, depending upon activity.

My new dream machine

You can already get really fast NVMe SSDs enclosed in really fast controllers. These are ideal for Thunderbolt 3 and Thunderbolt 4 connects—present on all Macs since 2020. See How to Choose a Fast External SSD for Your Mac.

Now we need a MacBook to properly fit into this approach. Such a system would have

  • maximum possible RAM. 64GB to 128GB or more.

  • minimum possible SSD, allowing for apps and working space. 256GB would do for most users, more would be needed for photographers, graphics artists, etc.

  • Whatever CPU, standard, Pro, or Max, you may need for the tasks to be performed. In reality, the CPU doesn’t really matter except for the most CPU-intensive workloads; most people would do fine with standard or pro versions.

Pair such a system with external drive and we are nearly there.

If the system has 64GB or more RAM, I would really like to be able to configure macOS to use a part of that memory as a RAM-disk for system paging. RAM is designed to be re-written; SSDs not so much. In this way, the RAM can take the abuse of paging rather than beat up the SSD.

I looked today in the Apple Store; the closest thing I found to this configuration is a MacBook Pro 14” with an M3 Pro CPU, 128GB RAM, and 512GB SSD for about $4,500. A bit pricey. But that, I think, would be a beastie that would have a very long useful life.

I would rather Apple produce a MacBook Air M3 with 128GB RAM and 512GB SSD with a way to user-configure system swap space, but I doubt any of that will ever happen. Not only price, but cooling might be an issue.

<sigh>

One can dream …

posted at: 15:44 | path: /Computering | permanent link to this entry

Mon, 04 Mar 2024

The Day My MacBook Died!

Gee, the Apple Silicon MacBooks are spiffy! Well, except when they aren’t. This is a tale of such woe.

TL;DR - Laptops should have removable/replaceable storage drives; Apple MacBooks don’t. Either avoid Apple laptops or devise your own external storage system and daily backup plan.

I am a programmer; well, a system’s analyst actually but nobody pays for that anymore. And I love technology. I particularly enjoy working on Apple Computers because they are so graphically rich.

It has been my longstanding opinion that I consider Apple Computers to be the best designed and engineered personal computer systems available. You want the false-economy of cheap, go elsewhere. I have been using and programming Mac computers since the days of Mac OS 7.

Sadly, I no longer hold so strongly to that opinion. I could recount many hardware fiascos Apple has delivered (butterfly keyboard is just recent one); but I won’t. My current daily driver is a sleek, fast MacBook Air with Apple Silicon. It far outperforms my last favorite MacBook: a quad-core 2012 15” MacBook Pro Retina. That was replaced by a little beastie MacBook Air with a 2GHz Core i7 & 16 GB RAM. Then I got this MacBook Air M1 with 16GB RAM and 512GB storage (henceforth, M1 MBA). Almost everything about it seemed like an enormous step forward: the CPU, the screen, the system on a chip, the fast memory subsystem, and the fast system bus. All this except for one thing I didn’t pay enough attention to: the storage system is soldered to the logic board. I truly enjoy sitting down to work with it.

…Until this incident.

I don’t mind that memory is soldered onto the logic board; memory is temporary. I don’t mind that other subsystems are built into the system-on-a-chip Apple Silicon. But electronic components inevitably fail. Sometimes sooner, sometimes later. I/O subsystems are particularly vulnerable to dirty, noisy power. Even storage systems fail. These two things—overall logic & i/o subsystems taken together, and storage subsystems—should always be separate. Sure, the best way to improve the overall performance of a system is to improve access to the slowest part—the storage subsystem. Apple did this by soldering the storage subsystem onto the logic board. But they did it at the cost of recoverability and long-term reliability of my data. And, well, maybe, just maybe, they wanted to sell more iCloud storage. Nah, Apple with its 30% margin and trillions of dollars would not do that—no way.

What is worse, they provide no on-board access to the SSD. It is completely walled in there.

Regardless of their motivations, I now believe Apple has made a huge faux pas in tying the logic board & subsystems together with the storage subsystem. This is no longer just a belief; this is now my experience.

An analogy

The analogy for this situation is that of, say, a bread truck making deliveries. On its route, the bread truck gets a flat tire.

In the past, you call for service. They come to remove the tire, patch or replace it, put it back on. You go your merry way. Simple.

But now, they come and take your truck away giving you a new, empty one. You have a new truck but all your bread is gone (still in the old truck). You can’t have it back; you have to replace it all yourself.

Why this story?

I have two reasons for posting this story.

  • The first is to relay to the Apple Technician the symptoms of what is wrong and what I have already tried to recover from it. In a word: no joy. My hope is that Apple provides some magic tools to their technicians for this kind of incident.

  • The second reason is for my publisher who might think I’m giving them the my dog peed on my homework excuse. It certainly sounds like it: “I missed my promised deadline because my computer died.” I’m not trying to dodge a deadline. This really happened when I was in the middle of my work on Chapter 5. Once I publish this, I’m get back to work using a different computer, recovering as much as I can.

Prologue

Original, working configuration

My original working configuration comprised my M1 MBA on an aluminum stand connected to a
12.9” iPad Pro 4 also on an aluminum stand via USB-C. It works great as a 2nd monitor.

Once you have experienced working with a 2nd monitor, it’s very difficult to work without a 2nd monitor. For casual stuff, one monitor is just fine.

All this with functioning USB-C cables, using an Apple MBA power supply.

The incident

On Sunday afternoon, I had been working normally editing chapter 5 of the book I’m contracted to write in exactly the configuration shown. As is my custom, whenever I stop, I upload the most recent edits to their server, which I did. We then went out for a couple of hours. The iPad was taken out of SideCar and the laptop was put in sleep mode but otherwise left as-is.

Upon returning, I found that the system would not wake up from sleep and was totally unresponsive to inputs (keyboard and trackpad). There was no inclement weather or lightning storms. There was no intermittent power outages as all other device clock in the house were fine.

Day 0: Sunday evening—denial & anger

As panic began to enter my consciousness, I tried powering off (hold power button for about 15 seconds) and powering back on. Nothing. Blank screen. No cursor. No keyboard. It appeared dead.

Well, not exactly nothing. After I calmed down a bit, having recycled power several times, I realized that I was getting the startup bong.

At this point, I started doing some research. I attempted to go into Recovery Mode but nothing appeared on the screen. The system still seemed to be dead. After about an hour of this I was rather exhausted from the trauma, so I powered it off, disconnected the iPad and decided to sleep on it.

In the meantime, I verified that I still have AppleCare coverage on it. With that knowledge I made an appointment at the nearest Apple Technical Service Center, about an hour away. I also wanted a day or two to see if I could recover my data before possibly losing everything (250GB+ of pdfs, notes, source code, web sites, etc.) on it.

Knowing that the M1 MBA had (1) no way of removing storage subsystem, and (2) no way to access the storage subsystem directly from logic board, my sleep was fairly fitful. I awoke several times wondering how am I going to recover all of that data.

Okay, I admit it: foolish me, I don’t have a recent backup. I do have an old partial backup of my documents folder but that was more than several months ago.

Lesson 1: Don’t panic. Stop. Assess. Do some research. Even walk away for a bit. Do not return to the situation until you are calm.

Lesson 2: have a backup strategy and follow it… regularly. Even daily if your work is important. You likely won’t get fanatical about it until you actually lose a day or two of work. In this case, I lost all of my notes, many project files, and all email—about 6 months worth.

Day 1: Monday (all day)—bargaining

I woke up with a good deal of hope. So this day—all day—I spent going through various possible scenarios and workarounds.

The monitor on the laptop was dead, as was the keyboard and trackpad. A workaround was in order. The first hurdle to overcome was how to get a 2nd monitor attached and appear as the main monitor.

It's dead, Jim

With a second monitor attached via Apple’s Media dongle, I could tell when the logon screen came up because the wallpaper appeared on the 2nd monitor. I could then close the lid of the laptop; the 2nd monitor then became the primary monitor. Yay!

Wait! 2nd monitor works

Oh snap, macOS is so effing secure that you cannot use attached accessories to log on until after you’ve logged on to unlock those acessories. What genius at Apple thought of that one?

I also tried various methods to activate BlueTooth from the logon screen but nothing worked here either. No USB keyboard or mouse, no BlueTooth keyboard or mouse. The hardware must have recognized the internal keyboard and trackpad but couldn’t do anything with them. Otherwise, I would have expected some kind of “no keyboard found” message at boot up.

By this point, I was accustomed to shutting down the OS (holding the power button for about 15 seconds) and then entering Recovery Mode (hit power button again and hold for at least 25 seconds). When the external monitor status light went active, I knew that the Recovery boot process was complete and could then close the lid to access Recovery Mode options.

Catch-22

It is interesting to note that a vintage USB keyboard and USB mouse worked but the USB flash drive with a bootable installer was not recognized. Musta’ been that same genius at work again.

I had found this Apple Support document describing thoroughly Recovery Mode for Apple Silicon MacBooks. The document seemed fairly complete and rather straightforward. So I began working through this document methodically (I had been thrashing about a bit the night before).

The first step was to try to reboot into Safe Mode from Recovery Mode. This appeared to work but returned to the logon screen … and we’re back in our Catch-22 situation: can’t use accessories until we log on, can’t log on until we can use accessories. There must be some way to circumvent this but I have not found it. Send that genius to jail, do not pass go, do not collect $200. <aarrgghh>

I had no Time Machine backup so that was not an option.

Oh, wait! There’s a disk sharing option. Yay! On Intel Macs, that was called Target Disk mode. So we configure our M1 MBA for disk sharing

Shared disk mode?

We then introduce our spiffy 2020 Intel MacBook Air by hooking up the necessary USB-C cable through the Apple Media dongle. Then we open Finder and check out our network.

Enter 2nd MBA (2019 Intel)

So far, so good.

No sharing joy

But… nothing. Either this feature doesn’t work or else the USB-C subsystem is hosed in some particular way. Why am I so snarky about a feature not working? Because I made a bootable installer drive for Ventura and tested it on my Intel MBA. It failed because it could not find my Wi-Fi network. Huh?

  • Aside: I have noticed that a lot of stuff in the installation process does not work as expected or is just cheesy. Many times, there is a “continue” button that does nothing when you click it; you have to hit <return>. And then the installer on my Intel MBA couldn’t find Wi-Fi. Ooblek. (see next Aside)

I then tried to reinstall macOS Ventura in Recovery Mode with the hope that some driver or kext had been corrupted. If I was careful, or so the instructions stated, I might not have to completely wipe my storage. Okay, but the installer needs an internet connection. Once again, no joy. You can’t recover your OS without a network connection. The Recovery Mode installer either does not have the necessary network drivers loaded or my networking subsystem is also hosed.

Can't reinstall, no network

What!? Apple, you are killing me, because your marketers bleat, “It just works.” … Uh, no, it doesn’t.

  • Aside: I used to work with Microsoft Windows since before Windows 95. Greasy kid stuff. Then I worked at Microsoft in the Windows Server group. I saw from the inside why Windows is the cheesy way it is. When Microsoft did their enormous layoff in 2015, I think Apple hired way too many of those people thinking they were getting skilled workers. This entire process has felt like working with Microsoft Windows 95 again. <yuk>

Finally, before throwing in the towel and waiting to see what the Apple Tech team could do, I decided to verify that my file system was still good.

File system appears OK

Using Terminal in Recovery Mode and fsck -n (no changes), it appears that the storage subsystem is just fine. Now if I could only get to it. Rather, get it all off that system.

Day 2: Depression

I resolved this day to do a clean setup of everything—disconnect all accessories, power off each computer—and perform each step I tried yesterday one last time.

I also decided to take pictures and write this blog entry so as to provide evidence of what I’d done and what I’m seeing.

At this point, nothing worked. The system is not recoverable. The storage system is intact but inaccessible. There is nothing else to do but see what the Apple Technician can do tomorrow.

Day 3: A trip to the Apple Service Site

I went to the closest Apple Service location as directed by Apple (1 hour’s drive away from my home, yuk). The Apple technician was very knowledgeable and tried to be helpful. He put his Apple diagnostic tool on it and, yes, ALL of the I/O subsystems were totally hosed, even though the SSD and my 250+GB of data was fine.

On the way over there, I had been mentally prepared myself to face the fact that I may not get any of my data back. This turned out to be the case.

Enough of the device was hosed that the technician advised sending the thing into Apple for repair. Good bye data.

So off it went to Apple.

Day 5: Acceptance

It was shipped back to the service site within 2 days. Sent Wednesday and back again Friday. Okay, that was impressive … sorta.

They’d have saved me a LOT more time if there was a way to recover my data.

Day n: Moving on—residual anger

So, I’ve spent the weekend reviewing things I can recover and things I’ve lost for good. Many of the .PDFs I’ve downloaded in past 6 months I can recover. Emails fromt hat period are gone, as are project notes from a few rather significant projects I’ve been workin on in my retirement. Some are recoverable; most are not. I’ve also lost several web sites that I was working on locally, including some nice touches to this blog. <grrr>

I’v e signed up for 2TB of iCloud storage but … you can only back up your Desktop and Documents folders to that. WTF Apple—why can’t I choose what folders to back up to iCloud.

Sheesh. I’m going to cobble my own solution together. I’v been meaning to do it. Now it is time.

Epilogue

This incident has left a very bad taste in my mouth, as it were.

Yes, I know computers fail. Yes, I know that a backup strategy is essential. Yes, I know that actually following a backup plan is critical.

Still, this MacBook Air M1 is not even 3 years old. I did not expect it to fail so relatively soon (for Apple computers) and in such an unrecoverable manner.

Still, the failure of one component should not require the replacement of everything.

I am at the point where FreeBSD and/or Linux is looking better and better and where all the gizmos, gadgets and blinky-lights of Apple products, especially w.r.t. macOS, have lost their allure. This is akin to Bill Burr’s experience of losing his religion—gradually, the way curlers let go of the stone.

I am not so certain that I will ever buy another Apple computer again. At least not until the storage system is reliably recoverable/replaceable.

Somehow, I feel something like a jilted lover … I no longer have that same feeling of comfort, trust, and assuredness for my M1 MBA as I did just a week ago. And I don’t know if I’ll ever get it back.

<sigh>

posted at: 19:03 | path: /Computering | permanent link to this entry

Thu, 31 Aug 2023

From C to … where next?

C is still a great language. Here we examine some viable successors.

TL;DR: Rust, Zig, and ObjFW.

The C programming language was the 3rd programming language I’ve learned—-and that was over 4 decades ago. The first two languages I have essentially forgotten and will never use again: BASIC and Pascal. To be honest, after learning C in university I actually forgot it since I was steeped in a quite different language for my day job for nearly a decade.

As luck would have it, I not only relearned C but also learned C++. I mostly learned C++; I learned just enough to get done whatever was needed; it is a beastly language.

In fact like most programmers, I largely used C++ as a better C. Then C got better.

After more than another decade and I no longer needed to write programs in C++, I very happily jettisoned it. I will not re-acquire it, no matter how many gyrations the C++ committee puts it through. With each gyration they attempt to make it a more something language—-more streamlined, more expressive, more I don’t know what. They do improve some things but then introduce other kludges features—-just too much syntactical strychnine. There is now so much baggage that C++ is beginning to approach COBOL or Ada. COBOL evolved where you could do nearly anything and everything with it… in thousands of lines of stultifying code. Ada was designed to be absolutely everything for every possible usage and therefore could do nothing well or fast. Yet, we keep hearing the incessant bleats, “C is too hard! Pointers! Waaa!”

Then I learned Objective-C. It is C with a few simple syntax additions. Suddenly you have objects and methods. It was influenced directly by Smalltalk where the focus is upon messages, and not all of that other OOP gobbledygook in other OOP languages. The Smalltalk environment has great limitions. Objective-C has a different set of limitations; one is you will only find a viable programming environment for it on macOS. Forget about iOS and the other inhabitants of Apple’s walled garden; they want you to use Swift and only Swift. Swift was billed as a systems programming language but nearly 10 years later very little of any core OS is written with it. Oh, and they just introduced macros in Swift. <sigh>

Aside: The C preprocessor is the one facility of C that I truly despise.

Back to C

Well, mostly. FreeBSD, OpenBSD, Linux (on just about every device), Raspberry Pi, and even Arduino still require C skills. So these things are keeping C alive after 50 (!) years.

The thing I like the most about the C Standards Committee is that for each version they follow a charter. The charter has evolved—-grown, not changed—-from the original to meet current needs. You can read the charter for C23 (née c2x). Note that at the time of this writing, most compilers currently only recognize the -std=c2x option and do not yet recognize -std=c23 even though many features of C23 are supported in current versions.

This charter thing is significant because it means C will continue to operate as C and not some new, improved, now with fizzle-gig gyration of C. There are myriad examples of languages that have gone off this cliff; consider the whole ongoing Python 2.x versus 3.x debacle.

C-Next

If you accept the proposition that C++ has failed as the next iteration of C, and I deeply believe it has, what are current the reasonable options?

I will simply state without going into details that I have a strong bias against Apple’s Swift and Microsoft’s C#. Both of these are vendor-driven technologies from vendors who have a proven track record of abandoning developers for the next new shiny thing. And beyond their walled gardens, they promise broader platform scope, but how long has this ever lasted from both of these companies. It’s just not in their charters.

I have come upon three different language trends that I believe are reasonable successors to C. Note: I think JavaScript is viable on the web but not elsewhere, and so we will leave it aside for now.

Let’s consider each of these.

Rust

Rust has been around since 2015. It is not C. It is not necessarily easy to learn.

Yet, in that time, it has garnered a lot of favor from developers as can be seen in the Tiobe Index and Stack Overflow Annual Survey.

Additionally, it is now officially supported in the Linux 6.1 kernel. That is a rather notable vote of confidence for this language. Furthermore, Rust is not only supported as an extension to an OS (Linux) it is also used to write new, experimental OSes. There’s also a tutorial to build a simple one. There are lots of similar systems projects when you start looking for them.

The Rust community is vibrant. It provides a great deal of resources for learning Rust and support for creating apps in Rust.

Zig

In a recent chat with Mark Dalyrmple of CocoaHeads fame and author of Advanced Mac OS X Programming, among other works, he mentioned Zig as a C-like evolution of C. He’s always good for that kind of thing, as in, “Hey, lookee at that thingee over there…”

The syntax looks simple and clean. It has objects. It already runs a bunch of places.

Okay, that’s enough to get me interested.

ObjFW

The main problem with Objective-C today is that it only, or largely only, runs on Apple platforms. Then, this article surfaced via OSNews. ObjFW promises to give new life to Objective-C on more than just Apple platforms.

I am rather excited by this development because I really like Objective-C. I wrote a desktop clock application with it and very much enjoyed the experience. That was about the time Swift was announced.

Sadly, I’ve let that app languish. But now with ObjFW I can see a way to not only escape from the clutches of Apple but also port this app to other non-Apple platforms. Writing/porting my Objective-C app to Linux/Wayland is now a real possibility. I don’t know when that will happen but it is back on my list.

Conclusion

Will these languages replace C? I think not.

Or, at least, not anytime soon. The market is fickle. Programmers are even more fickle. What is the new, shiny today may no longer hold any interest tomorrow. To be clear, these languages will have to get well beyond the new, shiny phase to displace C. That day is coming… but nobody knows when that will be; that day seems to be too far off over the horizon.

C grew out of a practical need for a portable systems programming language. It was originally intended to be used by and for experienced systems programmers. It has grown to be used in many other areas: scientific computing, application development, and the web. However, C still requires a level of awareness and skill to create feature-rich and robust programs. Even with that, C has become a model for many other languages: C++, C#, JavaScript, Objective-C, and now Rust and Zig.

I do think these languages will provide vibrant and stable development environments for picking up where C is weak or falls down. I am looking forward to deeply learning each of these languages to see if, in fact, they will fullfil their promise as the next iteration of C.

Mobile, Alabama
August, 2023

posted at: 12:01 | path: /Computering | permanent link to this entry

powered by blosxom