An embodiment of the invention provides a method to minimize blocking
overhead in upcall based M.times.N threads. The method includes: setting
a limit for the number of outstanding unbound user threads that has
blocked and has invoked a blocking upcall mechanism on a particular
virtual processor at any point in time; after reaching the limit, if the
user threads still blocks, then temporarily disabling the upcall
mechanism for these user threads; and re-enabling the upcall mechanism
for the user threads during the next context switch time. In another
embodiment, an apparatus implemented in a computer to minimize blocking
overhead in upcall based M.times.N threads, includes: a virtual processor
configured to track the number of blocked unbound threads that are
blocked; and an M.times.N user space scheduler configured to disable a
block upcall handler and an unblock upcall handler for the blocked
unbound threads if the number of blocked unbound threads has reached a
limit value.