Patent ID: 7996848

Claim:
A method for controlling a process's access to a device driver, comprising: using a spinlock to acquire a lock associated with the device driver, wherein the lock comprises a spinlock value representing the availability of the lock and a lock count representing a number of processes waiting for the device driver; and wherein, if the spinlock value is a first value, the lock is acquired and the spinlock value is set to a second value; if the spinlock value is not the first value, returning to the step of using the spinlock to acquire the lock associated with the device driver; after acquiring the lock, accessing the device driver; and if a device associated with the device driver is not ready, waiting for the lock, wherein waiting for the lock comprises: setting a field of the process to a pointer to the lock, wherein the field of the process is included in a process table that includes execution information of the process including a state of the process, and wherein access by the process to the device driver requires use of the process table; setting the state of the process to waiting, wherein the field of the process indicates when the process ends the waiting state according to the lock count; incrementing the lock count; and setting the spinlock value to the first value after the state of the process has been set to waiting, wherein the spinlock value is set to the first value independent of whether the waiting state of the process has ended; and if the device is ready, setting the spinlock value to the first value, wherein the lock is acquired using the spinlock before a checking of the lock count.