For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > July 2006 > Re: Why do STREAMS need to ensures that there is only one user-driven M_IOCTL operati









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Why do STREAMS need to ensures that there is only one user-driven M_IOCTL operati
tony

2006-07-13, 9:59 pm

Thanks again.
I can't understood what you said completely, so I will take a instance
to express what I understood about you said above, would you please
check it for me? Thanks very much.

There is a process with two threads: T1 and T2
A STREAMS driver and its corresponding device file is /dev/XXX

situation 1:
T1 and T2 both issue ioctl(fd, ...) at the same time, and the fd is a
glable variable in the process. Because of the same fd, these two
ioctls will execute on the same stream, they won't be executed
concurrently.

situation 2:
Different from situation1, the fd is not a glable variable, but be got
by open(/dev/XXX, ...) separately in T1 and T2. Because of the
different fd, these two ioctls will execute on the different stream
even though they are on the same driver, they can be executed
concurrently, these two ioctls can arrive to the driver at one time on
different CPU and different stream.

James Carlson wrote:
> "tony" <nj_zxw10@hotmail.com> writes:
>
> That's right -- choosing correctness over performance.
>
>
> Yes, but does it matter? As I pointed out previously, ioctls are
> supposed to be control-path operations. If you really have multiple
> threads issuing ioctls on a *single* stream and you need to have those
> run concurrently, then perhaps ioctls aren't the right design.
>
> Note that we are talking about per-stream operation here. If you have
> multiple streams, they're independent, so you can have multiple ioctls
> taking place in a single module -- each on a separate stream. It
> isn't as though it's one ioctl per _module_.
>
> --
> James Carlson, KISS Network <james.d.carlson@sun.com>
> Sun Microsystems / 1 Network Drive 71.232W Vox +1 781 442 2084
> MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com