Thursday, October 16, 2014

Changes 10/16/14

Ruby:

  • File in its current state
  • Today I worked on testing how the ThreadPool handled extreme conditions, such as a long list of tasks or a large number of threads.  The code I've written seems to handle these cases well.
  • When I started trying to implement #join_all and #kill_all methods for the thread pool, I ran into some difficulties
  • For #join_all, the intended behavior is for each thread to complete the current task, all the remaining tasks in the queue to be completed, and once these two conditions are met, for all the threads to stop.  However, since each thread is an infinite loop of checking whether there is anything to pop off the tasks queue, simply calling #join on each thread (the current implementation on line 31) will result in a deadlock because the none of the threads ever actually finish
  • I'm not sure how to remedy this.  It seems that calling #join_all should stop the queue from accepting new tasks, allow each thread to continue as normal, and once the queue is completely empty, allow all threads to finish but prevent them from looping back into the waiting state (waiting state would occur on line 12).  This is quite a complex behavior, and I will have to put some additional thought into how it should be implemented

Why I like programming:

  • Kevin asked me to write about why I like to program, in order to figure out what college and career paths might be good for me.
  • I enjoy programming because I love creating unique and interesting things.  Programming is really cool because your creations actually do something; they work to achieve a task that you as the writer and designer have set out to complete.  I enjoy the feeling of writing a section of a program so that it fulfills its obligations and is well designed.  I also like the problem solving aspect: programming would be boring if everything were easy.  However, I'm always worried that I will never figure out whatever problem I happen to be stuck on at the moment, and this feeling of hopelessness can take away from the enjoyment quite a bit.  One of the things that drives me away from the more mathematical side of programming is the difficulty I have understanding it.  If I were to focus on the mathematics behind algorithms, I would need a good teacher there to answer my questions.  I do get this type of help in Advanced Topics when I need it, and I would expect that college professors would be able and willing to help me if I take these types of classes in college.
  • Sorry if that was hard to read or understand, it was sort of a brain dump.  Let me know if you have any questions!

No comments:

Post a Comment