I tried searching the net but couldn't find a perfect answer for this? What is the name of the procedure which is followed to avoid this situation where the other worker function will wait forever for this infinte loop to get over
if talking about processes infinite loop or no infinite loop linux does not care. the keyword you are looking for is 'preemption' and that can be looked up in any respectable os book
if there is an infinite loop not giving up the cpu in the kernel itself, that's a programming error. this is spotted with 'watchdog'.