Your SlideShare is downloading. ×
0
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
20111210 linux aio
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

20111210 linux aio

590

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
590
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Linux AIO [email_address]
  • 2. Agenda <ul><li>IO Models </li></ul><ul><li>POSIX AIO </li></ul><ul><li>Linux Native AIO </li></ul>
  • 3. IO Models
  • 4. Sync Blocking IO
  • 5. Sync Non-blocking IO
  • 6. Async Blocking IO
  • 7. Async Non-blocking IO
  • 8. POSIX AIO <ul><li>glibc implementation </li></ul><ul><li>Built on top of pthread </li></ul><ul><li>All user space </li></ul>
  • 9. POSIX AIO <ul><li>man 3 aio </li></ul><ul><li>aio_init(3), aio_cancel(3), aio_cancel64(3), aio_error(3), aio_error64(3), aio_fsync(3), aio_fsync64(3), aio_init(3), aio_read(3), aio_read64(3), aio_return(3), aio_return64(3), aio_suspend(3), aio_suspend64(3), aio_write(3), aio_write64(3) </li></ul>
  • 10. POSIX AIO <ul><li>__aio_enqueue_request </li></ul><ul><ul><li>if (nthreads < optim.aio_threads && idle_thread_count == 0) </li></ul></ul><ul><ul><li>aio_create_helper_thread (&thid, handle_fildes_io, newp) </li></ul></ul><ul><li>Queued operations: </li></ul><ul><ul><li>LIO_READ,LIO_WRITE,LIO_NOP </li></ul></ul><ul><ul><li>LIO_DSYNC, LIO_SYNC, LIO_READ64,LIO_WRITE64 </li></ul></ul>
  • 11. POSIX AIO <ul><li>handle_fildes_io </li></ul><ul><ul><li>pread/read </li></ul></ul><ul><ul><li>pwrite/write </li></ul></ul><ul><ul><li>fdatasync/fsync </li></ul></ul>
  • 12. POSIX AIO <ul><li>Example... </li></ul>
  • 13. Linux Native AIO <ul><li>Kernel space implementation </li></ul><ul><ul><li>Use workqueue to handle deferred left-overs </li></ul></ul><ul><li>Libaio wrappers </li></ul>
  • 14. Linux Native AIO <ul><li>Only support AIO-DIO </li></ul><ul><li>No AIO fsync/fdatasync </li></ul><ul><li>Not on sockets/pipes </li></ul>
  • 15. Supported Operations <ul><li>IO_CMD_PREAD, IO_CMD_PWRITE </li></ul><ul><li>IO_CMD_FSYNC, IO_CMD_FDSYNC </li></ul><ul><li>IO_CMD_POLL, IO_CMD_NOOP </li></ul><ul><li>IO_CMD_PREADV, IO_CMD_PWRITEV </li></ul>
  • 16. Syscall APIs <ul><li>int io_setup(int maxevents, io_context_t *ctxp); </li></ul><ul><li>int io_destroy(io_context_t ctx); </li></ul><ul><li>int io_submit(io_context_t ctx, long nr, struct iocb *ios[]); </li></ul><ul><li>int io_cancel(io_context_t ctx, struct iocb *iocb, struct io_event *evt); </li></ul><ul><li>int io_getevents(io_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout); </li></ul>
  • 17. Libaio wrappers <ul><li>int io_queue_init(int maxevents, io_context_t *ctxp); </li></ul><ul><li>int io_queue_release(io_context_t ctx); </li></ul><ul><li>int io_queue_run(io_context_t ctx); </li></ul><ul><li>io_prep_pread, io_prep_pwrite, io_set_callback </li></ul>
  • 18. Kernel Implementation <ul><li>io_submit() </li></ul><ul><ul><li>aio_setup_iocb() </li></ul></ul><ul><ul><li>aio_run_iocb() </li></ul></ul><ul><li>kiocb->ki_retry callback </li></ul><ul><li>aio_complete() </li></ul><ul><li>static struct workqueue_struct *aio_wq; </li></ul>
  • 19. Native AIO <ul><li>Example... </li></ul>
  • 20. Q & A?

×