I'm trying to write a program in C++ which writes characters into a file from 100 chars up to 120.000.000 chars in Linux. Would it be faster if I would try to use multithreading and if yes could you give me some advice some links to useful sites maybe some small examples.

thanks in advance

Recommended Answers

All 8 Replies

Unless your application could write to multiple files at once, I suspect that multiple threads won't be much help. It would be hard to get different threads to write to different parts of the same file where the parts don't even really exist yet.

Actually, even with threading, the hard-drive can still only do one thing at a time. So, you'll likely have one thread blocking on the HD to finish the write from the previous thread before the second thread even gets a chance to do anything.

Actually, even with threading, the hard-drive can still only do one thing at a time.

Just out of curiosity: Would this also be true for 2 HD's in RAID 0?

Just out of curiosity: Would this also be true for 2 HD's in RAID 0?

absolutely not.... 2 HD's in RAID 0 :)

what does RAID 0 mean ?

what does RAID 0 mean ?

Click

absolutely not.... 2 HD's in RAID 0 :)

I was just wondering if the HD-controller or the HD was blocking the line :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.