We are going to use Keychain Access to lock the screen, here are some steps in detail
- Open ~/Applications/Utilities/Keychain Access
- Go to menu KeychainAccess->Preferences
- Put a check in “Show status in Menu Bar”

- Now you will see a lock-icon placed on the bar

Now you can lock your screen by using the “Lock Screen” menu