Synchronization question

Synchronization question

Post by Jon Beck » Wed, 15 Mar 2000 04:00:00



What is the best method of synchronizing access to shared data
structures?

Suppose I have several tasks which were created with clone() called
with the CLONE_VM flag.  Since they all share an address space, I need
to control access to certain data structures.  Basically, I want
a simple mutex to protect the data.

Are SysV semaphores (semget, etc) my best bet, or should I be
doing something with the file system?

TIA.

-Jon

 
 
 

Synchronization question

Post by Ilya Grishashvil » Sat, 18 Mar 2000 04:00:00



> What is the best method of synchronizing access to shared data
> structures?

> Suppose I have several tasks which were created with clone() called
> with the CLONE_VM flag.  Since they all share an address space, I need
> to control access to certain data structures.  Basically, I want
> a simple mutex to protect the data.

> Are SysV semaphores (semget, etc) my best bet, or should I be
> doing something with the file system?

> TIA.

> -Jon

If you're writing a multithreaded application, IMHO the
best is to use POSIX threads ( #include <pthread.h> )
It has a very nice syncrinization routines
pthread_mutex_lock
pthread_mutex_unlock
and lots of utilities to manipulate threads...

--
------------------------------------------------
Ilya Grishashvili
Computer Systems Group
Ph.D. CS Department
Marlan & Rosemary Bourns College of Engineering
University of California, Riverside
Office: Bourns Hall B246
Phone:  (909) 787-2893

Web:    mirage.cs.ucr.edu/~elias/
------------------------------------------------

 
 
 

1. Linux RAID-1 synchronization question

I don't understand why it is necessary to sync the two disks when you first
create a RAID-1 array.  The Software-RAID howto guide states that once
a RAID-1 array is created,

"The mirror must be constructed, eg. the contents (however unimportant now,
since the device is still not formatted) of the two devices must be
synchronized"

Why is it necessary to sync the disks when you are going to format it
anyway?
When you are creating a mirroring raid array with two disks, why do you
have to sync it?  Since you don't care about the data on the two disks at
this
point, why sync junks?  Wouldn't the subsequent format and write to the
raid device guarantee that the data you care about will be the same on the
two disks?

Please enlighten me.  Thanks a lot.

2. SecuritySearch.Net Vulnerability Report - April 14, 2000

3. Thread synchronization question/problem ...

4. SLIP server problems

5. Files / Folders synchronization

6. How do I upgrade from slackware 3.1 to 3.2 ?

7. 2.5.5-dj2: psmouse.c: Lost synchronization

8. Linux 0.99.4 and xfs

9. file synchronization

10. Time Server Setup - Ti me synchronisation

11. Password Synchronisation

12. Password Synchronization

13. NTP Synchronization