Why you require different operating system for different compiler?
Actually it’s the other way around. You require different compilers for different operating systems. The reason for this is that an operating system is basically an intermediate step for a person to be able to interact with the hardware on their system. Each OS has a different way to do this, and so compilers must be different for each one, even for the same language.