i would like to know if it is possible to explicitly declare which memory type (physical or virtual memory) should be used by the C# application for performing different actions? Let me explain it by an example:
Lets say, i have a file of about 100 or 200 MB in size. I need to parse this file, access and analyze its contents and perform operations on the file contents. Would it be possible for me to specifically store the entire file and the contents of it on Virtual Memory instead of physical memory?
If it is possible, then are there any side-effects/precautions that one should keep in mind?
The reason behind my question is that I often have to deal with such huge files or datasets (retrieved from databases) and perform operations on them, part of which need not occur sequentially or be synchronized. I want to improve the execution time and performance of the application by parallelizing the non sequential parts, if possible.
Generally you don't (and shouldn't need to) have any insight into how physical memory is managed. In Windows and hence in the CLR everything is virtual memory.
Unless you have a specific problem you should just pretend everything is physical memory.
You can depend on the operating system to intelligently determine what should be kept in physical memory and what can be swapped out. Swapping only occurs if there's memory pressure anyway, i.e. if you allocate more memory than is physically available.
Also, 100-200 MB isn't all that much nowadays.