Avoid deadlocks and synchronise threads to use resources equally.Using pthreads. AUEB Computer Science course Operating Systems.