Implementation of reader writer locks along with solution to Priority Inversion problem