Article View: news.software.nntp
Article #19269Re: Diablo Q
From: Avi Freedman
Date: Mon, 14 Jul 1997 00:00
Date: Mon, 14 Jul 1997 00:00
51 lines
2356 bytes
2356 bytes
Matt Dillon (dillon@flea.best.net) wrote: : It depends heavily on how the code works. If you are doing an : exclusive lock to write a record: : : exclusive lock : append to cyclic file : unlcok : : Then you effectively single-thread that portion of the code. As : the number of processes build, it becomes more of a bottleneck : because any delay (e.g. buffer cache miss) whatsoever inside the : semaphore will block ALL the processes rather then just one. Hmm. I figure that it doesn't matter. With 20 or 30 (or only 5 or as many as 200) processes receiving news, only one stream of data can get to the disk at once anyway - and most of the wait is on the network, not the disk side. : There are ways around the problem. In diablo, I switched from an : exclusive file lock for append to a non-blocking record lock: : : /* : * Lock the append point. : */ : : off = lseek(HFd, 0L, 2); : : while (hflock(HFd, off, XLOCK_NB|XLOCK_EX) < 0) : off += sizeof(History); : : : (note: hflock a procedure in diablo/lib/lock.c that does a fcntl() : record lock). : : This is a cool algorithm, IMHO, because it is virtually guarenteed to : work efficiently no matter how many processes are trying to append to : the history file. The only problem with it is that you need to hold the : lock until you are sure no other process is holding an 'old' append : offset. Diablo is a bit inefficient in the way it checks at the moment, : but I'll clean it up in the next few releases. You can't just hold the : lock forever, that would create a mess inside the kernel. : : -Matt Interesting... Avi
Technical Details
Message-ID:
<5qbrsn$pb2@netaxs.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<5qaheh$d5u@netaxs.com> <5qb7g8$ql4$1@flea.best.net>Show Full Headers
Complete Article Headers
Message-ID: <5qbrsn$pb2@netaxs.com> Subject: Re: Diablo Q Date: Mon, 14 Jul 1997 00:00:00 +0000 From: freedman@netaxs.com (Avi Freedman) References: <5qaheh$d5u@netaxs.com> <5qb7g8$ql4$1@flea.best.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 256718622 Organization: Philadelphia's Complete Internet Provider Newsgroups: news.software.nntp