<frankeh@watson.ibm.com>   02-08-2002

RESULTS:
========

Following are a few results to demonstrate potential improvements
that can be achieved with fast user mode synchronization.

Executed on a 2-way P-III 1GHZ 512MB system.  The ulockflex was
calibrated upfront using <ulockflex -C> and resulted in 499 that we
reused in all runs to avoid individual calibration in each test run.



ulockflex -t 5 -c 2 -a 1 -r 0 -x 10 -o 5 -m -1 -R 499 -T 

-t #    execute each iteration for 5 seconds
-c #    number of children (threads or processes, see -T flag)
-a #    1 locks
-r #    mean time tasks executes not holding the lock in usecs
-x #    mean time tasks executes holding the lock in usecs
-T      tasks are threads instead of processes.
-s #    % of lock requests that are read (defines usage rwlocks) 
-p #    usecs to try to acquire lock in userspace before falling back to kern
        (defines usage of spin_semaphores)

WC:  contention on the write lock (semaphore or rwlock write)
RC:  contention on the read lock (valid only for rwlocks, 0 otherwise)
SS:  percentage of contended lock call that succeedd during spinning 
                      (valid only in spinning, 0 otherwise )
X :  u = user level locks   k = SysV locks.
i:   iterations performed (all should be 1 since we didn't look for 
                           statistical significance)

Four scenarios are studied for various configurations
-----------------------------------------------------
a) regular semaphores (non spinning) using kernel SysV locks
b) regular semaphores (non spinning) using fast user locking
c) regular semaphores using fast user locking and zero spin time
d) regular semaphores using fast user locking and 3 usecs spin time

2-CHIDLREN ANALYSIS

(A) Fully contended case compare ulocks with sysv. r=0 x=10
   c  a  t  i X   r   x   s   p    WC      RC     SS   Througput
a) 2  1  5  1 k   0  10  -1  -1   99.98   0.00   0.00    72645
b) 2  1  5  1 u   0  10  -1  -1   99.98   0.00   0.00    73607
c) 2  1  5  1 u   0  10  -1   0   99.98   0.00   0.00    72439
d) 2  1  5  1 u   0  10  -1   3   99.43   0.00   1.57    55897

virtually no difference in worst case scenario of ulocks (u) vs SysV (k).
However spinning > 0 drops performance (obviously).

 
(B) Less contended case r=7 x=3

a) 2  1  5  1 k   7   3  -1  -1   39.92   0.00   0.00   109409
b) 2  1  5  1 u   7   3  -1  -1   34.61   0.00   0.00   129236
c) 2  1  5  1 u   7   3  -1   0   34.00   0.00   4.10   130494
d) 2  1  5  1 u   7   3  -1   3   24.29   0.00  31.86   155332

(b..d) ulocks has lower contention. 
Spinning for the mean lock hold time results even with 0-spin time improves 
a bit. Due to the slightly longer code path 7.3% of the contention could be
resolved without calling the kernel. Spinning for mean lock hold time
gives the biggest booth, with lock contention down to 23.5% and 30% of the
contended lock request can be resolved through spinning without calling the 
kernel.

(C) Barely contention case r=10 x=0

a) 2  1  5  1 k  10   0  -1  -1    8.99   0.00   0.00   143489
b) 2  1  5  1 u  10   0  -1  -1    2.24   0.00   0.00   175375
c) 2  1  5  1 u  10   0  -1   0    3.51   0.00   2.25   175849
d) 2  1  5  1 u  10   0  -1   3    3.42   0.00   3.53   176413


3-CHIDLREN ANALYSIS

(A) Fully contended case compare ulocks with sysv. r=0 x=10
   c  a  t  i X   r   x   s   p    WC    RC   SS   Througput
a) 3  1  5  1 k   0  10  -1  -1   99.99   0.00   0.00    72458
b) 3  1  5  1 u   0  10  -1  -1   99.99   0.00   0.00    69947
c) 3  1  5  1 u   0  10  -1   0  100.00   0.00   0.00    69150
d) 3  1  5  1 u   0  10  -1   3   99.94   0.00   0.00    48554

same analysis as for 2 children: don't spin under 100% contention.

(B) Less contended case r=10 x=3

a) 3  1  5  1 k   7   3  -1  -1   88.31   0.00   0.00    96622
b) 3  1  5  1 u   7   3  -1  -1   82.73   0.00   0.00   113941
c) 3  1  5  1 u   7   3  -1   0   80.36   0.00   3.93   111727
d) 3  1  5  1 u   7   3  -1   3   35.18   0.00  31.22   143245

(C) Barely contention case r=10 x=0

a) 3  1  5  1 k  10   0  -1  -1   51.72   0.00   0.00   141689
b) 3  1  5  1 u  10   0  -1  -1   52.72   0.00   0.00   162812
c) 3  1  5  1 u  10   0  -1   0   49.09   0.00   2.25   162169
d) 3  1  5  1 u  10   0  -1   3    3.75   0.00   3.53   176109

And here some scalability numbers with respect to #processes and #locks
-----------------------------------------------------------------------

32 processes, 1 lock "-c 32 -a 1 -r 128 -x 3"

    c  a  t  i X   r   x   s   p    WC      RC     SS   Througput
a) 32  1  5  1 k 128   3  -1  -1  100.00   0.00   0.00    13754
b) 32  1  5  1 u 128   3  -1  -1   99.65   0.00   0.00    14899
c) 32  1  5  1 u 128   3  -1   0   99.94   0.00   2.27    14901
d) 32  1  5  1 u 128   3  -1   3   96.17   0.00   2.27    14432

32 processes, 8 locks "-c 32 -a 8 -r 16 -x 2"

a) 32  8  5  1 k  16   2  -1  -1   42.61   0.00   0.00    96597
b) 32  8  5  1 u  16   2  -1  -1   52.64   0.00   0.00   102059
c) 32  8  5  1 u  16   2  -1   0   49.40   0.00   0.02   102085
d) 32  8  5  1 u  16   2  -1   3   18.40   0.00   3.15   100762

32 processes, 16 locks "-c 32 -a 16 -r 2 -x 2"

a) 32 16  5  1 k   2   2  -1  -1   30.74   0.00   0.00   293017
b) 32 16  5  1 u   2   2  -1  -1   31.08   0.00   0.00   384886
c) 32 16  5  1 u   2   2  -1   0   27.24   0.00   0.00   387015
d) 32 16  5  1 u   2   2  -1   2   16.05   0.00   0.14   369594


Multiple reader/single writer locks (or shared locks) ..
====================================================================
    c  a  t  i X   r   x   s   p    WC      RC     SS   Througput
    2  1  5  1 u   0  10   0  -1   99.06   0.00   0.00    73086
    2  1  5  1 u   0  10  20  -1   99.30  79.76   0.00    68318
    2  1  5  1 u   0  10  40  -1   97.74  59.81   0.00    70683
    2  1  5  1 u   0  10  60  -1   95.85  39.83   0.00    81128
    2  1  5  1 u   0  10  80  -1   93.67  19.96   0.00   106834
    2  1  5  1 u   0  10  90  -1   92.88   9.94   0.00   132486
    2  1  5  1 u   0  10  99  -1   92.66   1.00   0.00   173100  
    2  1  5  1 u   0  10 100  -1    0.00   0.00   0.00   179485

    2  1  5  1 u  10   0   0  -1    1.33   0.00   0.00   172098
    2  1  5  1 u  10   0  20  -1    1.23   1.21   0.00   172994
    2  1  5  1 u  10   0  40  -1    1.17   0.99   0.00   174654
    2  1  5  1 u  10   0  60  -1    1.04   0.67   0.00   176651
    2  1  5  1 u  10   0  80  -1    0.95   0.33   0.00   178725 
    2  1  5  1 u  10   0  90  -1    0.85   0.18   0.00   180020
    2  1  5  1 u  10   0  99  -1    0.85   0.02   0.00   182001
    2  1  5  1 u  10   0 100  -1    0.00   0.00   0.00   182114

In a fully contended lock we see how the share percentage from 0-100%
read accesses increases the overall throughput. In a completely
uncontended case the differences are marginable.

====================================================================








