The MVCC model used in PostgreSQL makes locks less of an issue than in some other databases. However, high performance applications still need to be careful to minimize how often they take stronger locks, and performance tuning work will regularly require looking for situations where locking behavior is a bottleneck.
The details of how locking works in the database is described extensively at http://www.postgresql.org/docs/current/static/explicit-locking.html.
The other useful manual section is the description of the
pg_locks view, which lets you see all the active locks in the database, refer http://www.postgresql.org/docs/current/static/view-pg-locks.html.
As there are far too many details involved in locking to cover all of them in this ...