From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Sat, 21 Sep 2013 22:55:06 -0400 To: 9fans@9fans.net Message-ID: <64cc61c082febe489ac3244473bb4ca4@brasstown.quanstro.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-zsqqltwbdhadqpzlvypphibita" Subject: [9fans] userspace semlocks Topicbox-Message-UUID: 80d6cc78-ead8-11e9-9d60-3106f5b1d025 This is a multi-part message in MIME format. --upas-zsqqltwbdhadqpzlvypphibita Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit when i measure chan send performance with the attached program with the semaphore locks that have been made the default for sources and with the old locks, the old locks surprisingly outperform the new ones by a large margin. the test is let O be the number of buffers in the channel, and M be the number of sending procs, then cycles is the number of machine cycles required to send 1<<21 messages per proc, and receive them on a single listener. on my machine, i get the following raw numbers (averaged over a few tries): new 1.84e9 cycles O=10 M=1 old 1.10e9 new 4.61e9 O=0 M=1 old 4.38e9 new 1.55e10 O=10 M=8 old 2.74e10 new 3.64e10 O=0 M=8 old 5.14e10 am i doing something fundamental wrong, or are the new locks substantially slower than the old ones? - erik --upas-zsqqltwbdhadqpzlvypphibita Content-Disposition: attachment; filename=chantest.c Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit #include #include #include enum { Ndflt = 1<<21, Mdflt = 1, Odflt = 10, }; N = Ndflt; M = Mdflt; O = Odflt; Channel *c, *endc; void sendthread(void*) { ulong i; for(i = 0; i < N; i++) sendul(c, i); threadexits(""); } void receivethread(void*) { int i; for(i = 0; i 0) usage(); t = -nsec(); c = chancreate(sizeof(ulong), O); endc = chancreate(sizeof(ulong), 0); proccreate(receivethread, nil, 4*1024); for(i = 0; i < M; i++) proccreate(sendthread, (void*)(uintptr)i, 4*1024); recvul(endc); t += nsec(); print("%lld\n", t); threadexits(""); } --upas-zsqqltwbdhadqpzlvypphibita--