Pergunta de entrevista da empresa LinkedIn

What's a semaphore & how is it used? How does virtual memory work? What is the difference between a stack & heap (memory allocation)?