[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What would it take....
From: |
Da Zheng |
Subject: |
Re: What would it take.... |
Date: |
Wed, 23 Dec 2009 09:30:24 +0800 |
User-agent: |
Thunderbird 2.0.0.23 (Macintosh/20090812) |
Samuel Thibault wrote:
> Da Zheng, le Tue 22 Dec 2009 23:04:55 +0800, a écrit :
>> I think we need to use process-shared mutexes,
>
> Or better, process-shared condition variables.
I'm not talking about sleep/wakeup signaling:-) why do we need to condition
variables to protect shared variables?
I was mistaken. In order to protect a variable in shared memory between 2
processes, I think the most light-weight way is to use spin_lock. As long as
the variable changed by a process can been seen by the other, it should be
fine. It seems to me that it's exactly the same as protecting shared variables
between threads.
Sorry, the subject is changed a bit. Maybe that made you confused:-)
>
>> which is what I meant in the beginning.
>
> Ok.
>
>> When we protect the shared variable with a mutex, I don't think we
>> need to use RPCs to synchronize two processes, right?
>
> Well, I used "RPC" while I should probably have used "IPC", like a
> process-shared mutex or condition variable. Anyway, I believe that's
> the same level of difficulty :)
I completely forgot mutex, condition variables, and semaphores for threads are
all implmented with IPC.
Zheng Da
- Re: What would it take...., (continued)
- Re: What would it take...., Da Zheng, 2009/12/22
- Re: What would it take...., Da Zheng, 2009/12/22
- Re: What would it take...., Samuel Thibault, 2009/12/22
- Re: What would it take...., Da Zheng, 2009/12/22
- Re: What would it take...., Samuel Thibault, 2009/12/23
- Re: What would it take...., Da Zheng, 2009/12/23
- Re: What would it take...., Samuel Thibault, 2009/12/23
- Re: What would it take...., Da Zheng, 2009/12/23
- Re: What would it take...., Samuel Thibault, 2009/12/23
- Re: What would it take...., Samuel Thibault, 2009/12/23
- Re: What would it take...., Da Zheng, 2009/12/23