patch applied (ghc-6.8/ghc): Move file locking into the RTS,
fixing #629, #1109
Ian Lynagh
igloo at earth.li
Sat Dec 1 17:52:18 EST 2007
Tue Nov 20 06:08:59 PST 2007 Simon Marlow <simonmar at microsoft.com>
* Move file locking into the RTS, fixing #629, #1109
File locking (of the Haskell 98 variety) was previously done using a
static table with linear search, which had two problems: the array had
a fixed size and was sometimes too small (#1109), and performance of
lockFile/unlockFile was suboptimal due to the linear search.
Also the algorithm failed to count readers as required by Haskell 98
(#629).
Now it's done using a hash table (provided by the RTS). Furthermore I
avoided the extra fstat() for every open file by passing the dev_t and
ino_t into lockFile. This and the improvements to the locking
algorithm result in a healthy 20% or so performance increase for
opening/closing files (see openFile008 test).
A ./includes/FileLock.h
M ./rts/Hash.c -6 +3
M ./rts/Hash.h +7
M ./rts/Linker.c +2
M ./rts/RtsStartup.c +11
A ./rts/posix/FileLock.c
More information about the Cvs-ghc
mailing list