Inquiry about attribute locations in glsl

I have the following code in my application:

positionLocation = glGetAttribLocation(pid, "position");
normalLocation = glGetAttribLocation(pid, "normal");
texCoordsLocation = glGetAttribLocation(pid, "texCoords");

positionLocation = 2
normalLocation = 0
texCoordsLocation = 1

Can someone explain the logic to how these locations are assigned their values? I would think they would be assigned chronologically… but I guess not.