Lock your computer after 5 minutes of inactivity

Go to control panel. Go to Appearance and Personalizations. Go to Screen Save Settings. Adjust wait times as desired. Setup a screen saver and check the box to "On resume, display logon screen"

If you want this password protected, setup your account to have a password.


What OS?

With Windows you can set your screensaver to turn on after X minutes and set that to require a password to unlock it.