almost completed semaphore implementation. will continue it when thread_yield is ready.