1. A method for assigning a task, the method comprising: calculating, by a computer, memory access rates, representing percentage of memory access, for respective tasks on basis of hardware monitor information obtained by monitoring operating states of hardware during execution of an application program, the tasks corresponding to respective syntax units specified in the application program; assigning, on basis of the calculated memory access rates, a first task to a first socket among sockets in a processor in response to an instruction for executing the first task, the first socket selected on basis of a first memory access rate calculated for the first task and second memory access rates calculated for second tasks already assigned to the first socket, and the first task assigned to the selected first socket when a total of the first memory access rate and the second memory access rates is less than a predetermined value; and continuing the monitoring of the operating states of the hardware during execution of the application program after said assigning.