Low Level file locking is well described and documented. Perhaps start here: <https://sqlite.org/lockingv3.html>