4 ms·
At least 3 different classes had me using threads at some point(c, pthreads library). I had to write 2 different web servers. Both were multi-threaded. One ha
by rledge21 17y ago
At least 3 different classes had me using threads at some point(c, pthreads library).
I had to write 2 different web servers. Both were multi-threaded. One had to serve static files from a directory, the other needed to implement a simple web service outlined by the teacher. For a separate grade, we had to make the web service one implement a threadpool.
I've also played with Ruby 'threads'(not really threads). For a databases class, I made a simple youtube-like clone that let users upload, tag, and comment on videos. When a video was uploaded, I needed to convert it to a flash-compatible format. I spawned a separate thread to handle this. If there were a bunch of people all uploading around the same time, you would end up with lots of extra threads hanging around converting video. I realized that this idea would never scale when I made it, but the timeframe given for the project didn't really allow me to implement a more scalable solution. I used a library off github called Spawn.
On the subject, I recently saw a great talk by Joe Damato and Aman Gupta at the Ruby Hoedown in Nashville covering different threading models. Some of their code has made it into Ruby Enterprise Edition.