Slow file writing with 'fwrite' function in C-code...
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Slow file writing with 'fwrite' function in C-code...
First of all, I am not sure if this problem comes from the OS or Hardware or even my program.
Anyway, when I execute a simple C-code which is doing some processing and writes the results
into the hard disc, the program takes too much time to finish up the file writing. The file size is about 450MB. I am using 'fwrite' function which is normally working well in elsewhere but in our new computer ( workstation which has 4 CPUs and each is dure core), it shows really slow file writing. It take a couple of minitues to finish up the writing. Sometimes, when I slightly change my code (Definiely, other parts which is not related with this writing module), it is fast ( done within a few secs).
Any one has same problem ? or Any idea will be reall appreciated.
It depends on a lot of things. Without the code and without knowing what the background processes are, where and how you call the fwrite function, we can only guess as to why your code is slow.
Since by changing code in "other parts", you are able to speed up, it could be your "some processing" which is taking up time, may be rightly so too. I think you should post code, without which no one can point the exact problem.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.