F
F
Fen1xL2021-10-10 13:43:05
linux
Fen1xL, 2021-10-10 13:43:05

Synchronization of resources in the driver during system calls?

Let's say there is a driver that implements read and write. The read function blocks execution until a device interrupt occurs and the received data is copied to the queue. At the moment when the read function is blocked (in fact, the system call (syscall) did not return the result to user space), then when calling another system call of the same driver, for example, write, is it necessary to synchronize the common data in the driver itself, which is also used in read and write? Or is the execution of system calls somehow guaranteed to be regulated and interrupts disabled (for example, if an interrupt has occurred, the data has been copied and the read system call is ready to be unlocked, and at this moment the write system call is being executed, then write can be interrupted)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2021-10-11
@Fen1xL

At the moment when the read function is blocked (in fact, the system call (syscall) did not return the result to user space), then when calling another system call of the same driver, for example, write, is it necessary to synchronize the common data in the driver itself, which is also used in read and write?

Yes.
Or the execution of system calls is somehow guaranteed to be regulated and interrupts are disabled

No, it's not regulated at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question