Traffic signals work in two ways:
-There are sensors installed either under the road's surface or on top of the light itself.
-The sensor will detect the vehicles passing by.
-If there are more traffic on one side of the road, the signal will remain green
until the traffic is reduced on that particular side.
-However,if sufficient amount of vehicles start to come in the other direction,the signal will go red and the other one turn green.
As the name suggests,the signal will be green for a pre-determined length of time no matter how much traffic there is.