5 ms·
Apple has had a native hypervisor for some time now. This is probably a baked in clone of something like https://mac.getutm.app/ https://mac.getutm.app/ which p
by tensor 1y ago
Apple has had a native hypervisor for some time now. This is probably a baked in clone of something like https://mac.getutm.app/ https://mac.getutm.app/ which provides the stuff on top of the hypervisor.
- watermelon0 1y agoUsing a hypervisor means just running a Linux VM, like WSL2 does on Windows. There is nothing native about it. Native Linux (and Docker) support would be something like WSL1, where Windows kernel implemented Linux syscalls.
- mdaniel 1y agoSurely if Windows kernel can be taught to respond to those syscalls, XNU can be taught it even easier. But, AIUI the Windows kernel already had a concept of "personalities" from back when they were trying to integrate OS/2 so that zero-to-one for XNU could be a huge lift, not the syscalls part specifically
- literalAardvark 1y agoExactly. So it wouldn't necessarily be easier. NT is almost a microkernel.
- 9dev 1y agoYep. People consistently underestimate the great piece of technology NT is, it really was ahead of its time. And a shame what Microsoft is doing with it now.
- okanat 1y agoWas it ahead? I am not sure. There was lots of research on microkernels at the time and NT was a good compromise between a mono and a microkernel. It was an engineering product of its age. A considerably good one. It is still the best popular kernel today. Not because it is the best possible with today's resouces but because nobody else cares about core OS design anymore. I think it is the Unix side that decided to burry their heads into sand. We got Linux. It is free (of charge or licensing). It supported files, basic drivers and sockets. It got commercial support for servers. It was all Silicon Valley needed for startups. Anything else is a cost. So nobody cared. Most of the open source microkernel research slowly died after Linux. There is still some with L4 family. Now we are overengineering our stacks to get closer to microkernel capabilities that Linux lacks using containers. I don't want to say it is ripe for disruption becuse it is hard and again nobody cares (except some network and security equipment but that's a tiny fraction).
- 9dev 1y ago> Was it ahead? I am not sure. You say this, but then proceed to state that it had a very good design back then informed by research, and still is today. Doesn't that qualify? :-) NT brought a HAL, proper multi-user ACLs, subsystems in user mode (that alone is amazing, even though they sadly never really gained momentum), preemptive multitasking. And then there's NTFS, with journaling, alternate streams, and shadow copies, and heaps more. A lot of it was very much ahead of UNIX at the time. > nobody else cares about core OS design anymore. Agree with you on that one.
- okanat 1y ago> You say this, but then proceed to state that it had a very good design back then informed by research, and still is today. Doesn't that qualify? :-) I meant that NT was a product that matched the state of the art OS design of its time (90s). It was the Unix world that decided to be behind in 80s forever. NT was ahead not because it is breaking ground and bringing in new design aspects of 2020s to wider audiences but Unix world constantly decides to be hardcore conservative and backwards in OS design. They just accept that a PDP11 simulator is all you need. It is similar to how NASA got stuck with 70s/80s design of Shuttle. There was research for newer launch systems but nobody made good engineering applications of them.
- anthk 1y agoUnix 'died' with plan9/9front, which is far more advanced than Unix v7 for a PDP or a DEC, can't remember. 9front is to Unix was NT it's for VMS.
- kergonath 1y ago> the Windows kernel already had a concept of "personalities" from back when they were trying to integrate OS/2 so that zero-to-one for XNU could be a huge lift, not the syscalls part specifically XNU is modular, with its BSD servers on top of Mach. I don’t see this as being a strong advantage of NT.
- shawnz 1y agoWSL1 didn't use the existing support for personalities in NT
- heavyset_go 1y agoXNU similarly has a concept of "flavors" and uses FreeBSD code to provide the BSD flavor. Theoretically, either Linux code or a compatibility layer could be implemented in the kernel in a similar way. The former won't happen due to licensing.
- petersellers 1y agoHyper-V is a type 1 hypervisor, so Linux and Windows are both running as virtual machines but they have direct access to hardware resources. It's possible that Apple has implemented a similar hypervisor here.
- tensor 1y ago> The Containerization framework enables developers to create, download, or run Linux container images directly on Mac. It's built on an open-source framework optimized for Apple Silicon and provides secure isolation between container images That's their phrasing, which suggests to me that it's just a virtualization system. Linux container images generally contain the kernel.
- hackyhacky 1y ago> Linux container images generally contain the kernel. No, containers differ from VMs precisely in requiring dependency on the host kernel.
- tensor 1y agoHmm, so they do. I assumed because you pulled in a linux distro that the kernel was from that distro is used too, but I guess not. Perhaps they have done some sort of improvement where they have one linux kernel running via the hypervisor that all containers use. Still can't see them trying to emulate linux calls, but who knows.
- froggit 1y ago> I assumed because you pulled in a linux distro that the kernel was from that distro is used too, Thst's how docker works on WSL2, run it on top of a virtualised linux kernal. WSL2 is pretty tightly integrated with windows itself, stil a linux vm though. It seems kinda weird for apple to reinvent the wheel for that kind of thing for containers.
- froggit 1y ago> Thst's how docker works on WSL2, run it on top of a virtualised linux kernal. WSL2 is pretty tightly integrated with windows itself, stil a linux vm though. It seems kinda weird for apple to reinvent the wheel for that kind of thing for containers. Can't edit my posts mobile but realized that's, what's the word, not useful... But yeah, sharing the kernal between containers but otherwise makes them isolated allegedly allows them to have VMesque security without the overhead of seperate VMs for each image. There's a lot more to it, but you get the idea.
- pjmlp 1y agoIt is as native as any Linux cloud instance.
- neuralkoi 1y agoIn case you're wondering, the Hypervisor.framework C API is really neat and straightforward: 1. Creating and configuring a virtual machine: hv_vm_create(HV_VM_DEFAULT); 2. Allocating guest memory: void* memory = mmap(...); hv_vm_map(memory, guest_physical_address, size, HV_MEMORY_READ | HV_MEMORY_WRITE | HV_MEMORY_EXEC); 3. Creating virtual CPUs: hv_vcpu_create(&vcpu, HV_VCPU_DEFAULT); 4. Setting registers: hv_vcpu_write_register(vcpu, HV_X86_RIP, 0x1000); // Set instruction pointer hv_vcpu_write_register(vcpu, HV_X86_RSP, 0x8000); // Stack pointer 5. Running guest code: hv_vcpu_run(vcpu); 6. Handling VM exits: hv_vcpu_exit_reason_t reason; hv_vcpu_read_register(vcpu, HV_X86_EXIT_REASON, &reason);
- arthurcolle 1y agoThanks for this ! Apple Silicon?
- conradev 1y agoOne of the reasons OrbStack is so great is because they implement their own hypervisor: https://orbstack.dev/ https://orbstack.dev/ Apple’s stack gives you low-level access to ARM virtualization, and from there Apple has high-level convenience frameworks on top. OrbStack implements all of the high-level code themselves.
- deleted 1y ago[deleted]
- leoh 1y agoHow does it compare to apple’s hv?
- conradev 1y agoBetter filesystem support (https://orbstack.dev/blog/fast-filesystem https://orbstack.dev/blog/fast-filesystem) and memory utilization (https://orbstack.dev/blog/dynamic-memory https://orbstack.dev/blog/dynamic-memory)