Assume that the gpio X can be exported in sysfs as an input pin, after doing that a directory called gpioX will be created into /sys/class/gpio/. gpioX/ contains few file such as "value" which represents the current state of the gpio X (high or low).
What happens (in kernel space) when the signal applied to the pin X change its state (for example from low to high)? I mean, before the transition gpioX/value contains "low", but after that it will contain "high" value. How is this file updated by the OS? I think that an interrupt mechanism is required.