a cache line allocation method , wherein the cache is coupled to a graphic processing unit and the cache comprising a plurality of cache lines , each cache line stores one of a plurality of instructions the method comprising the steps of : putting the plurality of instructions in whole cache lines ; locking the whole cache lines if an instruction size is less than a cache size ; locking a first number of cache lines when the instruction size is larger than the cache size and a difference between the instruction size and the cache size is less than or equal to a threshold ; and locking a second number of cache lines when the instruction size is larger than the cache size and a difference between the instruction size and the cache size is large than the threshold ; wherein the first number is greater than the second number .