Restrict concurrent content edit I want to restrict concurrent edit by the users.

If user A is editing a content then  user B should not be able to edit the content at the same time. That content should be visible, just not editable.

I am unable to find any module that provides this feature for Drupal 7.

Is there any module, or how can I achieve this programmatically?
There is a module for that. Try the Conflict module

This module allows parallel editing of nodes with field-level conflict detection and a trick to prevent accidental overwriting of fields when they are changed by another session while a node is being edited.
This behavior is useful for things like issue queues where multiple people might be following up to an issue simultaneously.
It works by hashing the field data and comparing these hashes. This is done so we can generically do a 3 way comparison between the original node, the node as edited by us, and the node as edited by others.