From: matt m. <ma...@cs...> - 2003-01-27 18:13:01
|
guys i thought i'd surface to tell you what i've been working on lately. when i started writing the service frontend code, i realized that i needed to do a serious rewrite the job scheduler. my assumption before was that only two threads accessed the data queue: threads to schedule jobs and the thread to run the jobs. well when we add the frontend piece to the puzzle.. we could have many threads wanting to read the queue. that's not a good design. we want requests to pull data from the queue to have a minimal impact on the collection of data. i also realized that i could make the queue much more efficient if i sent a condition signal when there is a new highest priority and not evertime a new item is added to the queue (the new item is not important to worry about if i'm sitting on the highest priority item). the solution is to build a read-write locking mechanism. we had a read-write mechanism in ganglia 2 but it was too simple to handle the demands of the job queues (still a possibility of reader/writer starvation and no way to ensure locks are handled in the order they are requested). if you take a look at rwlocks.c (and fifo.c), you'll see that we now have first-come first-serving read write locks as part of the g3 library. i've tested them on Linux, Cygwin, FreeBSD, Solaris and MacOS X and they work great (i also ran them through mpatrol to check for memory leaks). i think these locks will be very portable. these locks will be at the heart of the scheduler and the data structures for collecting published data. btw, to give credit where credit due.. read-write lock code is based on the work of Shlomi Fish at http://vipe.technion.ac.il/~schlomif/rwlock/ which he released into the public domain. i'll add this api to the documentation in ./docs soon. i'll start on rewriting the scheduler now and get back wicha all soon. i suspect it won't take long before you hear from me again. you can get a snapshot of the latest code at http://matt-massie.com/g3/ or cvs update your g3 cvs module. -- matt |