tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pthread library related



Hi guys,

   I have attached patches based on comments from Christos.
The new patch used atomic_inc_uint_nv to limit the number of
sems used by each process. I have tested these patches.
They worked.

2016-05-30 14:19 GMT-07:00 Charles Cui <charles.cui1984%gmail.com@localhost>:

> good to know atomic_inc_uint_nv is implemented using cas.
> I will update the patch and send you guys later (being careful about the
> format)
>
> Thanks Charles
>
> 2016-05-30 13:46 GMT-07:00 Christos Zoulas <christos%zoulas.com@localhost>:
>
>> On May 30,  1:43pm, charles.cui1984%gmail.com@localhost (Charles Cui) wrote:
>> -- Subject: Re: pthread library related
>>
>> | I am not familiar with _nv() (are there examples in the netbsd code
>> base? I
>> | searched _nv() in nxr, but did not found anything meaningful.),
>> | but if you want to use atomic operations, one possible way is
>> | compare-and-swap (CAS).
>> | it has stronger guarantee than atomic inc or atomic dec, but also larger
>> | overhead.
>>
>> man atomic_inc_uint_nv
>>
>> http://nxr.netbsd.org/xref/src/sys/fs/tmpfs/tmpfs_mem.c#185
>>
>> christos
>>
>
>

Attachment: 0001-use-atomic-operations.patch
Description: Binary data

Attachment: 0001-ad-work-plus-getclock-fix.patch
Description: Binary data



Home | Main Index | Thread Index | Old Index