thanks very very much.. now i get it...,
its like.. a mutex is a lock, which is used when
things are done in parralel and to avoid corruption of
the data which is being processed... i took an example
of the way i used to lock files in PERL, in order to
avoid multiple writes at the same time...
one more question... if there is a lock order
reversal.. is there a way that can be solved.. for
e.g. by using on of the MTX_XX things...
--- Maxime Henrion <[EMAIL PROTECTED]> wrote:
> Hiten Pandya wrote:
> > hi all,
> > sorry for running -current.. but i am an
> > and challenging man...(boy)...
> > anyways.. whats a mutex and a lock order
> > if you could point to some good manual on these
> > subjects... thanks...
> > help is appreciated...
> > thanks again...
> A mutex is an algorithmic object used to serialize
> operations. It
> stands for ``mutual exclusion''. It's useful when
> the same code is ran
> several times in parallel. For example, if two
> threads wanted to modify
> a linked list in the same time, there is a chance
> that the linked list
> would get corrupted since an insert or remove
> operation is not atomic
> (one of the thread could get preempted when it has
> not finished to
> remove or insert an element, and thus the linked
> list is not in a normal
> In such cases, every part of the code that modify
> the linked list has to
> obtain the mutex before doing it and release after.
> If another thread
> tries to acquire the mutex, it will block until the
> first thread has
> released it.
> When some code has to obtain two locks or more,
> deadlocks might happen.
> If thread 1 has lock A and tries to acquire lock B
> while thread 2 has
> lock B and wants lock A, then both threads will
> block indefinitely. To
> solve this, one way is to always obtain the lock in
> the same order. The
> warning messages you got show that some code is
> violating this lock
> order somewhere.
> I found ``Unix Internals'' from Uresh Vahalia to be
> a very good book on
> this topic.
> Hope this helps,
> Maxime Henrion
> Don't be fooled by cheap finnish imitations ; BSD is
> the One True Code
MOTD: I just like _pumping_ the daylights out of a
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message