Live data from Hacker News

How fast is a macOS VM, and how small could it be?

eclecticlight.co

61–70 of 111 posts

Re: How fast is a macOS VM, and how small could it be?

#61

Honestly macOS probably can go much lower than that if you turn off some stuff that's not strictly necessary for a VM. The first iPhones only had 128 MiB of RAM and they ran a trimmed down version of macOS Tiger I believe. It's just that RAM has been quite abundant so far, so there was no real reason to try to trim it down, but it's definitely possible, and probably not that hard either, we just need to start trying…

Well early iPhones did not have app multitasking, so that‘s quite the difference. Any app was killed when when closed.

Yes it did. You just couldn’t use it. I could send a text message while listening to music. Sometimes the music would crash due to OOM.

Re: How fast is a macOS VM, and how small could it be?

#62
post #27

Earlier quoted context omitted.

I'd bet for the null hypothesis: the memory behaviour changes would hold if the core count was kept constant and only the VM's memory size was adjusted.

There is a per-cpu data structure in the xnu kernel, but it is not big enough to tilt the scales when you are talking about RAM in units of gigabytes.

It’s not just the kernel. I wouldn’t be surprised if there’s a fair few userspace services spawning a thread per core.

Re: How fast is a macOS VM, and how small could it be?

#63
post #16

Got a M5 air recently - my first dive into MacOS land so trying to figure this out too. Seems essentially impossible to get: * pytorch * GPU acceleration * VM/container like isolation The virtio-gpu layer gets closest but seems to only pass through graphics GPU not compute GPU so no pytorch

I got torch to run in a Cirruslabs Tart instance.

By "Instance" do you mean their cloud platform?

Re: How fast is a macOS VM, and how small could it be?

#64
post #7

>Starting with 4 virtual cores and 8 GB vRAM, where the VM ran perfectly briskly with around 5 GB of memory used, I stepped down to 3 cores and 6 GB, to discover that memory usage fell to 3.9 GB and everything worked well. With just 2 cores and 4 GB of memory only 3.1 GB of that was used, and the VM continued to handle those lightweight tasks normally. Good reminder that there's a certain amount of memory tied up wit…

As a general rule, also the amount of physical memory installed in a computer should be proportional with the number of hardware threads provided by its CPU. Besides the fact that the operating system may allocate some memory for each thread, when you launch a multi-threaded application that is able to use all available threads, for instance the compilation of a big software project, it frequently will allocate some…

Compiling flash-attn (Flash Attention) is a another great stress-test for CPU+RAM as just using 16 threads can balloon you into 128GB RAM usage territory already. Same thing with needing to not do too much concurrency when compiling it.

Re: How fast is a macOS VM, and how small could it be?

#66

Earlier quoted context omitted.

As a general rule, also the amount of physical memory installed in a computer should be proportional with the number of hardware threads provided by its CPU. Besides the fact that the operating system may allocate some memory for each thread, when you launch a multi-threaded application that is able to use all available threads, for instance the compilation of a big software project, it frequently will allocate some…

Compiling flash-attn (Flash Attention) is a another great stress-test for CPU+RAM as just using 16 threads can balloon you into 128GB RAM usage territory already. Same thing with needing to not do too much concurrency when compiling it.

I have this problem with NixOS as one of my build servers doesn’t have enough ram. There doesn’t seem to be a way to know if a compilation is likely to be ram heavy and either use a tagged server with more ram or use few threads on servers with less ram.

Re: How fast is a macOS VM, and how small could it be?

#67
post #16

Got a M5 air recently - my first dive into MacOS land so trying to figure this out too. Seems essentially impossible to get: * pytorch * GPU acceleration * VM/container like isolation The virtio-gpu layer gets closest but seems to only pass through graphics GPU not compute GPU so no pytorch

[dead]

Re: How fast is a macOS VM, and how small could it be?

#68

My only experience with VMs on macOS is colima+docker, and it's relatively painful and inefficient (but usable).

Try Apple's container CLI. I moved a project of mine from colima+docker to it relatively easily, a couple of weekends ago. https://github.com/apple/container

Here's an example of how to build a simple Alpine Linux container using Apple's containerization CLI. It also demonstrates how to connect to the container through Tailscale SSH using a Tailscale auth key stored in Apple Keychain:

https://github.com/highpost/tailscale-macos-container

Re: How fast is a macOS VM, and how small could it be?

#69
post #7

>Starting with 4 virtual cores and 8 GB vRAM, where the VM ran perfectly briskly with around 5 GB of memory used, I stepped down to 3 cores and 6 GB, to discover that memory usage fell to 3.9 GB and everything worked well. With just 2 cores and 4 GB of memory only 3.1 GB of that was used, and the VM continued to handle those lightweight tasks normally. Good reminder that there's a certain amount of memory tied up wit…

There is some overhead per-core, you're right, but imo this reduction in usage is likely from how the kernel allocates available memory, which is being reduced as well. The kernel will keep read caches around longer with more memory, it'll prefer to compress memory instead of swap to disk if it has more, it'll purge/cleanup reclaimable memory less often with more memory, etc. It even scales its internal buffer sizes…

Single inline backticks like `this` aren't recognized (although still useful in my opinion, they just don't change the rendering).

Triple backticks also aren't recognized. However, if you indent by I believe 4 spaces, it formats it in a fixed width font presuming it's code.

Let's try (4 spaces):

    func main() {
        fmt.Println("Hello, HN!")
    }
None for comparison:

func main() { fmt.Println("Hello, HN!") }

Re: How fast is a macOS VM, and how small could it be?

#70
post #60
post #48

Earlier quoted context omitted.

I mean if there are faulty apps, but where do you get this idea from? The amount of IDE's, docker containers, all kinds of stuff you can run on macOS in just 16GB is astounding. And I've used this OS on the desktop for 23 years.

It's not really that interesting in the landscapes of OSes; modern (or even ancient) Windows and Linux distros have been doing these tasks simultaneously in one form or fashion since 16GiB was seen as a lot of RAM. See my other post for just a tiny amount of references to OOTB faulty apps.

My experience along with thousands others (incl 100 other Macs at work) is that of stability. You're saying the opposite based on some Reddit threads. Not sure what your intentions are. Yes, modern OS's might have issues in runtime, but of the top 3, I am pretty sure macOS is the most stable. Linux wins on the server side though.
Post reply on HN