Hi friends,
I have this very famous Operating System book titiled, "Operating System Concepts" by Abaraham Silbertschatz 7th edition.
Regarding the semaphores, here is a paragraph from the book which says,
We can also use semaphores to solve various synchronization problems. For example, consider two concurrently running proceses: P1 with a statement S1 and P2 with a statement S2. Suppose we require that S2 be executed only after S1 has completed. We can implement this cheme readily by letting P1 and P2 share a common semaphore sync, initialized to 0, and by inserting the statements
in process P1, and the statements
in process P2. Because synch is initialized to 0, P2 will execute S2 only after P1 has invoked signal(synch), which is after S1 has been executed.
Now according to the pseudocode that has been provided, I have written this small program, but it fails. You can have a look at it.
The code you implemented only ensures thread 2 writes to stdout after thread 1 has posted to the semaphore at least once. It doesn't restrict thread 1 from posting to the semaphore multiple times before thread 2 does anything.
Hi guys,
I hope everybody is doing fine. I have written this small program which solves the critical region problem. Only on of the two threads can make changes to a common variable called counter. I am using two semaphores, is it possible to write the same program using only one semaphore? Here... (0 Replies)
Hi friends,
I want to print the the following sequence of numbers using sempahores.
2 3 2 3 2 3 2 3
But something seems to be wrong regarding my concept of semaphores, I am using a single function, a single semaphore, and two threads, but I am not succeeding to achieve my goal,
it prints as... (1 Reply)
Hi All,
Im executing the shell script remotely.
here is one statement from that:
remsh $rHost -l $rUser "java -jar $TARGET/toolkit/apps/bin/toolkit-stm.jar network -m -d1 /abmusr06/abm/users/dywrk01/$package/DYP_Execution/data/configuration/network_aus/network -u2... (1 Reply)
Hi,
I am trying to create a script which validates the incoming source files. The script has File name Pattern as Argument. The First part of the script validates if there are any files available
if
then
echo "\n Files are available to process \n"
else
echo "\n File does not... (9 Replies)
Hi gurus,
I'd like to know your opions about Single Sign On (SSO) for linux (Debian). In my company, clients want to access to different services (FTP, HTTP, Mail, Web Applications ). I think about OpenLDAP and Proxy (Squid, Vulture) to resolve this problem but i'm not sure if they can. Are there... (0 Replies)
Hi everybody,
I'm a newbie and hope that someone help me in this problem.
I have a filename in LINUX with single quote like this:
abs@hosttest:~/ABS/BETY/cygdrive/C/DECLARANOT 1.1.4/02 - ROCK/052 - GUNSROSES> dir You*
-rw-r--r-- 1 abs users 2365881 2008-08-25 09:16 You're Crazy.mp3
... (9 Replies)
I'm having an issue implementing my semaphores....
The following is how I'm setting up the semaphore.
First: I get the semkey (which I've wrapped in an IF statement using perror() but in an attempt to keep the code clutter free I've removed it here)
semkey = ftok("./request", 'S' )
... (1 Reply)
I'm having trouble manipulating a string that contains single quotes (') in it. I'm writing a ksh script to parse in a few queries from a config file, such as this:
findbug \(\(Project 'in' "Deployment,HDRCI,LHS,LSS,WUCI" '&&' Status 'in' "N" '&&' New_on 'lessthan' "070107" \)\) '&&' \(Class... (9 Replies)
Hi,
I am trying to write stuff to a shared memory using a writer, and reading the corresponding stuff using a reader. I am facing problems while releasing the lock, as a result of which I am having segmentation faults. The code is as follows...
/********** writer.c ***********/
... (1 Reply)