1. A method for memory allocation for a multithreaded processor, comprising: obtaining threads; creating sets from the threads according to thread type; and allocating memory space for each thread in a set responsive to the thread type of the set.