Answer by Thomas Cormen:

Have you heard the saying “A professor is one who deprives himself of sleep so that he may bestow it upon others”?  I suppose that when a student falls asleep, it means that I’m doing my job.

A couple of stories…

Back when our introductory course was in C++, I knew that students would have a really hard time with pointers and pointer arithmetic.  We’d have three or four lectures on the topic.  At the start of this material, I would announce to the class, “We are about to enter the most difficult part of the course.  I need you to stay awake.  If I see you sleeping, I will stop the lecture and wake you up.”  And I would do it!  Usually, after the first student was embarrassed by being woken up, nobody else would fall asleep during those lectures.  Wanting to be truthful, when we got to the end of the section on pointers and pointer arithmetic, I would announce, “We have completed the most difficult part of the course.  You may resume sleeping.”

The other story is by Daniela Rus.  Daniela, now Director of CSAIL at MIT, started her faculty career at Dartmouth.  Several years ago, she told me her brilliant way of keeping students awake.  She would tell the class, “If I see you sleeping, I will throw an eraser at you.  But understand, I grew up a girl in Romania.  I have terrible aim.  I will probably miss you and hit your neighbor.  Therefore, if you don’t want to get hit with an eraser, you should keep your neighbor awake.”  A self-organizing system!

What do professors think of students who fall asleep in class?