Create os3.cpp

Mostly functions from lecture slides.