Live data from Hacker News

Apple’s Darwin OS and XNU Kernel Deep Dive

tansanrao.com

171–180 of 186 posts

Re: Apple’s Darwin OS and XNU Kernel Deep Dive

#171

Whenever I see the Darwin kernel brought into the discussion I can't help but wonder how different things could have been if Apple had just forked Linux and ran their OS services on top of that. Especially when I think about how committed they are to Darwin it really paints a poor image in my mind. The loss that open source suffers from that, and the time and money Apple has to dedicate to this with a disproportionat…

It would never have worked. So many of the things that owning xnu has made possible would never have happened on top of Linux. The things you can do when you know each and every customer of the stack, and you all belong to the same business with common objectives and leadership direction just can’t be done in the open-source context.

Re: Apple’s Darwin OS and XNU Kernel Deep Dive

#172
post #166

Earlier quoted context omitted.

They created Swift as replacement for C, C++ and Objective-C, why should they bother with Rust? Even Google on Android and ChromeOS is not exposing Rust to userspace, Java, Kotlin, C, C++, Javascript, Typescript, remain the official userspace languages.

Low-level code is being written in Rust. Of course userspace doesn't require low-level languages (and I don't quite get why C and C++ are exposed to the userspace and Rust is not). Swift is not a replacemente for C and C++, but rather for Objective-C. Do you have any sources for those claims?

Yes, Apple themselves, apparently folks wanting Apple to use Rust don't read Apple's documentation or watch talks done by Apple compiler developers.

> Swift was designed from the outset to be safer than C-based languages, and eliminates entire classes of unsafe code.

-- https://www.swift.org/about/

> Swift is a successor to the C, C++, and Objective-C languages. It includes low-level primitives such as types, flow control, and operators. It also provides object-oriented features such as classes, protocols, and generics.

-- https://developer.apple.com/swift/

"Introducing a Memory-Safe Successor Language in Large C++ Code Bases"

https://www.youtube.com/watch?v=lgivCGdmFrw

"So we feel pretty strongly, obviously at Apple our sucessor language is Swift and I am here to talk about features of Swift, both to try to sell you on to it, but also to talk about the things we think are pretty necessary and the ways in which a programming language can support, you know, clear code, safer and more correct code."

"Like I said before, Apple has always intended for Swift to be a sucessor language for all of our predecessors, from the top to the bottom of our stack, accessible to novices, powerful enough for experts, it is real a tall order.

From https://youtu.be/lgivCGdmFrw?t=1996 to https://youtu.be/lgivCGdmFrw?t=2042

"Swift as C++ Successor in FoundationDB"

https://www.youtube.com/watch?v=ZQc9-seU-5k

Re: Apple’s Darwin OS and XNU Kernel Deep Dive

#173
post #172

Earlier quoted context omitted.

Low-level code is being written in Rust. Of course userspace doesn't require low-level languages (and I don't quite get why C and C++ are exposed to the userspace and Rust is not). Swift is not a replacemente for C and C++, but rather for Objective-C. Do you have any sources for those claims?

Yes, Apple themselves, apparently folks wanting Apple to use Rust don't read Apple's documentation or watch talks done by Apple compiler developers. > Swift was designed from the outset to be safer than C-based languages, and eliminates entire classes of unsafe code. -- https://www.swift.org/about/ > Swift is a successor to the C, C++, and Objective-C languages. It includes low-level primitives such as types, flow co…

Oh, you seem to be right.

But isn't Swift lower-performing than C, C++ or Rust?

Re: Apple’s Darwin OS and XNU Kernel Deep Dive

#174
post #89

Question for the author, who is here in the comments: for clarification, to what extent is the article a deep dive into the OS itself (e.g., reverse engineering) vs. a deep dive into the extant literature on the OS?

I suppose this would depend on the context. As a PhD student, I primarily focus on building an understanding of systems through existing literature, so I would define a deep dive as a sufficiently thorough explanation of the system, its motivation, and it’s history.

In the case of XNU and Darwin, a lot of the sources are also blog posts from reverse engineering efforts by security researchers and jailbreaking communities so it blurs the lines.

Re: Apple’s Darwin OS and XNU Kernel Deep Dive

#175
post #138

Earlier quoted context omitted.

> Even in the default out-of-the-box configuration, Apple isn't exercising editorial control over what apps you can run Perhaps not in the strictest sense, but Apple continues to ramp up the editorial friction for the end user to run un-notarized applications. I feel/felt A level between "disable all security" and what macOS 15 introduces would be appreciated.

More knobs would be nice, yes. Still nothing stops you using a customized file browser, browser, archiver etc that doesn't set the xattrs at all.

Sure, common apps will be notarized and will not run into any warnings/blocks. It's those apps which are not where we need to dive into the Terminal or Settings.app.

Re: Apple’s Darwin OS and XNU Kernel Deep Dive

#176
post #107

Earlier quoted context omitted.

> 32-bit apps, which IBM introduced with OS/2 2.0, were never supported. This was obviously due to the divorce, but also that the Cruiser API wasn't finalized. > Our initial OS/2 API set centers around the evolving 32-bit Cruiser, or OS/2 2.0 API set. (The design of Cruiser APIs is being done in parallel with the NT OS/2 design.) ... > Given the nature of OS/2 design (the joint development agreement), we have had lit…

I’d love to read the document you are quoting - is it publicly available anywhere?

Yep - https://computernewb.com/~lily/files/Documents/NTDesignWorkb...

Re: Apple’s Darwin OS and XNU Kernel Deep Dive

#177
post #69

At the risk of nitpicking, there are a bunch of things that are not quite right. Nonexhaustive list: - Discussion of paging mixes together some concepts as I described in [1]. - Mach port "rights" are not directly related to entitlements. Port rights are port of the original Mach design; entitlements are part of a very different, Apple-specific security system grafted on much later. They are connected in the sense th…

These are very helpful, thank you! A lot of good corrections and suggestions were provided in the comments, I’ll verify and correct the portions in the post for future readers.

Re: Apple’s Darwin OS and XNU Kernel Deep Dive

#178

What impresses me most about technical documentation like this is how it structures knowledge into comprehensible layers. This article manages to explain an extremely complex system by establishing clear relationships between components. I've been experimenting with similar approaches for documentation in open source projects, using knowledge graphs to link concepts and architectural decisions. The biggest challenge…

i suggest you have a look at https://podlite.org/ which encourages you to interweave docs with source code

Re: Apple’s Darwin OS and XNU Kernel Deep Dive

#179
post #172

Earlier quoted context omitted.

Yes, Apple themselves, apparently folks wanting Apple to use Rust don't read Apple's documentation or watch talks done by Apple compiler developers. > Swift was designed from the outset to be safer than C-based languages, and eliminates entire classes of unsafe code. -- https://www.swift.org/about/ > Swift is a successor to the C, C++, and Objective-C languages. It includes low-level primitives such as types, flow co…

Oh, you seem to be right. But isn't Swift lower-performing than C, C++ or Rust?

Not only does Metal use Swift bindings alongside Objective-C, as per John McCall's own words, that is the plan and to fix where that might still not be the case.

Embedded Swift project also started as means to replace Safe C use cases at Apple, like iBoot firmware.

https://support.apple.com/en-jo/guide/security/sec30d8d9ec1/...

https://github.com/swiftlang/swift-evolution/blob/main/visio...

Once upon a time, C compilers were quite lousy versus handwritten 8 and 16 bit Assembly code.

Re: Apple’s Darwin OS and XNU Kernel Deep Dive

#180
post #166

Earlier quoted context omitted.

They created Swift as replacement for C, C++ and Objective-C, why should they bother with Rust? Even Google on Android and ChromeOS is not exposing Rust to userspace, Java, Kotlin, C, C++, Javascript, Typescript, remain the official userspace languages.

Low-level code is being written in Rust. Of course userspace doesn't require low-level languages (and I don't quite get why C and C++ are exposed to the userspace and Rust is not). Swift is not a replacemente for C and C++, but rather for Objective-C. Do you have any sources for those claims?

>Swift is not a replacemente for C and C++, but rather for Objective-C.

Swift is not a replacement for anything; Apple will even say as much. It just fills the hole for a scripting language that they had for decades. Plenty of new Obj-C is still (and will continue to be) written for a long time.

Post reply on HN