QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
Shared memory reading/writing by multiple processes |
Ref. No. |
QNX.000003080 |
Category(ies) |
Development |
Issue |
I am using QNX 4.24 in our project, with four processes running at different priorities, using shared memory to share data between them. The shared memory contains some variables of single, two, and four bytes, including two file pointers. Some of the variables are updated by more than one process, and are read by all four.
Do I have to implement any security features to control access to the shared variables, between the different processes to maintain data integrity? If so what is needed?
|
Solution |
If you have 2 different processes writing to the same file, I reccomend you use semaphores. Look at sem_* in the Watcom Compiler & Tools book.
Any Unix programming book (such as Advanced Programming in the UNIX Enviornment by Stevens ISBN 9-780201-563177) will show good examples on how to implement semaphores. |
|