On Windows and Linux, it is simple to set up one’s workstation to have the screen locked when one steps away from the console. On the Mac however, there is no explicit way to achieve that. The following site has some good pointers: Quickly lock your screen
One of the best methods from the article is to “show the login window, without actually logging out. You can do this by
enabling fast user switching in the Accounts System Preferences panel.
Click the Login Options button (you’ll probably have to enter your
administrator password to do this), and then select the Enable Fast
User Switching option. Once you have fast user switching enabled,
you’ll see either an icon or a name in your menubar, depending on what
option you chose on the Login Options screen. Click on your name or
icon in the menubar and select Login Window from the drop-down menu.
The login window will appear. When you return to your Mac, login as you
usually do. All your applications will be just as your left them–even
your iTunes music will start up again where it stopped playing, even if
that means mid-song.”