ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Linux-AIO/README
(Generate patch)

Comparing Linux-AIO/README (file contents):
Revision 1.1 by root, Tue Mar 8 20:19:00 2005 UTC vs.
Revision 1.3 by root, Sat Jul 9 04:11:30 2005 UTC

3 3
4SYNOPSIS 4SYNOPSIS
5 use Linux::AIO; 5 use Linux::AIO;
6 6
7DESCRIPTION 7DESCRIPTION
8 This module implements asynchronous i/o using the means available to 8 This module implements asynchronous I/O using the means available to
9 linux - clone. It does not hook into the POSIX aio_* functions because 9 Linux - clone. It does not hook into the POSIX aio_* functions because
10 linux does not yet support these in the kernel (and even if, it would 10 Linux does not yet support these in the kernel (even as of 2.6.12, only
11 only allow aio_read and write, not open and stat). 11 O_DIRECT files are supported) and even if, it would only allow aio_read
12 and write, not open, stat and so on.
12 13
13 Instead, in this module a number of (non-posix) threads are started that 14 Instead, in this module a number of (non-posix) threads are started that
14 execute your read/writes and signal their completion. You don't need 15 execute your read/writes and signal their completion. You don't need
15 thread support in your libc or perl, and the threads created by this 16 thread support in your libc or perl, and the threads created by this
16 module will not be visible to the pthreads library. 17 module will not be visible to the pthreads library.
17 18
18 NOTICE: the threads created by this module will automatically be killed 19 NOTICE: the threads created by this module will automatically be killed
19 when the thread calling min_parallel exits. Make sure you only ever call 20 when the thread calling min_parallel exits. Make sure you only ever call
20 min_parallel from the same thread that loaded this module. 21 min_parallel from the same thread that loaded this module.
21 22
22 Although the module will work with threads, it is not reentrant, so use 23 Although the module will work with in the presence of other threads, it
23 appropriate locking yourself. 24 is not reentrant, so use appropriate locking yourself.
24 25
25 Linux::AIO::min_parallel $nthreads 26 Linux::AIO::min_parallel $nthreads
26 Set the minimum number of AIO threads to $nthreads. The default is 27 Set the minimum number of AIO threads to $nthreads. The default is
27 1, which means a single asynchronous operation can be done at one 28 1, which means a single asynchronous operation can be done at one
28 time (the number of outstanding operations, however, is unlimited). 29 time (the number of outstanding operations, however, is unlimited).
29 30
30 It is recommended to keep the number of threads low, as many linux 31 It is recommended to keep the number of threads low, as some linux
31 kernel versions will scale negatively with the number of threads 32 kernel versions will scale negatively with the number of threads
32 (higher parallelity => MUCH higher latency). 33 (higher parallelity => MUCH higher latency).
34
35 Linux::AIO::max_parallel $nthreads
36 Sets the maximum number of AIO threads to $nthreads. If more than
37 the specified number of threads are currently running, kill them.
38 This function blocks until the limit is reached.
39
40 This module automatically runs "max_parallel 0" at program end, to
41 ensure that all threads are killed and that there are no outstanding
42 requests.
33 43
34 $fileno = Linux::AIO::poll_fileno 44 $fileno = Linux::AIO::poll_fileno
35 Return the *request result pipe filehandle*. This filehandle must be 45 Return the *request result pipe filehandle*. This filehandle must be
36 polled for reading by some mechanism outside this module (e.g. Event 46 polled for reading by some mechanism outside this module (e.g. Event
37 or select, see below). If the pipe becomes readable you have to call 47 or select, see below). If the pipe becomes readable you have to call
45 You can use Event to multiplex, e.g.: 55 You can use Event to multiplex, e.g.:
46 56
47 Event->io (fd => Linux::AIO::poll_fileno, 57 Event->io (fd => Linux::AIO::poll_fileno,
48 poll => 'r', async => 1, 58 poll => 'r', async => 1,
49 cb => \&Linux::AIO::poll_cb ); 59 cb => \&Linux::AIO::poll_cb );
60
61 Linux::AIO::poll_wait
62 Wait till the result filehandle becomes ready for reading (simply
63 does a select on the filehandle. This is useful if you want to
64 synchronously wait for some requests to finish).
50 65
51 Linux::AIO::nreqs 66 Linux::AIO::nreqs
52 Returns the number of requests currently outstanding. 67 Returns the number of requests currently outstanding.
53 68
54 aio_open $pathname, $flags, $mode, $callback 69 aio_open $pathname, $flags, $mode, $callback

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines