Syscall overhead

前端 未结 2 1118
终归单人心
终归单人心 2021-01-03 00:43

How big is (approximately) an I/O syscall overhead on Linux from C program, I mean how bad is running e.g. many small read / write operations compa

2条回答
  •  悲哀的现实
    2021-01-03 00:49

    You can measure this yourself. Just open /dev/zero and do some reading and writing while measuring the time. Also vary the number of bytes you put into each call - e.g. 1 bytes, 2 bytes, 128 bytes, .. 4096bytes. Also take care to use the read(2) and write(2) syscalls and not anything using internal buffers.

提交回复
热议问题