Coded threads in python and c, plus mutex in c