The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shared memory for shared library otheus High Level Programming 0 09-03-2008 03:55 AM
Shared memory in shared library DreamWarrior High Level Programming 12 05-30-2007 04:33 PM
memory sharing - not shared memory - elzalem High Level Programming 9 05-02-2007 07:45 AM
Writing a shared library --- any initialization routine? rogeryin UNIX for Dummies Questions & Answers 1 06-22-2006 11:17 PM
Shared memory shortage but lots of unused memory cjcamaro UNIX for Advanced & Expert Users 1 10-13-2004 05:10 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-06-2008
kumars kumars is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 9
Writing into shared memory Array

Hi All,

How do I write into shared memory blocks using multiple threads? For example, I have created 50 threads to write into shared memory and 50 threads to read from shared memory.

I have already created a shared memory and I want to write into shared memory as follows:


SharedMemoryID(1..N) BlockID(1..N) ThreadID(1..N) Data (String Format)

SharedMemoryID: I may have multiple shared memories in my process, which can be shared among multiple threads and processes.

BlockID: Each shared memory will have multiple blocks, and by referring this BlockID, any thread or process should be able to access it.

ThreadID: I am having multiple threads (read and write).

At this point of time, I am trying to write using WriterThread1, into single shared memory and once it’s written some data into one shared memory. I want to access and modify that data using ReaderThread1.

Again I want to write some data into same shared memory using WriterThread2 and want to modify or read the written data using ReaderThread2.

While doing this I also need to make sure that either of (reader or writer) thread should access any particular blocks of shared memory.

I don’t know how to proceed, only thing I have done so far is I am able to create number of reader and writer threads and a shared memory but have no idea about how to proceed further. I have attached code for your reference, could you please help me in moving ahead…..
Attached Files
File Type: zip shmemdemo.zip (14.7 KB, 48 views)
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:18 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0