Messages in this thread | | | Date | Fri, 11 Jun 1999 03:45:53 +0200 (CEST) | From | Davide Libenzi <> | Subject | New semaphore __wake_up() implementation ... |
| |
Hi guys,
I've modified the "up" routine coded in file sched.c to get more speed and, IMVHO more correctness. Previous code in __wake_up() release all task that ( except one ) goes immediatly scheduled. Given:
N = Number of tasks in runqueue M = Number of tasks in semaphore queue L = The cost of linear scan of wait queue of semaphore W = The cost of a wakeup() operation S = The cost of a schedule() search of next to run
the total cost of a "up" operation is:
TCo = L + M * W + (M - 1) * S
My new implementation release only the best suitable process to run, resulting in a cost:
TCn = L + W
The new code linear scan the semaphore queue list and pick the best task to wakeup ( in a goodness sense ). If the process counters is exhausted ( it happens very rarely ) I've 2 way to follow: 1) Do a recalculate loop inside __wake_up() 2) Leave this case to fall into the previous implementation and releasing all tasks
I choose 2 to leave process counter recharging inside the schedule() function.
Tomorrow I'll post to linux-kernel my patch as long as a test program and speed results.
Cheers, Davide.
-- "Debian, the Freedom in Freedom."
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |