由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 实时进程间通讯问题
相关主题
大家看过来Re: C++ Guys!!!!哪个大牛能用10-20句话讲讲paxos?
Semaphores in Linux (转载)純好奇,EECS最近50年哪個重要成果來自於學術界?
C++多线程写网络服务是不是快退出舞台了?微软又大转弯
利用kafka 幫助不同进程见传输数据靠谱么 (转载)looking for summer interns (转载)
《Latex 教程》(LaTeX and Friends)英文版[PDF]internal refer 几个新职位 (转载)
zookeeper 这种牛鼻软件都是apache自己的人写的?docker和vagrant的异同是啥,大家都用哪个
有人把sicp看完题目做完么?感觉如何?收获大么又被docker害了
大家觉得richard stallman跟linus torvalds谁更牛[转载] Unix/Posix system programming training
相关话题的讨论汇总
话题: write话题: 进程话题: 区域话题: exclusion话题: mutual
进入Programming版参与讨论
1 (共1页)
r******s
发帖数: 925
1
【 以下文字转载自 robotics 讨论区 】
发信人: robotics (机器人技术), 信区: robotics
标 题: 实时进程间通讯问题
发信站: BBS 未名空间站 (Tue Jun 24 23:45:44 2008), 转信
两个不同的real time进程运行在不同的CPU上面,使用一段共享内存进行同步
内存容量足够大,我想采用的方法,就是划分块
A块属于A进程写,B只读的区域,
B块属于B进程写,A只读的区域。
由于没有使用中断,两边都是在固定的时钟周期内写自己的区域同时读对方的区域
这样编程比较简单,我想了解一下可能出现的后果,
比如,A读了B正在写的区域
那么我可以为每个块设置一个标志位,代表在写,在读,或者ready
有没有哪位大侠给出一个简单但是确保安全的办法?
s******e
发帖数: 431
2
如果不用任何lock的话,我觉得一个标志位可能不够,需要多个,比如要写,正在写,
写完。一点想法。
a****l
发帖数: 8211
3
I think that is basically a "lock" problem, and ususally it is not trivial
without any hardware support. On the other hand, you may consider some
operations will not be interrupted, e.g. , read/write to one bit. So,
starting from there, you can have something. E.g., one says "intend to write
", one follows "acknowledge to write", then one writes.

【在 r******s 的大作中提到】
: 【 以下文字转载自 robotics 讨论区 】
: 发信人: robotics (机器人技术), 信区: robotics
: 标 题: 实时进程间通讯问题
: 发信站: BBS 未名空间站 (Tue Jun 24 23:45:44 2008), 转信
: 两个不同的real time进程运行在不同的CPU上面,使用一段共享内存进行同步
: 内存容量足够大,我想采用的方法,就是划分块
: A块属于A进程写,B只读的区域,
: B块属于B进程写,A只读的区域。
: 由于没有使用中断,两边都是在固定的时钟周期内写自己的区域同时读对方的区域
: 这样编程比较简单,我想了解一下可能出现的后果,

p***o
发帖数: 1252
4
Just FYI, for concurrency without ANY hardware support, Lamport's
bakery algorithm could be used ...
research.microsoft.com/users/lamport/pubs/pubs.html#bakery
Cited from the page:
"Before the bakery algorithm, people believed that the mutual exclusion prob
lem was unsolvable--that you could implement mutual exclusion only by using
lower-level mutual exclusion. Brinch Hansen said exactly this in a 1972 pap
er. Many people apparently still believe it. (See [90].) "

write

【在 a****l 的大作中提到】
: I think that is basically a "lock" problem, and ususally it is not trivial
: without any hardware support. On the other hand, you may consider some
: operations will not be interrupted, e.g. , read/write to one bit. So,
: starting from there, you can have something. E.g., one says "intend to write
: ", one follows "acknowledge to write", then one writes.

m*****e
发帖数: 4193
5
Which CPU?

【在 r******s 的大作中提到】
: 【 以下文字转载自 robotics 讨论区 】
: 发信人: robotics (机器人技术), 信区: robotics
: 标 题: 实时进程间通讯问题
: 发信站: BBS 未名空间站 (Tue Jun 24 23:45:44 2008), 转信
: 两个不同的real time进程运行在不同的CPU上面,使用一段共享内存进行同步
: 内存容量足够大,我想采用的方法,就是划分块
: A块属于A进程写,B只读的区域,
: B块属于B进程写,A只读的区域。
: 由于没有使用中断,两边都是在固定的时钟周期内写自己的区域同时读对方的区域
: 这样编程比较简单,我想了解一下可能出现的后果,

r******s
发帖数: 925
6
Good reference, Thanks a lot!

prob
using
pap
trivial

【在 p***o 的大作中提到】
: Just FYI, for concurrency without ANY hardware support, Lamport's
: bakery algorithm could be used ...
: research.microsoft.com/users/lamport/pubs/pubs.html#bakery
: Cited from the page:
: "Before the bakery algorithm, people believed that the mutual exclusion prob
: lem was unsolvable--that you could implement mutual exclusion only by using
: lower-level mutual exclusion. Brinch Hansen said exactly this in a 1972 pap
: er. Many people apparently still believe it. (See [90].) "
:
: write

j**********p
发帖数: 22
7
seqlock

【在 r******s 的大作中提到】
: Good reference, Thanks a lot!
:
: prob
: using
: pap
: trivial

l*****g
发帖数: 547
8
If you are using *NIX systems, POSIX IPC can give you sufficient supports:
Solution 1: message queue. but you will need thread support if two processes
running on different cycle times.
solution 2: semaphore + shares memory, but you need to make sure there is
no deadlock.
I am not sure how to do it on windows.

【在 r******s 的大作中提到】
: 【 以下文字转载自 robotics 讨论区 】
: 发信人: robotics (机器人技术), 信区: robotics
: 标 题: 实时进程间通讯问题
: 发信站: BBS 未名空间站 (Tue Jun 24 23:45:44 2008), 转信
: 两个不同的real time进程运行在不同的CPU上面,使用一段共享内存进行同步
: 内存容量足够大,我想采用的方法,就是划分块
: A块属于A进程写,B只读的区域,
: B块属于B进程写,A只读的区域。
: 由于没有使用中断,两边都是在固定的时钟周期内写自己的区域同时读对方的区域
: 这样编程比较简单,我想了解一下可能出现的后果,

1 (共1页)
进入Programming版参与讨论
相关主题
[转载] Unix/Posix system programming training《Latex 教程》(LaTeX and Friends)英文版[PDF]
an interview question - C programmingzookeeper 这种牛鼻软件都是apache自己的人写的?
windows 下怎么让同一个程序的不同instance之间通信呢有人把sicp看完题目做完么?感觉如何?收获大么
Re: Lehman Brothers C++ programmer interview大家觉得richard stallman跟linus torvalds谁更牛
大家看过来Re: C++ Guys!!!!哪个大牛能用10-20句话讲讲paxos?
Semaphores in Linux (转载)純好奇,EECS最近50年哪個重要成果來自於學術界?
C++多线程写网络服务是不是快退出舞台了?微软又大转弯
利用kafka 幫助不同进程见传输数据靠谱么 (转载)looking for summer interns (转载)
相关话题的讨论汇总
话题: write话题: 进程话题: 区域话题: exclusion话题: mutual