A leaky-bucket style thread scheduler for scheduling concurrent execution
of multiple threads in a microprocessor is provided. The execution
pipeline notifies the scheduler when it has completed instructions. The
scheduler maintains a virtual water level for each thread and decreases
it each time the execution pipeline executes an instruction of the
thread. The scheduler includes an instruction execution rate for each
thread. The scheduler increases the virtual water level based on the
requested rate per a predetermined number of clock cycles. The scheduler
includes virtual water pressure parameters that define a set of virtual
water pressure ranges over the height of the virtual water bucket. When a
thread's virtual water level moves from one virtual water pressure range
to the next higher range, the scheduler increases the instruction issue
priority for the thread; conversely, when the level moves down, the
scheduler decreases the instruction issue priority for the thread.