A method for supporting queue processing in a computing environment, comprising: associating a thread with a queue in the computing environment, wherein the thread runs on one or more microprocessors that support at least one central processing unit; using the thread to process one or more tasks when said one or more tasks arrive at the queue; and adaptively configuring the thread to be in one of a sleep state and an idle state, when there is no task in the queue; wherein when a thread is in the idle state, the thread is allowed to spin said CPU, and when a thread is in the sleep state, said CPU is allowed to switch to another thread, the thread being awakened from the sleep state when a task arrives at the queue; and wherein adaptively configuring the thread to be in one of a sleep state and an idle state comprises: obtaining a total cost for putting the thread in the sleep state and awakening the thread from the sleep state, based on an operating system function; obtaining a cost for putting the thread in the idle state based on a workload on the queue; comparing the total cost for putting the thread in the sleep state and waking the thread up from the sleep state with the cost for putting the thread in the idle state; and configuring the thread to be in a sleep state if the total cost for putting the thread in the sleep state is smaller than the cost for putting the thread in the idle state, and otherwise configuring the thread to be in an idle state. associating a thread with a queue in the computing environment, wherein the thread runs on one or more microprocessors that support at least one central processing unit; using the thread to process one or more tasks when said one or more tasks arrive at the queue; and adaptively configuring the thread to be in one of a sleep state and an idle state, when there is no task in the queue; wherein when a thread is in the idle state, the thread is allowed to spin said CPU, and when a thread is in the sleep state, said CPU is allowed to switch to another thread, the thread being awakened from the sleep state when a task arrives at the queue; and wherein adaptively configuring the thread to be in one of a sleep state and an idle state comprises: obtaining a total cost for putting the thread in the sleep state and awakening the thread from the sleep state, based on an operating system function; obtaining a cost for putting the thread in the idle state based on a workload on the queue; comparing the total cost for putting the thread in the sleep state and waking the thread up from the sleep state with the cost for putting the thread in the idle state; and configuring the thread to be in a sleep state if the total cost for putting the thread in the sleep state is smaller than the cost for putting the thread in the idle state, and otherwise configuring the thread to be in an idle state. obtaining a total cost for putting the thread in the sleep state and awakening the thread from the sleep state, based on an operating system function; obtaining a cost for putting the thread in the idle state based on a workload on the queue; comparing the total cost for putting the thread in the sleep state and waking the thread up from the sleep state with the cost for putting the thread in the idle state; and configuring the thread to be in a sleep state if the total cost for putting the thread in the sleep state is smaller than the cost for putting the thread in the idle state, and otherwise configuring the thread to be in an idle state.