added test for starvation on semaphores. improved comments, moved things around to be clearer, added fwd decls