由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - How to ensure atomic execution of lines
相关主题
.cshrc?.login?.profile?Solaris disk driver
奇怪问题一个winterm background color
strange problem about wget executionanyone used softbench in HP-UX???
关于一个C++library的连接How to get the name of current executable in a library routine?
Key in Shared MemoryRe: How to get the name of current executable in a library routine?
A Question about TCP Spechow come this stupid question?
[转载] help! install cxterm in RH7.3, ld causes problemshow to execute a.out? (a stupid question)
A quick emacs question[转载] Re: about incoming email
相关话题的讨论汇总
话题: lines话题: atomic话题: execution话题: ensure话题: executed
进入Unix版参与讨论
1 (共1页)
z****g
发帖数: 5
1
Consider this case,
....;
....;
p(semaphore);//Entering waiting state
How can I make sure the last line is executed immediately after preceding
lines?
Sometimes, OS will preempt the program just before the p(..) is executed and
resume the program later. This may cause bad race condition.
I appreciate any clues for solving this problem. Thanks a lot.
x******g
发帖数: 3952
2
I tend to think for a users mode app, there is no chance for you to
do this. Otherwise every user has the potential of locking up the
whole system.
If you can shorten your code and make sure they can be finished within
1 timeslice, you will very less likly be preempted.

【在 z****g 的大作中提到】
: Consider this case,
: ....;
: ....;
: p(semaphore);//Entering waiting state
: How can I make sure the last line is executed immediately after preceding
: lines?
: Sometimes, OS will preempt the program just before the p(..) is executed and
: resume the program later. This may cause bad race condition.
: I appreciate any clues for solving this problem. Thanks a lot.

c*****t
发帖数: 1879
3

Huh? That means your code is not protected for critical conditions.
Re-write your code.

【在 z****g 的大作中提到】
: Consider this case,
: ....;
: ....;
: p(semaphore);//Entering waiting state
: How can I make sure the last line is executed immediately after preceding
: lines?
: Sometimes, OS will preempt the program just before the p(..) is executed and
: resume the program later. This may cause bad race condition.
: I appreciate any clues for solving this problem. Thanks a lot.

1 (共1页)
进入Unix版参与讨论
相关主题
[转载] Re: about incoming emailKey in Shared Memory
how to leave a process running even logout?A Question about TCP Spec
A problem[转载] help! install cxterm in RH7.3, ld causes problems
what's the difference between .a and .so,A quick emacs question
.cshrc?.login?.profile?Solaris disk driver
奇怪问题一个winterm background color
strange problem about wget executionanyone used softbench in HP-UX???
关于一个C++library的连接How to get the name of current executable in a library routine?
相关话题的讨论汇总
话题: lines话题: atomic话题: execution话题: ensure话题: executed