Thursday, December 6, 2012

Decibel scale

Reference : https://ccrma.stanford.edu/~jos/st/Properties_DB_Scales.html
https://ccrma.stanford.edu/~jos/st/Decibels.html 

A decibel (abbreviated dB) is defined as one tenth of a bel.

The bel is an amplitude unit defined for sound as the log (base 10) of the intensity relative to some reference intensity, i.e., 

\begin{displaymath}
\mbox{Amplitude\_in\_bels} = \log_{10}\left(\frac{\mbox{Signal\_Intensity}}{\mbox{Reference\_Intensity}}\right)
\end{displaymath}     


The choice of reference intensity (or power) defines the particular choice of dB scale. Signal intensity, power, and energy are always proportional to the square of the signal amplitude. Thus, we can always translate these energy-related measures into squared amplitude:

\begin{displaymath}
\mbox{Amplitude\_in\_bels} =
\log_{10}\left(\frac{\mbox{Amp...
...ft\vert\mbox{Amplitude}_{\mbox{\small ref}}\right\vert}\right)
\end{displaymath}  

Since there are 10 decibels to a bel, we also have 
\begin{eqnarray*}
\mbox{Amplitude}_{\mbox{\small dB}} &=&
20\log_{10}\left(\fra...
...t(\frac{\mbox{Energy}}{\mbox{Energy}_{\mbox{\small ref}}}\right)
\end{eqnarray*} 
In every kind of dB, a factor of 10 in amplitude increase corresponds to a 20 dB boost (increase by 20 dB):

$\displaystyle 20\log_{10}\left(\frac{10 \cdot A}{A_{\mbox{\small ref}}}\right)
...
...)}_{\mbox{$20$\ dB}} + 20\log_{10}\left(\frac{A}{A_{\mbox{\small ref}}}\right)
$

A function $ f(x)$ which is proportional to $ 1/x$ is said to ``fall off'' (or ``roll off'') at the rate of $ 20$ dB per decade. That is, for every factor of $ 10$ in $ x$ (every ``decade''), the amplitude drops $ 20$ dB.   


Similarly, a factor of 2 in amplitude gain corresponds to a 6 dB boost:
$\displaystyle 20\log_{10}\left(\frac{2 \cdot A}{A_{\mbox{\small ref}}}\right)
=...
...2)}_{\mbox{$6$\ dB}}
+ 20\log_{10}\left(\frac{A}{A_{\mbox{\small ref}}}\right)
$
and

$\displaystyle 20\log_{10}(2) = 6.0205999\ldots \approx 6 \;$   dB$\displaystyle . \protect$ 
A function $ f(x)$ which is proportional to $ 1/x$ is said to fall off $ 6$ dB per octave. That is, for every factor of $ 2$ in $ x$ (every ``octave''), the amplitude drops close to $ 6$ dB. Thus, 6 dB per octave is the same thing as 20 dB per decade.  


A doubling of power corresponds to a 3 dB boost:
$\displaystyle 10\log_{10}\left(\frac{2 \cdot A^2}{A^2_{\mbox{\small ref}}}\righ...
...{\mbox{$3$\ dB}}
+ 10\log_{10}\left(\frac{A^2}{A^2_{\mbox{\small ref}}}\right)
$
and 

$\displaystyle 10\log_{10}(2) = 3.010\ldots \approx 3\;$dB$\displaystyle . \protect$ 


dB/Octave & dB/Decade

An Octave is where the frequency halves or doubles (by a factor of 2) i.e. 400Hz to 800 Hz 

A Decade is where the frequency increases or decreases by a factor of 10 i.e. 5 Hz to 50 Hz 

Slopes can be defined as dB/Octave or dB/Decade

20dB/decade ≈ 6.0205999132796 dB/octave 

There are 3.3 octaves in one decade .. in other words 

6dB/octave is equivalent to 20 dB/decade
 \text{number of octaves} = \log_2\left(\frac{13}{4}\right) = 1.7          

number of decades \log_{10} (150000/15) = 4


Tuesday, December 4, 2012

Finding maximum possible I/O rate on a disk


You can compute the maximum possible sequential I/O rate.  It's easy:  Look at how many blocks are in one track and how long it takes the disk  to make one revolution (at 7200 RPM) then you will know how many bits  per second fly under the read/write head.  This places an upper bound on the sustained I/O rate.

Generally the XFS file systems gives fastest result.

To make faster read operations, make a separate partition on your drive, possibly at the beginning of the drive (as the beginning of the drive is faster)





Zero copy mechanism

"Zero-copy" describes computer operations in which the CPU does not perform the task of copying data from one memory area to another saving significant processing power and memory. It also saves the time consuming mode switches between user space and kernel space.




Zero-copy protocols are especially important for high-speed networks in which the capacity of a network link approaches or exceeds the CPU's processing capacity. In such a case the CPU spends nearly all of its time copying transferred data, and thus becomes a bottleneck which limits the communication rate to below the link's capacity.

Techniques for creating zero-copy software include the use of DMA-based copying and memory-mapping through an MMU.


Several operating systems support zero-copying of files through specific APIs foe example Windows.
Linux supports zero copy through system calls such as sys/socket.h's sendfile, sendfile64, and splice.

The information above has been taken from Wikipedia.