Category "semaphore"

The pid works only once after the two calls to scanf

This program creates a pid and shares two integers (base and height) through the shared memory. The parent process time asks four times to insert two integers a

How to establish semaphore between two different files and synchronize data

I am currently working on semaphore concepts ,. I Have two files I have to share data between two files Eg : application1.c It increments one value and shares t

C Producer-Consumer Using PThreads

I am working on a problem where I am implementing a program that mimics the producer-consumer paradigm. The code that I am using works when I only have one prod

Semaphore under uCOS-III

I use uCOS-III under Arm Cortex M4 and have the following problem: If OSSemPend() is executed twice within the same task), like timeout = 100; /* 0.1 s */ OSS

Print the numbers 1 to 100 using 5 semaphores and processes

I have an assignment to write a program in c language that will print to the shell the numbers 1 - 100. I must use 5 processes. The first one will print 1, 6, 1

How to reset a POSIX semaphore?

Maybe I am wrong but it seems to me that the semaphore from this link is missing a reset function. Is there another way to reset its counter? I found this imp

Use semaphores for handling sockets in C

I have the following piece of code: SOCKET sock = open_socket(szListenHost, iListenPort); if (sock > 0) { SOCKET client; struct sockaddr_in peeraddr

Why does Java allows to initialize semaphore with negative permit?

I'm not getting the rationale behind negative permits during initialization of Semaphore (java.util.concurrent.Semaphore). I do know that calls to release() met