I would like to know the different methods linux uses to control access to a peripheral device. e.g. for example you have a spi temperature sensor. And multiple threads are trying to get a reading. How does linux ensure that two threads aren't accessing a device at the same time.