World's most popular travel blog for travel bloggers.

[Solved]: Are device drivers state machines?

, , No Comments
Problem Detail: 

I know that device drivers are attached to device controllers, which have their own registers and some local buffer storage. I'm wondering if I can think of device drivers as little state machines -- i.e. do they read and write to memory, or not?

Asked By : Eli Rose

Answered By : D.W.

Many device drivers do read/write to memory. For instance, consider a network device; it reads the packets to be sent from memory and writes the packets it receives to memory. Or think of a hard disk driver; it does something analogous. So, ultimately, it will depend on the driver.

That said, device drivers often do have a portion of their internal state that can be thought of a state machine. For instance, the states could be something like UNINITIALIZED, ACTIVE, SUSPENDED, where it is initially in UNINITIALIZED state on boot; after it initializes the device registers, it could transition to ACTIVE state; on suspend, it might put the device into suspend mode and switch to the SUSPENDED state, and so on. This only accounts for part of the behavior of the device driver, but it can still be a helpful way to organize the driver. Or, in other words: often, some important aspects of the driver's behavior or state can be thought of as DFAs even though that's only approximately true.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/40303

3.2K people like this

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback