In peripherals, priority is given based on the speed of the device. Higher the speed, higher the priority. Hard disk has the highest speed(MBps) among the given options and thus has the highest priority. Whereas, keyboard is the slowest one because we humans write so slow(like 1-3 word per second) when compared to CPU, and thus keyboard has lowest priority. You may have noticed sometimes that when you are copying/moving a large file on to your hard disk from other device, like pen drive, and then you try to type something using keyboard the typed words are shown with some lag. This is because of the priority being given to hard disk right now.