Unix Programming - Re: Why do STREAMS need to ensures that there is only one user-driven M_IOCTL operatin

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > July 2006 > Re: Why do STREAMS need to ensures that there is only one user-driven M_IOCTL operatin





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 operatin
James Carlson

2006-07-14, 1:19 pm

"tony" <nj_zxw10@hotmail.com> writes:
> 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.


That's correct.

> 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,


That _may_ be correct. It depends on the design of the driver at the
bottom of the stream. Two fds may be open on the same stream if the
driver doesn't clone and allows the same instance to be opened more
than once.

> they can be executed
> concurrently, these two ioctls can arrive to the driver at one time on
> different CPU and different stream.


That depends on the STREAMS implementation. In Solaris STREAMS (see
mt-streams(9F)), you have no perimeters by default. You can set the
driver (or module) up to have an inner, outer, or both perimeters.

Perimeters behave like adjustable reader/writer locks and allow you to
control the concurrency within your design -- allowing one or many
simultaneous accesses per queue, queue pair, or module.

Without perimeters, and with an MT-hot kernel (Solaris is MT-hot; not
all other implementations are, though), yes, you can have those two
ioctls processed at the same time in the same module by two different
threads.

--
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






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com