JavaのConcurrentHashMapのソースコードを調べていたところ、次のコード行が見つかりました。
/*
* The maximum number of times to tryLock in a prescan before possibly blocking on acquire in
* preparation for a locked segment operation. On multiprocessors, using a bounded number of
* retries maintains cache acquired while locating nodes.
*/
static final int MAX_SCAN_RETRIES =
Runtime.getRuntime().availableProcessors() > 1 ? 64 : 1
はMAX_SCAN_RETRIES
、ロックの取得中にエントリを検索する際に使用されます。私の質問は64
、マルチプロセッサマシンの数はどのように決定されるのですか?数の背後にある理論を知っている人はい64
ますか?