{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreiglalwoebqzczwj6rw7vcyij5st5ui7lx2gsqq6qrc3aahacdia5y",
    "uri": "at://did:plc:hqad6xwuzg7oqfmwylfkvqfm/app.bsky.feed.post/3mkp3c3cdp2y2"
  },
  "path": "/viewtopic.php?t=33382&p=273022#p273022",
  "publishedAt": "2026-04-30T06:48:22.000Z",
  "site": "http://forum.palemoon.org",
  "textContent": "> So we should probably just reserve threads so we aren't deadlocking the kernel. This is likely a subtlety of any threading model because I've seen the same kind of thing with pthreads on Linux.\n\nIf I understand correctly how this works, we add 4 to the number of physical (logical?) cores and get the number of threads for variable \"threadCount\".\n\n\nCODE:\n\n\n    static size_tThreadCountForCPUCount(size_t cpuCount){ // Create additional threads on top of the number of cores available, to // provide some excess capacity in case threads pause each other. static const uint32_t EXCESS_THREADS = 4; return cpuCount + EXCESS_THREADS;}\n\nThis calculation gives a disproportionate increase in threads to the number of cores. On a modern processor with 12 cores, we will get 33% (16 versus 12) more threads than cores, and on a processor with 4 cores, the increase in threads is 100% (8 versus 4). Maybe it’s worth using a different calculation principle, for example, doubling the number of threads per core?\n\n\nCODE:\n\n\n    static size_tThreadCountForCPUCount(size_t cpuCount){ // Create additional threads on top of the number of cores available, to // provide some excess capacity in case threads pause each other. static const uint32_t EXCESS_THREADS = 2; return cpuCount * EXCESS_THREADS;}\n\n* * *",
  "title": "Platform Development • Re: The browser hang with 0 CPU load.",
  "updatedAt": "2026-04-30T06:48:22.000Z"
}