Re: [OT] How to make a "critical section" in user program?
On Fri, Sep 17, 1999 at 09:28:47AM -0700, Jerry Gardner wrote:
> Wojciech Zabolotny writes:
> > Hi All!
> >
> > I have yet another "real time" question.
> > Is it possible to make a part of my program a "critical section", so that
> > during execution of this part of code my program can not be suspended?
> > I'd like to be able to send a data through the serial port at the known time,
>
> As far as I know, there is no way to do this in a user program. The
> reason is simple, Linux is a multiple user system and if any random
> user could do this, they could write a program that enters a crital
> section and then loops forever. Such a program would effectively lock
> the computer up forever.
I agree, but what about the root's processes?
> You can easily write code that is non-preemptable in the kernel,
> however.
Well, but in the kernel I can't use the "write(ComFd,&c,1)".
Am I wrong? (I hope I've missed something)
I'm just trying to use Linux for a kind of realtime data processing,
and I'm trying to avoid RT Linux...
--
Wojciech Zabolotny
wzab@ise.pw.edu.pl
http://www.gnupg.org Gnu Privacy Guard - protect your mail & data
with the FREE cryptographic system
Reply to: