Another possibility to terminate a backend is by using a Unix/Linux command named kill N. This command orders the SIGTERM signal to process N on the system where it is running. You have to be either the root user or the user running the database backends (usually postgres) to be able to send signals to processes.
You can cancel a backend (and simulate the pg_cancel_backend(pid) function) by sending a SIGINT signal:
kill -SIGINT <backend_pid>
For more detailed information and the exact syntax, type man kill from your favorite shell environment.