Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 527 results for
semaphore
- Page 1
Re: Semaphore - what is that?
Hardware and Software
Linux and Unix
19 Years Ago
by blud
Semaphore
's are what the system uses to run processes, kind … inodes on a disk, there are a limited number of
Semaphore
's available to access by files at any given time…. Usually when
Semaphore
's are completely used it is because a software application…
semaphore help
Programming
Software Development
12 Years Ago
by Nakeo
…Btime2, Etime1, Etime2; // time pointers
Semaphore
semaphore
(123, 2);
semaphore
.Init(0,1);
semaphore
.Init(1,99); srand(time(NULL));// …; randomnums; index++) // random number loop {
semaphore
.Wait(0);
semaphore
.Wait(0); oldnumber =
semaphore
.ReadValue(1); newnumber=rand() % 100; cout …
Re: semaphore help
Programming
Software Development
12 Years Ago
by sundip
Compilation does not mean a correct program. Have you try to debug your program? Just by a quick look on your program i am unable to understand the use of [CODE] line 33.
semaphore
.Wait(0); Line 34.
semaphore
.Wait(0);[/CODE]
Re: semaphore help
Programming
Software Development
12 Years Ago
by Nakeo
… to understand the use of [CODE] line 33.
semaphore
.Wait(0); Line 34.
semaphore
.Wait(0);[/CODE][/QUOTE] Those two lines where…
Semaphore - what is that?
Hardware and Software
Linux and Unix
19 Years Ago
by Gandalf
…/2004-July/002269.html[/url] My question is what is
Semaphore
? What casues it to end up within 3 days and… get when via SSH i make a command ipcs -u -------
Semaphore
Status -------- used arrays = 93 allocated semaphores = 93
semaphore instead synchronized methods?
Programming
Software Development
10 Years Ago
by nikolaos
… class SemaphoreMultithreadingExample { static int counter = 0; static
Semaphore
semaphore
= new
Semaphore
(1); public static void incrementCounter(){ try {
semaphore
.acquire(); counter++;
semaphore
.release(); } catch (InterruptedException ex…
Re: semaphore instead synchronized methods?
Programming
Software Development
10 Years Ago
by nikolaos
I think that a disadvantage of
semaphore
is that the thread using
semaphore
.acquire() could be interrupted. I 've read that when we are dealing with a small number of threads synchronized methods are faster but as the number of threads increases semaphores are faster. Thank you for your answer.
Re: semaphore instead synchronized methods?
Programming
Software Development
10 Years Ago
by JamesCherrill
The main advantage of
Semaphore
is that you can limit access to n threads, not just one thread, at a time. Personally I would use synchronised to limit to one thread at atime, mainly because its simpler and more obvious code.
Semaphore explanation (signals : wait/up etc)
Programming
Software Development
11 Years Ago
by BryantFury
… The notes I have are rather vague about comparing two
semaphore
operations (like in this case) I have attempted the …)E this is beginning from A with changes due to
semaphore
signalling. Other possible orders I have in mind are:… change)E I feel I am not correctly analysing the
semaphore
operations (and admittingly they do confuse me) B)some…
Semaphore Understanding
Programming
Software Development
12 Years Ago
by Gaiety
…when the process is going to sleep the
semaphore
is not cleared so i expect sem unavailable)… atleast once in course of execution. #include <
semaphore
.h> #include <stdio.h> #include…PROT_READ |PROT_WRITE,MAP_SHARED,fd,0); close(fd); /* create, initialize
semaphore
*/ if( sem_init(&mutex,1,1) < 0)…
Re: Semaphore Understanding
Programming
Software Development
12 Years Ago
by Banfa
… execution for potentially an infinite amount of time if the
semaphore
value is already 0 in order to lock the…
semaphore
. It only returns -1 if there is an error, including … could try calling `sem_trywait` which will return immediately if the
semaphore
can not be locked with a value of -1 and…
Re: Semaphore(Binary & Counting)
Hardware and Software
Linux and Unix
12 Years Ago
by mike_2000_17
… in (and didn't check out yet), that's a
semaphore
. Of course, this requires that everyone is diligent enough not… particular room that is available. This is why the counting
semaphore
is not as useful, at least, by itself. There are… resource pool), in which case you might use a counting
semaphore
as part of the solution, but often not. The reason…
semaphore and critical section
Hardware and Software
Microsoft Windows
12 Years Ago
by sydsine
Plz explain m the following wid example if possible. These ques. Are basically for interview purpose 1. System clock 2.
Semaphore
3. Mutex 4. Monitor 6. Difference b/w monitor and
semaphore
7. Backup and restore 6. Does deadlock happens in a system when. Is system hang a deadlock plz reply ..
Semaphore Problem
Programming
Software Development
12 Years Ago
by smith32
… properly for writer/reader problem. I think something with the
semaphore
. but can't solve and online can't help me… too. [CODE]
semaphore
mutex, read, write; void *reader(void *argv) { char buffer[200…
Semaphore Problem
Programming
Software Development
12 Years Ago
by smith32
…'m trying to do the third writer/reader problem with
semaphore
(as mention on wiki). But it's not working properly…;pthread.h> #include <stdlib.h> #include <
semaphore
.h> #include <string.h> #include <fcntl…
Semaphore(Binary & Counting)
Hardware and Software
Linux and Unix
12 Years Ago
by Ankit_Parmar
What is the difference between Binary
Semaphore
& Counting
Semaphore
? What will be situation to prefer one from both of them?
Re: Semaphore(Binary & Counting)
Hardware and Software
Linux and Unix
12 Years Ago
by rubberman
It depends upon how many threads are allowed to access a resource at a time. A binary
semaphore
allows only one, whereas a counting
semaphore
may only allow N accesses at a time. The counting version is not frequently used, but it may be useful for some situations.
semaphore applied to parent and child process
Programming
Software Development
10 Years Ago
by haresh.sankarraj
Hi members, This is a program i wanted to implement
semaphore
between parent and child processes which are trying to access …/types.h> #include <unistd.h> #include <
semaphore
.h> #include <stdlib.h> #include <errno…
semaphore implementation using the linked list
Programming
Software Development
14 Years Ago
by bappee11
hey guys i,m having a bit problem with the programming..... i have to implement
semaphore
with two function called wait() and signal() using the linked list and array or stack in c++
semaphore/mutex
Programming
Software Development
11 Years Ago
by kesuke
Can I use
semaphore
or mutex on MikroC? If you know , please tell me the function name or exsample code.
Re: Semaphore with value 0
Programming
Software Development
9 Years Ago
by serpi90
… uses `sem_post` The case you mentioned of the
semaphore
being initialized with 1, used to protect *shared memory…* segments is the case of a **mutex**, or
semaphore
for *mutual exclusion*. You could also achieve this initializing… possibilities. * **A** posts and **B** waits * The
semaphore
value is 0, **A** uses `sem_post` and it becomes …
Re: Semaphore with value 0
Programming
Software Development
9 Years Ago
by Moschops
…can't have any". If you're using a
semaphore
system that someone else wrote, they will probably have …already decided what a zero
semaphore
means and you should check the documentation. It is … interpret a zero (or other such nullesque value) valued
semaphore
to mean "nobody is using this data right now…
Re: Semaphore with value 0
Programming
Software Development
9 Years Ago
by Moschops
> The only restriction of a
semaphore
is that it's value can not be less than zero. I use the value of -1 on a
semaphore
to indicate that it is not being used (i.e. does not currently refer to any particualar object or data).
Stuck in Readers-Writers problem using Semaphore
Programming
Software Development
14 Years Ago
by skyzer
…ve found an example of how to use
Semaphore
and made my code into there for Readers… final Random rand = new Random(); private static
Semaphore
sm = new
Semaphore
(2); String text = "Beginning of the… thrdsync.startThreads(); } }[/CODE] [QUOTE]
Semaphore
(int permits) Creates a
Semaphore
with the given number of permits and …
System V to POSIX Semaphore Wrapper
Programming
Software Development
13 Years Ago
by pikpik
… trying to link the library's
semaphore
class to the platform's
semaphore
implementation. The problem is that the…BSD license. Thank you, pikpik 1. The library,
semaphore
example [url]http://code.google.com/p/v8/source…Semaphores [url]http://www.opengroup.org/onlinepubs/009695399/basedefs/
semaphore
.h.html[/url] 4. The operating system's System…
Semaphores - Using command line arguments to create and remove semaphore set
Programming
Software Development
13 Years Ago
by mashhype
…[j+3]) == atoi(argv[argc-1])) break; } /* Create
semaphore
*/ if ((sem_id = semget(ipc_key, ns, IPC_CREAT | IPC_EXCL | 0666…: File exists"); exit(1); } printf ("
Semaphore
identifier %d\n", sem_id); /* Set arg (the…("semctl : GETVAL"); exit(4); } printf ("
Semaphore
%d has value of %d\n",i, sem_value); }…
Re: mutex and semaphore
Programming
Software Development
12 Years Ago
by mike_2000_17
…the difference between a mutex and a *binary*
semaphore
is that the
semaphore
is a more general mechanism which makes it … scenario is that multiple threads can increase (lock) the
semaphore
when they need to, and decrease (unlock) it when…just like having a number of mutexes instead of one
semaphore
count. It's just a simpler (but sufficient …
Re: Stuck in Readers-Writers problem using Semaphore
Programming
Software Development
14 Years Ago
by moutanna
… little changes: import java.util.Random; import java.util.concurrent.
Semaphore
; import java.util.logging.Level; import java.util.logging.Logger…; private static final Random rand = new Random(); private static
Semaphore
sm = new
Semaphore
(2, true); String text = "Beginning of the Book…
how to check if semaphore is lock efficiently
Programming
Software Development
13 Years Ago
by neti1987
… some code, but only after the first locked the
semaphore
. right now I do it with busy-waiting: [… x; // wait untill the main thread will lock the first
semaphore
: while (1) { x = semctl ( sem1 , 0 , GETNCNT); // …gt; 0) break; // if the main thread locked the first
semaphore
- break the loop. usleep(1); // else - wait milisecond …
Re: how to check if semaphore is lock efficiently
Programming
Software Development
13 Years Ago
by neti1987
…to it ?[/QUOTE] I have to lock a
semaphore
in the main thread. and right after that…code. the problem is, that when I locked the
semaphore
- the program is stucked - and this is not… if the main thread already locked the
semaphore
. (of course I cannot write it right …after the
semaphore
lock - because it won't run)…
1
2
3
9
Next
Last
Search
Search
Forum Categories
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Forums
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC