1

I have a Linux kernel module which creates a file in /proc directory. My module has read function and write functions which are called when the file is read or written. It has a circular buffer to save data which has many buffer entrys.

When the file is written, the module will write data in circular buffer which is then read when the /proc file is read.

When there are 2 threads, one thread may be writing into a buffer entry at the same time a read thread is reading from that buffer entry.

Will there be conflicts? How can i solve conflict between read thread and write thread?

Gray
  • 115,027
  • 24
  • 293
  • 354
phuongnd
  • 123
  • 1
  • 6
  • 1
    This page may be helpful: http://www.makelinux.net/ldd3/chp-5#chp-5 – Gray Mar 29 '12 at 15:14
  • use synchronization primitives like mutex,semaphore depending on what u need. http://stackoverflow.com/questions/62814/difference-between-binary-semaphore-and-mutex – agent.smith Mar 30 '12 at 06:53

0 Answers0