ibenedek
← All posts

RESEARCH NOTEBOOK

Multithreading with C++ Causes Freezing and Restarts on MacBook Pro M3 Max

Problem Report for macOS I recently tested multithreading in C++ on my new MacBook Pro M3 Max with 128 GB of memory, and unexpectedly, my MacBook restarted during the test. I ran the same code on Windows 11 (in parallel desktop), and surprisingly, Windows handled the code without any issues.

Let’s dive into the details. The code in question is a simple but resource-intensive program: #include <iostream> #include <thread> #include <vector> #include <random> #include <numeric> #include <mutex> #include <condition_variable> #include <string> #include <format> #include <fstream> #include <iostream> #include <chrono> #include <cmath>

bool isPrime(int n, int primes[]) { int s = int(sqrt(n)+1); int i = 0; while (primes[i]<s) { if (n%primes[i]==0) { return false; } i++; }

return true; }

int* get_primes(int max_items){ std::cout<< “get_primes before allocate” << std::endl; int* primes = new int[max_items]; std::cout<< “get_primes after allocate” << std::endl; primes[0]=2; primes[1]=3; int i = 2; int n = primes[1] + 2; while(i < max_items) { if(isPrime(n, primes)) { primes[i] = n; i++; } n = n+2; }

return primes; }

int generate_random_number() { static std::random_device rd; static std::mt19937 gen(rd()); static std::uniform_int_distribution<> dis(1, 100); get_primes(10000); return dis(gen); }

std::mutex mtx; std::condition_variable cv; bool ready = false;

void thread_function(int n, int &result) { //std::cout << std::format(“Thread {} started.”,n) << std::endl; // Wait until the main thread signals the start std::unique_lock<std::mutex> lock(mtx); cv.wait(lock, [] { return ready; });

// Generate the random number result = generate_random_number(); std::cout << ”.”; //std::cout << std::format(“Thread {} ended.”,n) << std::endl; }

int main() { std::cout<< “start” << std::endl; const int num_threads = 9967; std::vector<std::thread> threads; std::cout<< “before allocate” << std::endl; std::vector<int> results(num_threads); std::cout<< “after allocate”<< std::endl;

// Start all threads, but they will wait for the signal to start for (int i = 0; i < num_threads; ++i) { threads.emplace_back(thread_function,i, std::ref(results[i])); }

// Simulate some work in the main thread std::this_thread::sleep_for(std::chrono::seconds(1));

// Signal all threads to start { std::lock_guard<std::mutex> lock(mtx); ready = true; } cv.notify_all(); // Notify all waiting threads

// Wait for all threads to finish for (auto &t : threads) { t.join(); }

// Summarize the results int sum = std::accumulate(results.begin(), results.end(), 0);

std::cout << “END. Sum of all random numbers: ” << sum << std::endl;

return 0; } Report: panic(cpu 3 caller 0xfffffe001d3d5164): Spinlock[0xfffffe2acc97cfe8] timeout after 12583360 ticks; current owner: 0xfffffe2acdd4efb0 (on cpu 11), start time: 1195737728, now: 1208321088, timeout: 12582912 @locks.c:446 Debugger message: panic Memory ID: 0xff OS release type: User

OS version: 23G93

Kernel version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6031 Fileset Kernelcache UUID: A1F8A5FAE67F232E4626F002E5D56C68 Kernel UUID: 4C58F257-F9AE-3173-B7E1-3DFD20704A6E Boot session UUID: 7EC9B5F6-39FA-4BD6-AC05-6DCA9444D2E8 iBoot version: iBoot-10151.140.19 secure boot?: YES roots installed: 0 Paniclog version: 14 KernelCache slide: 0x0000000014de8000 KernelCache base: 0xfffffe001bdec000 Kernel slide: 0x0000000014df0000 Kernel text base: 0xfffffe001bdf4000 Kernel text exec slide: 0x000000001635c000 Kernel text exec base: 0xfffffe001d360000 mach_absolute_time: 0x497e855f Epoch Time: sec usec Boot : 0x66c9bd13 0x0005ec94 Sleep : 0x00000000 0x00000000 Wake : 0x00000000 0x00000000 Calendar: 0x66c9bd3d 0x000d114a

Zone info: Zone map: 0xfffffe15fe1dc000 - 0xfffffe35fe1dc000 . VM : 0xfffffe15fe1dc000 - 0xfffffe1acaea8000 . RO : 0xfffffe1acaea8000 - 0xfffffe1c64840000 . GEN0 : 0xfffffe1c64840000 - 0xfffffe213150c000 . GEN1 : 0xfffffe213150c000 - 0xfffffe25fe1d8000 . GEN2 : 0xfffffe25fe1d8000 - 0xfffffe2acaea4000 . GEN3 : 0xfffffe2acaea4000 - 0xfffffe2f97b70000 . DATA : 0xfffffe2f97b70000 - 0xfffffe35fe1dc000 Metadata: 0xfffffe3c1f604000 - 0xfffffe3c27604000 Bitmaps : 0xfffffe3c27604000 - 0xfffffe3c37604000 Extra : 0 - 0

CORE 0 recently retired instr at 0xfffffe001d50f04c CORE 1 recently retired instr at 0xfffffe001d50f04c CORE 2 recently retired instr at 0xfffffe001d50f04c CORE 3 recently retired instr at 0xfffffe001d50d918 CORE 4 recently retired instr at 0xfffffe001d50f04c CORE 5 recently retired instr at 0xfffffe001d50f04c CORE 6 recently retired instr at 0xfffffe001d50f04c CORE 7 recently retired instr at 0xfffffe001d50f04c CORE 8 recently retired instr at 0xfffffe001d50f04c CORE 9 recently retired instr at 0xfffffe001d50f04c CORE 10 recently retired instr at 0xfffffe001d50f04c CORE 11 recently retired instr at 0xfffffe001d50f04c CORE 12 recently retired instr at 0xfffffe001d50f04c CORE 13 recently retired instr at 0xfffffe001d50f04c CORE 14 recently retired instr at 0xfffffe001d50f04c CORE 15 recently retired instr at 0xfffffe001d50f04c TPIDRx_ELy = {1: 0xfffffe2acce16fb0 0: 0x0000000000000003 0ro: 0x000000030603b0e0 } CORE 0 PVH locks held: None CORE 1 PVH locks held: None CORE 2 PVH locks held: None CORE 3 PVH locks held: None CORE 4 PVH locks held: None CORE 5 PVH locks held: None CORE 6 PVH locks held: None CORE 7 PVH locks held: None CORE 8 PVH locks held: None CORE 9 PVH locks held: None CORE 10 PVH locks held: None CORE 11 PVH locks held: None CORE 12 PVH locks held: None CORE 13 PVH locks held: None CORE 14 PVH locks held: None

CORE 15 PVH locks held: None

CORE 0: PC=0xfffffe001d3d5528, LR=0xfffffe001d3d5500, FP=0xfffffe3608debd30

CORE 1: PC=0xfffffe001d3d5528, LR=0xfffffe001d3d5500, FP=0xfffffe360a623d30

CORE 2: PC=0xfffffe001d3d5528, LR=0xfffffe001d3d5500, FP=0xfffffe360a63bd30

CORE 3 is the one that panicked. Check the full backtrace for details.

CORE 4: PC=0xfffffe001d3d5528, LR=0xfffffe001d3d5500, FP=0xfffffe360a8bbd30

CORE 5: PC=0xfffffe001d3d5528, LR=0xfffffe001d3d5500, FP=0xfffffe360a58fd30

CORE 6: PC=0xfffffe001d3d5528, LR=0xfffffe001d3d5500, FP=0xfffffe360a74fd30

CORE 7: PC=0xfffffe001d3d5528, LR=0xfffffe001d3d5500, FP=0xfffffe360983bd30

CORE 8: PC=0xfffffe001d3d5528, LR=0xfffffe001d3d5500, FP=0xfffffe360a897d30

CORE 9: PC=0xfffffe001d3d5528, LR=0xfffffe001d3d5500, FP=0xfffffe3608ccbd30

CORE 10: PC=0x0000000194bf73e0, LR=0x00000001004cab8c, FP=0x000000016fd11b20

CORE 11: PC=0xfffffe002064a4c0, LR=0xfffffe002064a478, FP=0xfffffe360a653dc0

CORE 12: PC=0xfffffe001d3d5528, LR=0xfffffe001d3d5500, FP=0xfffffe360a683d30

CORE 13: PC=0xfffffe001d3d5528, LR=0xfffffe001d3d5500, FP=0xfffffe360a813d30

CORE 14: PC=0xfffffe001d3d5528, LR=0xfffffe001d3d5500, FP=0xfffffe360a453d30

CORE 15: PC=0xfffffe001d3d5528, LR=0xfffffe001d3d5500, FP=0xfffffe360a6bfd30

Compressor Info: 0% of compressed pages limit (OK) and 0% of segments limit (OK) with 0 swapfiles and OK swap space Panicked task 0xfffffe2f9060ddb0: 10126 pages, 9968 threads: pid 1001: restart_macos Panicked thread: 0xfffffe2acce16fb0, backtrace: 0xfffffe3609b8f660, tid: 10282 lr: 0xfffffe001d3b812c fp: 0xfffffe3609b8f6f0 lr: 0xfffffe001d505e18 fp: 0xfffffe3609b8f760 lr: 0xfffffe001d504278 fp: 0xfffffe3609b8f830 lr: 0xfffffe001d3678cc fp: 0xfffffe3609b8f840 lr: 0xfffffe001d3b7a20 fp: 0xfffffe3609b8fbf0 lr: 0xfffffe001dbc0600 fp: 0xfffffe3609b8fc10 lr: 0xfffffe001d3d5164 fp: 0xfffffe3609b8fc90 lr: 0xfffffe001d3d55b8 fp: 0xfffffe3609b8fd30 lr: 0xfffffe002064a464 fp: 0xfffffe3609b8fdc0 lr: 0xfffffe001d855240 fp: 0xfffffe3609b8fde0 lr: 0xfffffe001d9dc24c fp: 0xfffffe3609b8fe40 lr: 0xfffffe001d5043cc fp: 0xfffffe3609b8ff10 lr: 0xfffffe001d3678cc fp: 0xfffffe3609b8ff20 lr: 0xfffffe001d367894 fp: 0x0000000000000000 Kernel Extensions in backtrace: com.apple.kec.pthread(1.0)[A8EBFCE3-3EAE-3BB4-B29D-28DFEB0689AA]@0xfffffe0020645ff0->0xfffffe002064bdf3

last started kext at 519126562: com.apple.filesystems.autofs 3.0 (addr 0xfffffe001c81c340, size 6069) loaded kexts: com.apple.filesystems.autofs 3.0 com.apple.driver.AppleTopCaseHIDEventDriver 7440.8 com.apple.driver.CoreKDL 1 com.apple.driver.AppleBiometricServices 1 com.apple.driver.DiskImages.ReadWriteDiskImage 493.0.0 com.apple.driver.DiskImages.UDIFDiskImage 493.0.0 com.apple.driver.DiskImages.RAMBackingStore 493.0.0 com.apple.driver.DiskImages.FileBackingStore 493.0.0 com.apple.driver.BCMWLANFirmware4388.Hashstore 1 com.apple.driver.AppleSmartBatteryManager 161.0.0 com.apple.driver.AppleALSColorSensor 1.0.0d1 com.apple.driver.AppleUSBDeviceNCM 5.0.0 com.apple.driver.AppleThunderboltIP 4.0.3 com.apple.driver.AppleAOPVoiceTrigger 340.42 com.apple.driver.SEPHibernation 1 com.apple.driver.AppleFileSystemDriver 3.0.1 com.apple.nke.l2tp 1.9 com.apple.filesystems.tmpfs 1 com.apple.driver.AppleSmartIO2 1 com.apple.AppleEmbeddedSimpleSPINORFlasher 1 com.apple.filesystems.nfs 1 com.apple.filesystems.lifs 1 com.apple.filesystems.apfs 2236.141.1 com.apple.IOTextEncryptionFamily 1.0.0 com.apple.filesystems.hfs.kext 650.140.2 com.apple.security.BootPolicy 1 com.apple.BootCache 40 com.apple.AppleFSCompression.AppleFSCompressionTypeZlib 1.0.0 com.apple.AppleFSCompression.AppleFSCompressionTypeDataless 1.0.0d1 com.apple.driver.ApplePMP 1 com.apple.driver.AppleDPDisplayTCON 1 com.apple.driver.AppleM68Buttons 1.0.0d1 com.apple.driver.AppleProResHW 350.47.0 com.apple.driver.AppleJPEGDriver 6.6.2 com.apple.driver.ApplePMPFirmware 1 com.apple.driver.AppleAVE2 760.31.1 com.apple.driver.AppleAVD 743 com.apple.driver.AppleSamsungSerial 1.0.0d1 com.apple.driver.AppleMobileDispT603C-DCP 140.0 com.apple.AGXG15C 282.14 com.apple.driver.AppleSerialShim 1 com.apple.driver.AppleSDXC 3.5.2 com.apple.driver.AppleS5L8960XNCO 1 com.apple.driver.usb.AppleSynopsysUSB40XHCI 1 com.apple.driver.AppleTypeCRetimer 1.0.0 com.apple.driver.AppleCS42L84Audio 740.41 com.apple.driver.AppleSN012776Amp 740.41 com.apple.driver.AppleT6031CLPC 1 com.apple.driver.AppleT6031SOCTuner 1 com.apple.driver.AppleEventLogHandler 1 com.apple.driver.AppleT6031PMGR 1 com.apple.driver.AppleS8000AES 1 com.apple.driver.AppleS8000DWI 1.0.0d1 com.apple.driver.AppleInterruptControllerV3 1.0.0d1 com.apple.driver.AppleBluetoothModule 1 com.apple.driver.AppleBCMWLANBusInterfacePCIe 1 com.apple.driver.AppleS5L8920XPWM 1.0.0d1 com.apple.driver.AudioDMAController-T603x 350.2 com.apple.driver.AppleSPIMC 1 com.apple.driver.AppleS5L8940XI2C 1.0.0d2 com.apple.driver.AppleT8110DART 1 com.apple.driver.AppleH15MCD 1 com.apple.iokit.IOUserEthernet 1.0.1 com.apple.driver.usb.AppleUSBUserHCI 1 com.apple.iokit.IOKitRegistryCompatibility 1 com.apple.iokit.EndpointSecurity 1 com.apple.driver.AppleUIO 1 com.apple.driver.AppleDiskImages2 276.120.7 com.apple.AppleSystemPolicy 2.0.0 com.apple.nke.applicationfirewall 405 com.apple.kec.InvalidateHmac 1 com.apple.kec.AppleEncryptedArchive 1 com.apple.driver.driverkit.serial 6.0.0 com.apple.iokit.IOAVBFamily 1220.1 com.apple.driver.AppleHSBluetoothDriver 7440.8 com.apple.driver.IOBluetoothHIDDriver 9.0.0 com.apple.driver.AppleHIDKeyboard 7440.3 com.apple.driver.AppleActuatorDriver 7440.9 com.apple.driver.AppleMultitouchDriver 7440.9 com.apple.driver.AppleMesaSEPDriver 100.99 com.apple.iokit.IOBiometricFamily 1 com.apple.driver.DiskImages.KernelBacked 493.0.0 com.apple.driver.AppleXsanScheme 3 com.apple.driver.AppleConvergedIPCOLYBTControl 1 com.apple.driver.AppleConvergedPCI 1 com.apple.driver.AppleBluetoothDebug 1 com.apple.driver.AppleBTM 1.0.1 com.apple.driver.usb.networking 5.0.0 com.apple.driver.AppleAOPAudio 340.4 com.apple.driver.AppleTrustedAccessory 1 com.apple.iokit.AppleSEPGenericTransfer 1 com.apple.driver.AppleThunderboltUSBDownAdapter 1.0.4 com.apple.driver.AppleSEPHDCPManager 1.0.1 com.apple.driver.AppleThunderboltPCIDownAdapter 4.1.1 com.apple.driver.AppleThunderboltDPInAdapter 8.5.1 com.apple.driver.AppleThunderboltDPAdapterFamily 8.5.1 com.apple.nke.ppp 1.9 com.apple.driver.AppleDiagnosticDataAccessReadOnly 1.0.0 com.apple.iokit.IONVMeFamily 2.1.0 com.apple.driver.AppleNANDConfigAccess 1.0.0 com.apple.driver.AppleBSDKextStarter 3 com.apple.kext.triggers 1.0 com.apple.driver.IOHIDPowerSource 1 com.apple.driver.AppleCallbackPowerSource 1 com.apple.filesystems.hfs.encodings.kext 1 com.apple.driver.AppleSyntheticGameController 11.6.1 com.apple.AGXFirmwareKextG15CRTBuddy 1 com.apple.AGXFirmwareKextRTBuddy64 282.14 com.apple.plugin.IOgPTPPlugin 1240.15 com.apple.driver.AppleDCPDPTXProxy 1.0.0 com.apple.driver.DCPDPFamilyProxy 1 com.apple.driver.AppleHIDTransportFIFO 7440.1 com.apple.driver.AppleHIDTransport 7440.1 com.apple.driver.AppleSPU 1 com.apple.driver.AppleInputDeviceSupport 7440.1 com.apple.driver.AppleSART 1 com.apple.driver.ApplePTD 1.0.0 com.apple.iokit.IOMobileGraphicsFamily-DCP 343.0.0 com.apple.iokit.IOMobileGraphicsFamily 343.0.0 com.apple.driver.AppleM2ScalerCSCDriver 265.0.0 com.apple.iokit.IOGPUFamily 93.40.3 com.apple.driver.AppleDCP 1 com.apple.driver.DCPAVFamilyProxy 1 com.apple.driver.AppleFirmwareKit 1 com.apple.driver.AppleMobileApNonce 1 com.apple.driver.AppleHPM 3.4.4 com.apple.driver.AppleSPMIPMU 1.0.1 com.apple.driver.AppleDialogPMU 1.0.1 com.apple.driver.AppleUSBXDCIARM 1.0 com.apple.driver.AppleUSBXDCI 1.0 com.apple.iokit.IOUSBDeviceFamily 2.0.0 com.apple.driver.usb.AppleSynopsysUSBXHCI 1 com.apple.driver.usb.AppleUSBXHCI 1.2 com.apple.driver.AppleEmbeddedUSBHost 1 com.apple.driver.usb.AppleUSBHub 1.2 com.apple.driver.usb.AppleUSBHostCompositeDevice 1.2 com.apple.driver.AppleT8122TypeCPhy 1 com.apple.driver.AppleStockholmControl 1.0.0 com.apple.driver.AppleSPMI 1.0.1 com.apple.driver.AppleCSEmbeddedAudio 740.41 com.apple.driver.AppleEmbeddedAudio 740.41 com.apple.iokit.AppleARMIISAudio 340.16 com.apple.driver.IISAudioIsolatedStreamECProxy 340.16 com.apple.driver.ExclavesAudioKext 1 com.apple.driver.ApplePassthroughPPM 3.0 com.apple.driver.ApplePMGR 1 com.apple.driver.AppleARMWatchdogTimer 1 com.apple.driver.AppleDisplayCrossbar 1.0.0 com.apple.iokit.IODisplayPortFamily 1.0.0 com.apple.driver.AppleTypeCPhy 1 com.apple.driver.AppleMultiFunctionManager 1 com.apple.driver.AppleBluetoothDebugService 1 com.apple.driver.AppleBCMWLANCore 1.0.0 com.apple.iokit.IO80211Family 1200.13.0 com.apple.driver.IOImageLoader 1.0.0 com.apple.driver.AppleOLYHAL 1 com.apple.driver.corecapture 1.0.4 com.apple.driver.AppleA7IOP-MXWrap-v1 1.0.2 com.apple.driver.AppleThunderboltNHI 7.2.81 com.apple.driver.AppleT8122PCIeC 1 com.apple.iokit.IOThunderboltFamily 9.3.3 com.apple.iokit.IOPortFamily 1.0 com.apple.driver.ApplePIODMA 1 com.apple.driver.AppleT6031PCIe 1 com.apple.driver.AppleEmbeddedPCIE 1 com.apple.driver.AppleMCA2-T603x 840.3 com.apple.driver.AppleEmbeddedAudioLibs 340.8 com.apple.driver.AppleFirmwareUpdateKext 1 com.apple.driver.AppleH13CameraInterface 8.701.0 com.apple.driver.AppleGPIOICController 1.0.2 com.apple.driver.AppleA7IOP-ASCWrap-v6 1.0.2 com.apple.driver.AppleDockChannel 1 com.apple.driver.AppleEverestErrorHandler 1 com.apple.driver.usb.AppleUSBHostPacketFilter 1.0 com.apple.iokit.IOTimeSyncFamily 1240.15 com.apple.driver.DiskImages 493.0.0 com.apple.iokit.IOGraphicsFamily 598 com.apple.iokit.IOBluetoothFamily 9.0.0 com.apple.driver.AppleT6031ANEHAL 7.453.0 com.apple.driver.AppleSSE 1.0 com.apple.driver.AppleSEPKeyStore 2 com.apple.driver.AppleUSBTDM 556 com.apple.iokit.IOUSBMassStorageDriver 245 com.apple.iokit.IOPCIFamily 2.9 com.apple.iokit.IOUSBHostFamily 1.2 com.apple.driver.AppleUSBHostMergeProperties 1.2 com.apple.driver.usb.AppleUSBCommon 1.0 com.apple.driver.AppleSMC 3.1.9 com.apple.driver.RTBuddy 1.0.0 com.apple.driver.AppleEmbeddedTempSensor 1.0.0 com.apple.driver.AppleARMPMU 1.0 com.apple.iokit.IOAccessoryManager 1.0.0 com.apple.driver.AppleOnboardSerial 1.0 com.apple.iokit.IOSerialFamily 11 com.apple.iokit.IOSCSIBlockCommandsDevice 495 com.apple.iokit.IOSCSIArchitectureModelFamily 495 com.apple.driver.AppleRSMChannel 1 com.apple.iokit.IORSMFamily 1 com.apple.driver.AppleLockdownMode 1 com.apple.driver.AppleIPAppender 1.0 com.apple.iokit.IOSkywalkFamily 1.0 com.apple.driver.mDNSOffloadUserClient 1.0.1b8 com.apple.iokit.IONetworkingFamily 3.4 com.apple.driver.AppleFDEKeyStore 28.30 com.apple.driver.AppleEffaceableStorage 1.0 com.apple.driver.AppleCredentialManager 1.0 com.apple.driver.AppleSEPManager 1.0.1 com.apple.driver.AppleA7IOP 1.0.2 com.apple.driver.IOSlaveProcessor 1 com.apple.driver.AppleBiometricSensor 2 com.apple.iokit.IOHIDFamily 2.0.0 com.apple.driver.AppleANELoadBalancer 7.453.0 com.apple.driver.AppleH11ANEInterface 7.453.0 com.apple.driver.IODARTFamily 1 com.apple.AUC 1.0 com.apple.iokit.IOSurface 352.50.1 com.apple.iokit.IOAVFamily 1.0.0 com.apple.iokit.IOHDCPFamily 1.0.0 com.apple.iokit.IOCECFamily 1 com.apple.iokit.IOAudio2Family 1.0 com.apple.driver.AppleIISController 340.1 com.apple.driver.AppleAudioClockLibs 340.8 com.apple.driver.FairPlayIOKit 71.10.0 com.apple.driver.AppleARMPlatform 1.0.2 com.apple.iokit.IOSlowAdaptiveClockingFamily 1.0.0 com.apple.iokit.IOReportFamily 47 com.apple.security.quarantine 4 com.apple.security.sandbox 300.0 com.apple.iokit.IOStorageFamily 2.1 com.apple.kext.AppleMatch 1.0.0d1 com.apple.driver.AppleMobileFileIntegrity 1.0.5 com.apple.iokit.CoreAnalyticsFamily 1 com.apple.security.AppleImage4 6.3.0 com.apple.kext.CoreTrust 1 com.apple.iokit.IOCryptoAcceleratorFamily 1.0.1 com.apple.kec.pthread 1 com.apple.kec.Libm 1 com.apple.kec.Compression 1.0 com.apple.kec.corecrypto 14.0

** Stackshot Incomplete ** Bytes Filled 1477260 ** The code essentially burns through system resources by creating a large number of threads, each performing the same task. These threads are started simultaneously, and the program waits for their completion to compute a sum. The most demanding part of the code is the generate_random_number() method, which not only generates random numbers but also has a side effect — it produces the first 10,000 prime numbers. This method is invoked by every thread, increasing resource utilization and ensuring that each thread runs longer than just a few milliseconds.

Initially, I created 10,000 threads, which led to an immediate freeze and a restart of my MacBook. I then experimented with the number of threads and discovered that the application did not trigger a restart when running 9,945 threads in the first attempt. However, when I started the compiled application from the command line, I observed inconsistent behavior. Sometimes, I could run the code two or three times in a row without any issues, but eventually, the system would restart without exception.

I’ve been using my MacBook Pro M3 Max for over eight months, but I’m beginning to see its limitations and shortcomings.

Problems Encountered (so far):

Compatibility Issues:

I recently purchased an RTX 4090 eGPU (Gigabyte Gaming Box with RTX 4090) for CUDA programming, only to find that it is entirely incompatible with MacBooks that use Apple Silicon processors. Parallels Desktop does not support having an eGPU attached to the Thunderbolt port, which forced me to buy a Windows 11 desktop machine (Asus ROG Maximus Dark Hero Z790, Intel Core i9–14900K CPU with water cooling, 92 GB DDR5 6400 MHz RAM, 2 TB M.2 SSD Samsung Evo 990, Asus TUF G502, ca. 2500 EUR). I use Synergy to avoid cluttering my desk with extra mice and keyboards.

Thunderbolt 4 Incompatibility:

There is no straightforward Thunderbolt 4 connection between Windows 11 and the MacBook Pro. Recently, I found a paid application that might address this, but so far, there is no free and simple solution to my knowledge.

MacOS Sonoma Instability:

My simple C++ code consistently crashes MacOS Sonoma, leading to an instant system restart.