Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


Closed Thread
  Search this Thread
Old 03-07-2011, 08:56 AM   #1
LQ Newbie
Registered: Mar 2011
Posts: 7

Rep: Reputation: 0
Why the interactivity of semaphore is better than mutual lock???

Please look at the code:
for(i = 0; i < 100; i++) {
If a process A into the critical region 100 times, at this time, process B also into the critical region, now the B will be sleep until the A execute 100 times loop.

If I use the semaphore instead of the mutex_lock, it will never happen, the B will get the semaphore when the A isn't execute 100 times loop.

Does this the mutex feature??

Can anybody tell me, why it is??
Old 03-07-2011, 10:23 AM   #2
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread should be closed because it is a duplicate of:

Pending closure of this threads by the mods assigned to this forum, please post all replies there.


Welcome to LQ. Hope you get the help you need here.
BTW, please review the LQ Rules & try not to cross post again. It's against the rules for a good reason -- it dilutes the discussion.
Thank you for your co-operation.

Last edited by archtoad6; 03-07-2011 at 10:24 AM. Reason: typo

Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to think of a way to ssh without interactivity and not using the publickey... trist007 Linux - Newbie 3 07-30-2010 09:26 AM
LXer: More fun with Zenity: shell script/GUI interactivity LXer Syndicated Linux News 0 02-18-2009 08:40 PM
pthreads and I/O mutual exclusion oulevon Programming 6 04-29-2006 10:33 PM
What Traffic Shaping Approach for Interactivity? tvynr Linux - Networking 5 10-15-2005 09:28 AM
gnome 2.8 desktop with limited interactivity wiseNoob Fedora 14 11-26-2004 12:42 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:47 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration