The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
read and write from a file rinku Shell Programming and Scripting 2 01-10-2008 09:22 PM
how i write script to create 30 processes amitpansuria UNIX for Advanced & Expert Users 2 10-20-2007 02:45 AM
Problem with read & write EltonSky High Level Programming 11 08-31-2006 11:35 AM
popening for read and write szzz High Level Programming 1 11-18-2003 08:05 AM
read, write & STDOUT_FILENO.... M3xican High Level Programming 2 07-17-2002 01:41 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-13-2006
Registered User
 

Join Date: Feb 2006
Posts: 2
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Read/write locks within and between processes. Can you help?

I have an application that is multithreaded and concurrent. Multiple instances of the application must run at the same time.

Each thread in each process accesses shared resources. For this purpose I've employed Butenhof's read-write locks. Inter-process locking is based on fcntl. For example, fcntl is used to prevent a reader from process 1 getting access to a resource that was write locked by a thread from process 2.

I am not sure that this implementation is watertight. Do you know of a "standard" implementation for this kind of mutex? Do you know of another way to implement this kind of locking?

Cheers,
Adam
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-13-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,228
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
You want write-execlusive locking, correct?
Otherwise read-shared locking.
Reply With Quote
  #3 (permalink)  
Old 02-13-2006
Registered User
 

Join Date: Feb 2006
Posts: 2
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Quote:
Originally Posted by jim mcnamara
You want write-execlusive locking, correct?
Otherwise read-shared locking.
I need read-write locks of the kind described by Butenhof in his "Programming with Posix Threads" book. These provide read-shared and write-exclusive access to a resource (not at the same time, naturally) within a process. I need to extend this concept to multiple processes.
Reply With Quote
  #4 (permalink)  
Old 02-13-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,228
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
An exclusive lock is supposed to stop all other access types, by definition.

You have the right model. It's usually the one implemented for shared memory access across processes - System V semaphores. Normally, there are two semphores (mutexes).

See Section 5.2 Process Semaphores in:

http://www.advancedlinuxprogramming....p-ch05-ipc.pdf
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB 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 -7. The time now is 02:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102