wrong behavior binary semaphore

Arturo Perez Garcia arturo.perez at upm.es
Fri Nov 30 14:23:27 UTC 2018


Hello,

I did more tests using the same source files. But modifying the priority 
of the threads and the scheduling algorithm used in the creation of the 
semaphore. What I was expecting (and what I need) is this:

task 1 start
ld adq by kernel. kern_1
ld rel by kernel. kern_1
exe adq by kernel: kern_1
sleeping kernel : kern_1
task 2 start
exe rel by kernel: kern_1
ld adq by kernel. kern_2
ld rel by kernel. kern_2
exe adq by kernel: kern_1
sleeping kernel : kern_1
exe rel by kernel: kern_1
exe adq by kernel: kern_2
sleeping kernel : kern_2
exe rel by kernel: kern_2
exe adq by kernel: kern_1
sleeping kernel : kern_1
exe rel by kernel: kern_1
exe adq by kernel: kern_2
sleeping kernel : kern_2

Where the semaphore is sequentially obtained and released by the same 
thread each time it has been acquired.

I was supposing that once a semaphore is acquired by one task, it could 
not be obtained by another task until it was released by the first task 
that acquired it; independently of the tasks priorities. Now, looking at 
the test results I can affirm that there are no errors in RTEMS and my 
supposition was wrong.

Thanks so much for the support Sebastian.

Regards.


El 2018-11-30 12:53, Sebastian Huber escribió:
> On 30/11/2018 11:55, Arturo Perez Garcia wrote:
>> Hello, thanks for the feedback. I checked the confdefs file and the 
>> macro CONFIGURE_MAXIMUM_SEMAPHORES is set to 0 by default. I don't 
>> know why I didn't get those errors.
> 
> I used the RTEMS master to run the test. In RTEMS 4.11 the default
> configuration contains some semaphores may be used by the system.
> 
>> 
>> Once RTEMS is correctly configured. Did you obtain the same results as 
>> me?
> 
> task 1 start
> ld adq by kernel. kern_1
> ld rel by kernel. kern_1
> exe adq by kernel: kern_1
> sleeping kernel : kern_1
> task 2 start
> exe rel by kernel: kern_1
> ld adq by kernel. kern_2
> exe adq by kernel: kern_1
> sleeping kernel : kern_1
> ld rel by kernel. kern_2
> exe rel by kernel: kern_1
> exe adq by kernel: kern_2
> sleeping kernel : kern_2
> exe adq by kernel: kern_1
> sleeping kernel : kern_1
> exe rel by kernel: kern_2
> exe rel by kernel: kern_1
> exe adq by kernel: kern_2
> sleeping kernel : kern_2
> exe adq by kernel: kern_1
> sleeping kernel : kern_1
> exe rel by kernel: kern_2
> exe rel by kernel: kern_1
> 
> Looks all right to me considering that task 1 has a higher priority
> than task 2 and the semaphore uses FIFO ordering.

-- 
Arturo Perez Garcia - arturo.perez at upm.es

Researcher
Center of Industrial Electronics
Universidad Politecnica de Madrid




More information about the users mailing list