I am planning to do my Masters project on Java multithreading and I am looking for some project ideas.I have one idea where I am planning to use the sourceforge JExcel API(this library manipulates Excel) to speed up the excel sheets manipualtion by introducing threads while using the JExcel API to read/write excel .I am kinda stuck now because I dont know how to go about this.
I am not sure if I am going in the right track..Ok so this is my first appraoch:
1) I want to read multiple worksheets(independent of each other) in an excel file concurrently,so that the excel file opens more quickly.
Sify, I'm not expert in Threads. and I haven't worked with JExcel. the whole of the work can be like this that, create 3 or n thread (according to your files) with a controller(main) thread and start them(main starts other), and then it's dependence on your business that how do you want combine these files, row by row? sheet by sheet? (i.e. row by row.), the main thread reads a row of each thread an put it in the target file. I think you have to synchronize threads, and communicate with them with wait() and notify() guys. anyway Threading guys would help you better.
Just pointing out the obvious, apologies if you already know this.... reading a file is an I/O bound operation. This means that for most of the operation, the CPU is not doing anything, as it is waiting for the hard disk to fetch the file data. Also, the hard disk sits on a bus, which is used to transfer the data from drive to memory -- and in most cases, this is not even done by the CPU -- it is done by the DMA processor.
So... you do know that unless the files are on separate disks, and likely on separate controllers, it is very unlikely that you will get any speed up via adding more threads, right?
Maybe perceived performance is the intended goal, though?
If the idea is to display the contents of the workbook to a user it might make sense to just load the first (few) worksheet(s) and let the user interact with that data, while a worker thread quietly proceeds to load the additional worksheets in the background. Stealthfully. Like a ninja.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Thank you Henry for the reply.
Yes,in my test data I was planning to have the files in different partitions. I had another question,if I wanted to compare the execution times both in single core and dual core,is there any way that I could use my dual core machine as a single core-Is setting all the processes(from task manager) affinity to core - 0 get the results ?