1
CS644 week 9:
Advanced I/O
Problem – I want to do lots of I/O at once
2
Problem – I want to do lots of I/O at once
(not disk I/O)
3
Example: Web server with many clients
4
Problem – I want to do lots of I/O at once
Example: SSH client
(reading/writing from terminal and network socket)
5
Problem – I want to do lots of I/O at once
Solution: multithreading
6
Problem – I want to do lots of I/O at once
Solution: multithreading
…but that complicates your program
7
Problem – I want to do lots of I/O at once
O_NONBLOCK – non-blocking reads/writes
8
Problem – I want to do lots of I/O at once
O_NONBLOCK – non-blocking reads/writes
…but leads to busy polling, wastes CPU
9
Problem – I want to do lots of I/O at once
epoll – I/O multiplexing
10
Problem – I want to do lots of I/O at once
epoll – I/O multiplexing
Tell the OS you want to read fd1, fd2, …, then block until one is ready
11
Problem – I want to do lots of I/O at once
io_uring – modern I/O multiplexing
12
Problem – I want to do lots of I/O at once
io_uring – modern I/O multiplexing
13
Problem – I want to do lots of I/O at once
io_uring – modern I/O multiplexing
14
Problem – I want to do lots of I/O at once
io_uring – modern I/O multiplexing
15
Problem – I want to do lots of I/O at once
Office hours
16