1. An apparatus for preemptively blocking a malicious code by using selective virtualization, the apparatus comprising: a compulsory resource storage for selecting and storing in advance compulsory resources required for execution of a vulnerable program having an interface with an external source in a separate space; a modified resource generation unit for modifying a remaining resource other than the compulsory resources to generate a new modified resource when the vulnerable program accesses the remaining resource; and a resource control unit for performing an operating system (OS) level virtualization when the vulnerable program accesses one of the compulsory resources, and permitting the vulnerable program to access the modified resource when the vulnerable program accesses the remaining resource other than the compulsory resources.