Skip to contentSkip to conversation

Shared Memory using threads in C on AIX

DISCUSSION kumars 3 participants 3 messages Jun 18, 2008

lore
Share & tools
lore

kumars

author
#0 lore raw

I am looking for C program source code. Could you please help me in finding the source code of the required mentioned below.

Task that I need to complete:

Write a program to create multiple threads (one master thread and rest worker threads) and using the threads write into and read from shared memory

Restrictions:

Only one thread should be able to read at any instant of time into shared memory region.

Only one thread should be able to write at any instant of time into shared memory region.

Worker threads should inform the master thread after every read and write operation.

Master thread inform the worker thread (which is waiting to acquire shared memory region) that read or write operation is successful and it can acquire the memory for either reading and writing operations.

Signature · 2 lines
View this message in context: http://www.nabble.com/Shared-Memory-using-threads-in-C-on-AIX-tp17979185p17979185.html
Sent from the linux-c-programming mailing list archive at Nabble.com.
#1 lore raw

Hi,

Quoted 19 lines · kumars

I am looking for C program source code. Could you please help me in finding the source code of the required mentioned below.

Task that I need to complete:

Write a program to create multiple threads (one master thread and rest worker threads) and using the threads write into and read from shared memory

Restrictions:

Only one thread should be able to read at any instant of time into shared memory region.

Only one thread should be able to write at any instant of time into shared memory region.

Quoted 9 lines

Worker threads should inform the master thread after every read and write operation.

Master thread inform the worker thread (which is waiting to acquire shared memory region) that read or write operation is successful and it can acquire the memory for either reading and writing operations.

man pthread.h, you'll find everything you need in there...

Signature · 3 lines
Benoit Fouet
Purple Labs S.A.
www.purplelabs.com
#2 lore raw
In reply to kumars
Quoted 2 lines · kumars

I am looking for C program source code. Could you please help me in finding the source code of the required mentioned below.

The first three external links in the Wikipedia entry for "pthread" are tutorials:

http://www.llnl.gov/computing/tutorials/pthreads/
http://yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html
http://www-128.ibm.com/developerworks/linux/library/l-posix1.html

Signature · 1 line
Glynn Clements <[email protected]>