Knocking is more or less unavoidable in diesel engines, where fuel is injected into highly compressed air towards the end of the compression stroke. There is a short lag between the fuel being injected and combustion starting. More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.