I have on my desk a machine that would be an equivalent of a large datacenter two decades ago and then sometimes it is barely able to keep up with me pressing keys on the keyboard. I think the next major step will be for the humanity to learn make software more efficient and effective rather than throw more CPU cycles at the problem.
24-core CPU and I can’t type an email – part two
11–20 of 101 posts
Re: 24-core CPU and I can’t type an email – part two
#12I have on my desk a machine that would be an equivalent of a large datacenter two decades ago and then sometimes it is barely able to keep up with me pressing keys on the keyboard. I think the next major step will be for the humanity to learn make software more efficient and effective rather than throw more CPU cycles at the problem.
Re: 24-core CPU and I can’t type an email – part two
#13 void
do_work(the_work_t *w)
{
/* for simplicity here, rather than e.g. w->contenders */
static _Atomic int contenders = 0;
contenders++;
for ( ; work_remaining(w); ) {
take_mutex(w->m);
do_some_work(w);
drop_mutex(w->m);
if (contenders > 1)
reschedule_this_thread();
}
contenders--;
}
This depends on the OS providing a cheap and fast reschedule_this_thread() mechanism that effectively guarantees that if there is only one other contending thread with work, that thread will end up holding the mutex. (If there are multiple such threads, an arbitrary one of them will end up with the mutex, rather than the thread that just dropped the mutex.)One could of course only check for other contenders every few times through the for loop if reschedule_this_thread() is expensive or slow, or if contenders is especially hot.
contenders is explicitly not a locking mechanism and should not influence the policy of any code running while the mutex is held. It should also be a per-mutex counter.
Re: 24-core CPU and I can’t type an email – part two
#14I have on my desk a machine that would be an equivalent of a large datacenter two decades ago and then sometimes it is barely able to keep up with me pressing keys on the keyboard. I think the next major step will be for the humanity to learn make software more efficient and effective rather than throw more CPU cycles at the problem.
In the last few years we switched from throwing more CPU cycles at the problem to throwing more CPUs at the (not necessarily parallelizable) problem.
Re: 24-core CPU and I can’t type an email – part two
#15I have on my desk a machine that would be an equivalent of a large datacenter two decades ago and then sometimes it is barely able to keep up with me pressing keys on the keyboard. I think the next major step will be for the humanity to learn make software more efficient and effective rather than throw more CPU cycles at the problem.
Re: 24-core CPU and I can’t type an email – part two
#16Would you expect 24 employees to write ONE email without 4 team leads and one department head?
Obviously NO!!
Your processors obviously need more management. I think Intel has the right offering for you, aka management engine.
Re: 24-core CPU and I can’t type an email – part two
#17I have on my desk a machine that would be an equivalent of a large datacenter two decades ago and then sometimes it is barely able to keep up with me pressing keys on the keyboard. I think the next major step will be for the humanity to learn make software more efficient and effective rather than throw more CPU cycles at the problem.
Re: 24-core CPU and I can’t type an email – part two
#18You should have asked your pointy haired boss. He could have explained the problem in much simpler terms. Would you expect 24 employees to write ONE email without 4 team leads and one department head? Obviously NO!! Your processors obviously need more management. I think Intel has the right offering for you, aka management engine.
Re: 24-core CPU and I can’t type an email – part two
#19> the lock was being acquired and released ~49,000 times and was held for, on average, less than one ms at a time. But for some reason, even though the lock was released 49,000 times the Chrome process was never able to acquire it. Well, locking is hard. > The good news is that even though there is occasional unfairness, there is unlikely to be persistent unfairness. In order for a thread to steal the lock, it needs…
Actually this is exactly because someone in Windows used the plain old mutex. I'd call that "your granddad's lock". It's old, crotchety, unfair and shouldn't be used in situations where any concurrency can be expected. This despite the kernel having a nice RCU mechanism inside as well as waitfree queues.
What alternatives do you suggest?
Re: 24-core CPU and I can’t type an email – part two
#20Earlier quoted context omitted.
In the last few years we switched from throwing more CPU cycles at the problem to throwing more CPUs at the (not necessarily parallelizable) problem.
Each of the 40 cores on my workstation runs at 3.5 GHz. I had a quick look and I found reference to Google using pentium 2 CPUs in their data centres in 1999. According to Wikipedia, they max out at 450MHz. So my workstation is 8 times faster per core, and has 40 more cores. It's hard to justify the differences really.
This article is from 2014 but hardly anything has changed.
https://www.comsol.com/blogs/havent-cpu-clock-speeds-increas...
https://superuser.com/questions/543702/why-are-newer-generat...