This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
Hi All, I need to copy a lot of files form a network location to a local machine. Aroung 500 MB. Initially I tried to improve the performance using buffering, it worked unfortunately it did not help much when buffering went beyond 10000 bytes.
Then I decided to use threads to import different files parallely to futher improve performance. However it seems to have an opposite effect and it now takes more time.
So does threading really help in case of I/O operations?
ps: can any one suggest other ways to improve I/O performance.
Edited to add: I am using java 1.3 Regards, Rajagopal [ June 22, 2005: Message edited by: Rajagopal Manohar ]
Threading can help if your problem involves both IO and computation since the computation thread can work while the IO thread is waiting for the operating system to provide the next buffer read. With dual-core or dual-processor systems this can be significant. Reading and writing binary data will be MUCH faster than trying to work with character streams - so don't use Reader and Writer classes. Buffers should be some multiple of the operating system file blocks size. If you can contrive to execute the operating system copy with Runtime.exec it will save the time involved in moving data between operating system buffers and Java program buffers at the expense of setting up the extra process. Bill
If you can contrive to execute the operating system copy with Runtime.exec it will save the time involved in moving data between operating system buffers and Java program buffers at the expense of setting up the extra process.