Terminally Incoherent

Utterly random, incoherent and disjointed rants and ramblings...

Thursday, March 23, 2006

Vaguest Exam Question Ever

One of the question on my Operating Systems exam today was to show two examples where multi-threaded implementation does not provide better performance than single threaded implementation. We were supposed to write some code/pseudocode to illustrate this...

Every person I asked put down something different for this question. No one was sure what the hell we were supposed to do. Some people used "hello world" as one of the examples. Others mentioned processing keyboard input in a word processor. In fact, allot of people gave purely iterative examples that could not be multi-threaded to begin with...

I'm pretty sure "hello world" was the wrong answer here. The question was worth 30 points - you usually don't see tricky questions like that being worth so much. I scribbled some half-assed code with big loop statements in critical section so that the threads would block and have to wait on each other. I figured the same loop implemented as a single thread would execute faster because there would be no context switching overhead, thread creation and etc..

Other example was treads locking on a shared buffer object and performing some critical section while holding onto that buffer... Still, I'm only guessing that the performance would be worse with a multi-threaded implementation. There is no way to tell for sure without actually testing this.

Of course we could not ask Dr. Robila what he meant in this question because he was not there. I hope he curves or throws out this one completely...

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home