﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
586	Dynamic setting of thread safety in memory management	Paul Price	David.Robbins@…	"Discussions at the IfA have resulted in a modified requirement on the thread
safety: we'd like to be able to turn it off.  The reason for this is that we
have found that some programs (specifically, those which are intensive on memory
allocation) are dramatically slowed by the mutex locking --- mutex operations
topped the charts of code profiles (around 25%!).  Because of this, we specify a
static boolean within the memory handling code that is to be tested before any
mutex operation is performed (we reason that the check is much less expensive
than the mutex operation, so it has negligible impact).  The default behaviour
is that mutex operations *are* performed, but they can be turned off by calling
psMemThreadSafety(false).

The section in the SDRS is below:


\subsubsection{Thread safety}

Locking a mutex is an expensive operation that can dramatically impact
the efficiency of a program for the worse.  When the user is not
concerned with multiple threads, this is a needless waste, and so we
specify that the thread safety in the memory management system may
be deactivated (and activated) dynamically.

\begin{prototype}
bool psMemThreadSafety(bool safe);
\end{prototype}

\code{psMemThreadSafety} shall turn on thread safety in the memory
management functions if \code{safe} is \code{true}, and deactivate all
mutex locking in the memory management functions if \code{safe} is
\code{false}.  The function shall return the previous value of the
thread safety.

Note that the default behaviour of the library shall be for the
locking to be performed."	enhancement	closed	high		sys	unspecified	minor	fixed		
