I have two question , that I don't know which one is better and when?
1.do we have any time that prefer single core rather than multi-core?when all of the cores are the same as each other?
2.when we prefer using the kernel thread and when we prefer using the user thread? do we have any time which we prefer to use only the user thread?I mean when we prefer implementing our program using kernel level and when user level thread?
an example : I want to read some files from disk and do some operation on each of these files, which one is better to choose?
As long as the other cores don't actively violate any invariant of the (on a single core running) program, then there's theoretically no reason to choose single core over multi core. In practice, though, there are quite a few things one should consider:
Moreover, there are obviously non technical issues like cost and availability to be considered.
In general, user level threads seem to be more efficient than kernel level threads. So for e.g. parallel computation I'd recommend user level threads.
I want to read some files from disk and do some operation on each of these files, which one is better to choose?
The example you give could, on the other hand, require the use of kernel level threads: Reading files and other interactions with anything outside of the program usually involves issuing system calls. Many of them will be blocking system calls, blocking an entire kernel thread. This also means that all (if any) user level threads running on this kernel thread will be blocked.
Whether you can take advantage of the additional processing power a multi core system provides depends highly on the specific task at hand and to what grade it is parallelizable.