3 ms·
Would the macOS kernel (Mach) ever be rewritten in Swift? And if so, what benefit would it provide?
by alberth 4y ago
Would the macOS kernel (Mach) ever be rewritten in Swift?
And if so, what benefit would it provide?
- deleted 4y ago[deleted]
- mplewis9z 4y agoI doubt the entire kernel would - there are low-level, memory-unsafe operations that an operating system performs that Swift _could_ do, but it would be fighting the design of the language and likely not a great trade-off for the kernel developers. But pieces absolutely could be. The benefit would be compile-time checking for memory safety issues (reducing crashes) and language-level concurrency (fewer race conditions and a much easier path to parallelize single-threaded code for performance).
- MBCook 4y agoI believe all the code on the Secure Enclave is now Swift. I believe they use a special mode/analyzers to ensure only the “ok” stuff is used. Perhaps no memory allocation, for example. It sounds to me like Apple would like Swift, perhaps with some extra tooling, to be able to handle the Mach kernel. I don’t know if they’ll go that far though.
- saagarjha 4y agoDefinitely not, it’s just used for some parts.
- jonpalmisc 4y agoIIRC, it is /some/ (not /all/) of the code on the SEP is now Swift. SEPOS's microkernel, etc. is still C.
- MBCook 4y agoAh, I must have been misremembering. Thanks.