When I was doing unix programming in C (producer consumer pblm ). I found a strange thing that if 'printf' was used along with 'sleep' then the 'printf' statement wont execute...?

Can anybody tell me what is the problem....or
Do these to have any connection with each other..?