Linux File IO - multithreading performance - write to different files

I am currently working on a sound recording application that extracts up to 8 audio streams from a network and saves data to disk (simplified;)). Right now, each thread is processed by one thread -> the same thread also saves to disk.

This means that I received 8 different streams that write to one disk, each of which is in a different file.

Do you think there will be an increase in I / O performance on disk if all the written work is performed by one common thread (which will sequentially write data to certain files)?

OS is embedded Linux, “drive” is a CF card, application is written in C.

Thanks for your ideas Nick

+5
source share
3 answers

Short answer: given that you are writing to a Flash drive, I would not expect the number of threads to make a big difference anyway. But if that mattered, I would expect multiple threads to be faster than one thread, not slower.

Longer answer:

I wrote a similar program to what you described about 6 years ago - it ran on the built-in PowerPC Linux card and read / wrote several simultaneous audio files to the SCSI hard drive. I originally wrote it using a single thread doing I / O, because I thought this would give better throughput, but it turned out that it wasn’t.

, /, SCSI -, . , -IO SCSI "" - , , . , , .

, SCSI , , - , / , -. - .

, - -, - . - 1 N, . , , , .

+3

linux, , /. -. , Linux- , ( ) , - .

1 , -. , , . , .

0

, , , . < >   , , ​​ CF, pdflush-, , udp, - , cpu , udp , fdatasync() , .

0

All Articles