773 points · by JoelMcCracken · 3y ago · 141 comments
I could not begin to grasp how they could deal with running programs, access control, or any of these things that once seemed so foreign and mysterious to me.
And realising that it’s actually just software, that there’s no black magic to it, just lower-level APIs, less pre-built batteries-included stuff to rely on, and probably a whole lot of more complexity, that was… both mind blowing, exciting, and kind of a let down.
And it has enabled me to have more realistic expectations from these tools.
It however doesn’t take away any of the brilliance and effort that went into the these things, or lessen the credit due to those behind them. I can only begin to imagine the complexity involved in a full-fledged modern OS.
> That is, the OS takes a physical resource (such as the processor, or memory, or a disk) and transforms it into a more general, powerful, and easy-to-use virtual form of itself. Thus, we sometimes refer to the operating system as a virtual machine.
Though I suppose in a sense, even subatomic particles are abstractions over quarks. It’s just that those are no longer abstractions we control.
why i kind of like old IBM PC environment. x86 + a few bios calls, dont even need DOS after you load game.exe
I’m of the age where my first computing experiences were on green screens, PET computers, networked VAX machines at the colleges my parents taught at and so on.
I was aware of what assembly was back then, and the idea that the game or basic business program I was using was just a sequence of MOVE ADD eax and so on. I just couldn’t quite get how you could be smart enough to use that to something useful.
And everything we see today is basically just a bunch of moves and adds and pokes a layer or three below the surface.
"Wait, code is just text?"
"Always has been"
I still have to remind myself of this sometimes when I think "woah, how does this work?" and then I try to step through how it might be built.
It’s interesting - like a mystery revealed, but also provides the why - why things are the way they are.
I was looking into accounting the other day, and you can go back to the first document that mentioned credit and debit and introduced modern accounting. There are so many topics like this that seem confusing and arbitrary but it all began extremely simply and pragmatically. Music theory is another example of a fun topic to study historically. And programming languages and operating systems.
It’s important to use two learning paths though: historical and modern scientific. Historical usually explains terminology and legacy aspects of such topics, but then topics can also be explained by using modern technology to experiment and observe.
Think about unix - it was primarily designed for very low power low memory environments. And databases too. You can learn a lot poking at an existing system, but when you watch the early content on it, you see the why.
Who's that?
When I was in school, a lot of teachers did a little tidbit of history at the start of topics, but I never latched onto it and found it boring. It was only after my studies that I started to really love going back to the origin.
Most of math starts to make sense once you know the history behind the concepts.
Similar with Euclid's Elements vs the modern "Cartesian" view of geometry.
The window server is "lightweight" in that it does no screen drawing itself. It is, to use Apple's term, "drawing model agnostic."
WindowServer is such a behemoth nowadays, it took me ages to reverse engineer how to make rcmd (https://lowtechguys.com/rcmd) control Stage Manager.It’s interesting to see it described as lightweight. I guess every lightweight solution becomes heavy and complex with enough usage.
["rcmd does not collect any personal information."]
That's the complete page. Great policy!
I tried to do the same with my other more complex app as well: https://lunar.fyi/privacy
But not your software, it seems!
Your privacy policy has made me think it would be a good idea to try and probably buy your app if it works for me.
Thanks for being one of the good ones!
Once I started using it I was wondering how I worked without it
Figuring out which CG calls WindowServer is making?
Wouldn't these calls fail unless you have special entitlements?
I want to add hotkeys for creating Stages with the needed windows, because as it is right now, mousing around to move windows is too slow for me.
I'm looking inside SkyLight.framework and WindowManagement.framework to find the right sequence of SLS* or CGS* functions that does what I need.
I don't get it how they messed this up.
The new docs have a page per code symbol, and much more focused single-page topic articles, rather than 20-page programming guides. Docs seem to be structured to answer a question right when you have a problem, but then they don't offer a good way to study in depth before you begin.
The other day a younger teammate asked a group about some API documentation that said the results are undefined if you call this wrong, and had we ever heard of such a thing. And yes, of course, using framework code in unintended ways is always a garbage in, garbage out affair. This made me realize we have come a very long way in eradicating boilerplate and ceremony in code.
There used to be so many things you just had to use the way the docs explained, or else. Doing the boilerplate correctly was a primary focus of code review. Today we have ARC, we don't call alloc separately from init, we never handle KVO without the compiler's help, and we have no IBOutlets to forget to bind. To begin writing for iPhone 15 years ago, I had to study for a week or so with the programming guides, one for the language and another for the platform. Today you can do a one hour tutorial.
So, if you can stumble your way through building an app by typing the period key and seeing what methods are available, and the whole platform SDK exhibits Clarity at the Point of Use, would a newcomer even use the programming guides if they weren't down in the archive?
Yes, of course they would.
If you don't learn multiple different paradigms for acquiring knowledge, you'll be automated by ChatGPT.
Natural language query searches, category design & grouping via visual hierachies, are merely two forms of knowledge acquisition.
They all have intimate insights into macos internals from reverse engineering it.
The presentation is horrible and I feel like I am wading through syrup trying to glean the odd morsel of info.
Their interview of LLVM co-founder/Swift architect Chris Lattner is def a good listen for historical background: https://atp.fm/205-chris-lattner-interview-transcript
https://hypercritical.fireside.fm/
If you’re interested but don’t know where to start, “The Bridges of Siracusa County” is a classic.
Siracusa's pieces were all meat, no filler. The modern ones are trivial glances at the cosmetics: all filler, no meat.
They are an updated and much expanded version of "Mac OS X and iOS Internals: To the Apple′s Core" by the same author.
Which in turn was an updated version of "MAC OS X Internals: A Systems Approach" by Amit Singh.
Though I see this author has also given up work on this project. And they are extremely expensive in Europe. At least Amit Singh's I could just grab on local Amazon. Levin's aren't available here.
[0] https://arstechnica.com/gadgets/2001/10/macosx-10-1/12/
[1] https://arstechnica.com/gadgets/2003/04/finder/#prev-article...
But I still maintain that adding the NeXT browser view to the OS 9 Finder would be the perfect experience. The OS X Finder went down this awful .DS_Store-strewn half-assed path and it’s still just the weirdest set of choices imaginable.
The "it's in the directory listing in terminal" or "spotlight will find it" or "what is a file" don't really compare, even if they can be made usable.
- XPC/Mach is a pretty reasonable IPC system that avoids the huge complexity of DCOM, whilst being more widely adopted throughout the platform than DBUS.
- Bundles are frustratingly ad-hoc in terms of detection and layout but the basic concept does work, and is better than the (rough, not really) equivalents on Windows and Linux.
- Launch Services does a pretty good job these days of letting apps be purely declarative whilst still keeping track of all the integration points things (in the past it's been a bit rough).
- APFS is a very modern FS and the migration of the Apple ecosystem to it was so well executed it was barely even noticed. I can't think of any other platform that has managed to do a migration from one FS to another so smoothly.
- Ditto for CPU architecture migrations. Apple's skill at these has become rather legendary now. I remember a time when the computer industry assumed such transitions were simply impossible, Apple did it twice!
- The code signing infrastructure is rather complex but well thought out and flexible, even though Apple don't use all that flexibility in practice. They've chipped away at it over the years and by now it delivers concrete and real benefits to end users. In particular it enables apps to be kept somewhat separated even when they aren't sandboxed e.g. on Ventura apps can't tamper with each other unless you specifically give them that permission, and this works without any notion of admin/root escalation or installation, and that's true even if apps aren't opted in to the app sandbox.
- The way Apple live the UNIX spirit by having lots of little CLI tools along with man pages for those tools etc is pretty nice.
- The sheer quantity of APIs and frameworks that solve modern high level problems is well ahead of any other desktop platform by miles (e.g. the ML frameworks, data syncing).
- The way Apple have managed to slowly migrate code out of the kernel is well executed IMO. Likewise for SIP and their whole security/immutable OS posture, something the Linux world is still just experimenting with and Windows isn't even trying.
- Their integration API for cloud storage is solidly designed, albeit it's a pity they don't also offer a lower level FUSE-like API for experimental use cases.
There are problems too of course. It's very weak that the OS has no way to keep apps up to date except via the store, which then introduces tons of other problems. Sparkle does a great job of patching up this gap, but it should really be a core OS service in this day and age. And the lack of any high level GCd/managed language for their platform continues to be a major weakness. You can have smooth UI and 60fps whilst still offering GC as Android has now proven, and of course there are large classes of apps where developer productivity matters more anyway. Microsoft always recognized that, even the Linux community understood this hence all the bindings into Python.
- Code signing. It's incredibly frustrating as a developer to try and codesign an application to pass gatekeeper, requiring multiple steps with very little information as to what's _actually_ going on or going wrong in the middle of it, including uploading your entire bundle to Apple and waiting an arbitrary amount of time for them to notarize it.
> It's very weak that the OS has no way to keep apps up to date except via the store, which then introduces tons of other problems. Sparkle does a great job of patching up this gap, but it should really be a core OS service in this day and age.
App Store _is_ the solution and a core OS service. You may not like the limitations that implies, but it is the OS level solution for keeping apps up to date.
> And the lack of any high level GCd/managed language for their platform continues to be a major weakness.
I think swift fits this gap nicely, no? It's not technically GC'ed, but it is refcounted, which for end user case achieves the goal of "ignore memory mangement for small tasks" I like this blog post [0] which shows a desktop app in 11 lines of code.
[0[ https://www.amimetic.co.uk/blog/swiftui-for-small-internal-d...
As for the compile times mentioned by the sibling comment, they're pretty tiny for small utility things, especially incremental builds. On more recent hardware (M1, Ryzen 5000, etc) I find they're reasonable even for moderately sized projects… on M1 Pro a complex iOS app with somewhere in the ballpark of 30 different screens can be clean-built in under a minute with incremental builds usually under 3s which seems plenty reasonable to me.
Cryptography DX is always terrible on every platform, I don't know why, it seems to be an unwritten rule that crypto tools must have as many sharp edges as possible. But as far as these things go, Apple's infrastructure actually is effective and flexible. Notarization got a lot faster lately and is certainly way better for both devs and end users than client side virus scanners.
Swift is a good upgrade, but not exactly a high level managed language. Most of those languages have very fast or non-existent compile times as well as GC, they tend to be simple-ish, perhaps they have optional types. The Swift DX is quite different to a C# or a Java for example.
Gotcha. I disagree, but I think that's ok.
> Cryptography DX is always terrible on every platform, I don't know why,
Let's encrypt is a pretty good example of how simple it can be. The experience of codesigning + notarisation as a developer is poor. If you want to use the GUI and are working from xcode templates, it's fine, but apart from that, you're into glueing together forum posts running binaries and tools with no logs that report success with arbitrary delays that work on your local device but not on other devices.
> Swift is a good upgrade, but not exactly a high level managed language. Most of those languages have very fast or non-existent compile times as well as GC, they tend to be simple-ish, perhaps they have optional types. The Swift DX is quite different to a C# or a Java for example.
Swift has ARC, fast compile times, and a _very_ high level interface to the underlying API's. I think it's very comparable to C# on windows for many, many things.
https://msrndcdn360.blob.core.windows.net/bluehat/bluehatil/... (Pages 20-22).
Oh dear.
Thrice, in fact! 68000 -> PowerPC, PowerPC -> Intel, Intel -> ARM/Apple Silicon
I don't really understand WinDev in regards to COM.
In abstract, it is a very good OOP ABI, and cross language interop.
In practice, one would expect that given how much they have doubled down on COM for the last 25 years, they would have come up with a development experience that isn't the worse from all IPC systems invent so far in regards to development experience.
.NET requires actually knowing COM at C and C++ level, and as of .NET Core, also write IDL files manually, as they removed type library support from .NET toolchain.
On C++ side, there have been endless reboots, none of them really productive, with exception of C++/CX, killed due politics.
WinDev really loves their bubble.
Regarding GC on OS, many others have tried as well. The problem is having a company willing to throw enough money at the problem and steer developers to adopt the platform no matter what.
Which is actually quite surprising for Android, given Google's track record in killing products before they can establish themselves.
All in all, there is still a lot of NeXTSTEP in macOS.
/usr/bin/softwareupdate [1]
That is a very interesting if not a prodigiously strained hand-wave of a solution to GGP's complaint, "that the OS has no way to keep apps up to date," as Safari, Mail, Contacts, Calendar, Maps, Music, Photos, Messages, FaceTime, Notes, Preview, TextEdit, KeyNote, Pages, Numbers, GarageBand, Quicktime Player, Activity Monitor, Terminal, Console, Disk Utility, and hundreds of other bundled applications, and including the tens of thousands of BSD userland utilities, as well as the AppStore itself, are packages managed by the package manager called Software Update, a Preference Panel in System Preferences, which is the GUI front end for /usr/bin/softwareupdate.
There is no package manager that exists on any platform that manages every application there is, but between softwareupdate, AppStore, and the only professional and stable third party package manager for macOS that exists, MacPorts —these three package managers can be employed to keep well over 2 million distinct installed packages up to date.
Three times actually. Motorola -> PowerPC. PowerPC -> Intel. Intel -> Apple Silicon.
Edit: Oops this was already mentioned elsewhere in this long thread sorry.
Now, bonus time: Let's do something like that for SwiftUI.
<gets coat/>
Well worth it.
It's nice to see someone else has taken on the task of bringing that kind of insight into the modern age. Because Apple certainly won't.
inb4 it's just someone else's computer -- trust me I know
But it works if you just treat them as shared libraied - just use -F on the compiler anlink rather than -l and the headers are not needed in /usr/include etc.
The are also versioned so easy for two apps to have different versions of the Framework.