04-07-2003
A semaphore is a
flag used to insure than
events are
atomic. . Just like a railroad semaphore, the flag provides a signal to one train if another is approaching, helping the conductors of the train avoid a train wreck.
The same is true for software processes that share memory, files, or other software artifacts. A semaphore is used in interprocess communications to insure that there are no 'train wrecks' between software processes.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hi, is there any command where we can monitor semaphores? (1 Reply)
Discussion started by: yls177
1 Replies
2. Programming
I'm running one multithreaded application, in that one of my thread
is waiting infinitely in a semphore. Is there a way to determine, in
which semaphore the particular thread is waiting and which thread(s)
is holding the semaphore. (5 Replies)
Discussion started by: ptprabu
5 Replies
3. UNIX for Advanced & Expert Users
Hi All,
I am going through the semaphore concept and have a doubt regarding the same and hope to get a resolution here.
I have a file which has a number of records.
I want to write an application (in C) which will be able to do concurrent read/write on these records.
Of what I have... (8 Replies)
Discussion started by: maverix
8 Replies
4. Shell Programming and Scripting
Hi,
I am looking to use a semaphore for the first time in one of my scripts. I am just wondering if there are any simple examples or tutorials around?
I am a beginner so the simpler the better :)
Thanks
-Jaken (2 Replies)
Discussion started by: Jaken
2 Replies
5. UNIX for Dummies Questions & Answers
what is semaphore? can any body explain it in a more simple way than the manual ??
replies appreciated
Regards
raguram R (7 Replies)
Discussion started by: raguramtgr
7 Replies
6. Programming
In my server code there is a thread per client...
The server call accept() and after that start the thread.
So there is a thread for client that save in RAM the client's message, that will be send to other clients.
Now in RAM I have created a shared memory in which thread read and write(save)... (2 Replies)
Discussion started by: italian_boy
2 Replies
7. Shell Programming and Scripting
Control two exclusively shared resources(semaphore). The two resources are two files. The producer will write even numbers to one file, and odd numbers to another one. The consumer respectively reads from each file until it gets 5 even numbers and 5 odd numbers.
Can any one help me with the... (0 Replies)
Discussion started by: gokult
0 Replies
8. Programming
If I create a semaphore and then I fork a number of child processes then all the child process use that same semaphore.
Since the process address spaces are different rfom each other then how all the child process are able to access the same semaphore?
I understand that semaphore/mutex is at os... (0 Replies)
Discussion started by: rupeshkp728
0 Replies
9. Solaris
Can anyone tell me abt the Semaphore concept and what is semaphore???
is semaphore id is associated in terms as in resources like semaphore id 1 indicates cpu share unit is given and semaphore id 2 will indicate abt the memore or semaphore id 3 will tell us the i/o components (1 Reply)
Discussion started by: aarjun07
1 Replies
10. UNIX for Beginners Questions & Answers
I was asked to add this piece of code to a c program which I will execute through the shell:
for(long i = 0; i < NITER; i++)
{ sem_wait( &sema);
count++;
sem_post( &sema); }
I didn't get it, which is the critical section ? if it's "count++" how would a thread wake up in order to enter it... (1 Reply)
Discussion started by: uniran
1 Replies
LEARN ABOUT DEBIAN
liblinear-train
LIBLINEAR-TRAIN(1) General Commands Manual LIBLINEAR-TRAIN(1)
NAME
liblinear-train - train a linear classifier and produce a model
SYNOPSIS
liblinear-train [options] training_set_file [model_file]
DESCRIPTION
liblinear-train trains a linear classifier using liblinear and produces a model suitable for use with liblinear-predict(1).
training_set_file is the file containing the data used for training. model_file is the file to which the model will be saved. If
model_file is not provided, it defaults to training_set_file.model.
To obtain good performances, sometimes one needs to scale the data. This can be done with svm-scale(1).
OPTIONS
A summary of options is included below.
-s type
Set the type of the solver:
0 ... L2-regularized logistic regression
1 ... L2-regularized L2-loss support vector classification (dual) (default)
2 ... L2-regularized L2-loss support vector classification (primal)
3 ... L2-regularized L1-loss support vector classification (dual)
4 ... multi-class support vector classification
5 ... L1-regularized L2-loss support vector classification
6 ... L1-regularized logistic regression
7 ... L2-regularized logistic regression (dual)
-c cost
Set the parameter C (default: 1)
-e epsilon
Set the tolerance of the termination criterion
For -s 0 and 2:
|f'(w)|_2 <= epsilon*min(pos,neg)/l*|f'(w0)_2, where f is
the primal function and pos/neg are the number of positive/negative data
(default: 0.01)
For -s 1, 3, 4 and 7:
Dual maximal violation <= epsilon; similar to libsvm (default: 0.1)
For -s 5 and 6:
|f'(w)|_inf <= epsilon*min(pos,neg)/l*|f'(w0)|_inf, where f is the primal
function (default: 0.01)
-B bias
If bias >= 0, then instance x becomes [x; bias]; if bias < 0, then
no bias term is added (default: -1)
-wi weight
Weight-adjusts the parameter C of class i by the value weight
-v n n-fold cross validation mode
-q Quiet mode (no outputs).
EXAMPLES
Train a linear SVM using L2-loss function:
liblinear-train data_file
Train a logistic regression model:
liblinear-train -s 0 data_file
Do five-fold cross-validation using L2-loss SVM, using a smaller stopping tolerance 0.001 instead of the default 0.1 for more accurate
solutions:
liblinear-train -v 5 -e 0.001 data_file
Train four classifiers:
positive negative Cp Cn
class 1 class 2,3,4 20 10
class 2 class 1,3,4 50 10
class 3 class 1,2,4 20 10
class 4 class 1,2,3 10 10
liblinear-train -c 10 -w1 2 -w2 5 -w3 2 four_class_data_file
If there are only two classes, we train ONE model. The C values for the two classes are 10 and 50:
liblinear-train -c 10 -w3 1 -w2 5 two_class_data_file
Output probability estimates (for logistic regression only) using liblinear-predict(1):
liblinear-predict -b 1 test_file data_file.model output_file
SEE ALSO
liblinear-predict(1), svm-predict(1), svm-train(1)
AUTHORS
liblinear-train was written by the LIBLINEAR authors at National Taiwan university for the LIBLINEAR Project.
This manual page was written by Christian Kastner <debian@kvr.at>, for the Debian project (and may be used by others).
March 08, 2011 LIBLINEAR-TRAIN(1)