hallo!
if there are many processes running and I initialize the semaphore like this:
my_sem = sem_open(SEM_NAME, O_CREAT | O_RDWR,
S_IRUSR | S_IWUSR, 10;
(the last argument is 10)
and then i use
sem_wait(my_sem);
sleep(0);
sem_post;
Will 10 processes be able to access the critical section on the same time and sleep or only one process can do that?
And if not how is it possible t
I'm trying to find a simple way to ensure exclusive access to a resource by several processes, while at the same time make sure that whichever process asked for the resource first will get it first.
In this simple shell script:
flock a-resource sleep 6 &
for i in 1 2 3 4 5; do
sleep 1
flock a-resource echo "$i" &
done
wait
(flock(1) uses flock(2)), we've got one process (sleep) hol
So basically I want to suspend a bit the child process after it's creation, just so the parent prepare some data for it in a shared memory.
When I run top -bi, where the parameter -i means "ignore idle processes", the resulted list(see below) of processes are either R or D, although there're S processes at that time.
So, why uninterruptible sleep is not counted as "idle"?
I use awesome off to turn my pad on and off so I don't have to use the power switch all the time. I always do this so I don't have to go through the whole boot up process when I want to use it. I noticed that when I wake up in the morning the pad is dead or almost dead. Is there a better way to put this to sleep at night? There is always so much stuff running that kills the battery.
I have been experimenting with the time command(/usr/bin/time).
I have something that I've been staring at for most of the night and can't figure out. I'm writing code in C that is supposed to use pipes to pass a byte back and forth, allowing me to switch between a parent and child process that will take turns writing a string to a file.
I have a scenario where a server process needs to synchronize its access to shared memory segments with hundreds of client processes.
I have been trying to figure this out for a bit now, and Google is failing me quite well, as well as any books I can lay my hands on. When dealing with the Linux kernel and processes, what is a ctxts? I've been able to find some information about ctxt, but only can find code references to ctxts, with no type of definition or anything.