How and when is oplog truncation triggered?

Is there a background thread that does oplog truncation or oplog truncation are triggered only when there is data modifications that generate oplog entries?

This question is in relation to this post Older oplog entries are not getting truncated

And what I have found is oplog truncation started to happen only when there was a running bulk insertion