The brain, like muscles, consumes glucose and ATP (the body's energy molecule) to function.
And at some point, from the strenuous mental process, ATP runs out. This doesn't affect the muscles and other organs because they have their own energy depot.
However, the brain notices the lack of...