Abstract-This paper considers a distributed control algorithm for frequency control of electrical power systems. We propose a distributed controller which retains the reference frequency of the buses under unknown load changes, while asymptotically minimizing a quadratic cost of power generation. For comparison, we also propose a centralized controller which also retains the reference frequency while minimizing the same cost of power generation. We derive sufficient stability criteria for the parameters of both controllers. The controllers are evaluated by simulation on the IEEE 30 bus test network, where their performance is compared.