[erlang-questions] Does port driver block scheduler threads?
Zabrane Mickael
zabrane3@REDACTED
Tue Jul 3 16:44:06 CEST 2012
Thanks for sharing Joseph.
Zabrane
On Jul 3, 2012, at 4:35 PM, Joseph Wayne Norton wrote:
>
> Zabrane -
>
> Here is a nif and driver implementation for interfacing with leveldb. The contrast/comparison between the two implementations might be helpful.
>
> https://github.com/norton/lets/tree/master/c_src
>
> and a pointer to one of the commands with optional async support:
>
> https://github.com/norton/lets/blob/master/c_src/lets_drv.cc#L577
>
> Not sure if it is simple or not ... but it might help you with your development.
>
> thanks,
>
>
>
> On Jul 3, 2012, at 11:25 PM, Zabrane Mickael wrote:
>
>> Hi Serge,
>>
>> Where one can find a simple driver_async example to learn from?
>>
>> thx
>> Zab
>>
>> On Jul 3, 2012, at 1:37 PM, Serge Aleynikov wrote:
>>
>>> Driver callbacks are executed by a scheduler thread in synchronous
>>> manner, so what you are describing is a normal behavior of a linked-in
>>> driver. Use driver_async to off-load a long computation to another
>>> thread from a pool different from the scheduling threads.
>>>
>>> On 7/3/2012 7:20 AM, Zhemzhitsky Sergey wrote:
>>>> Hi erlangers,
>>>>
>>>>
>>>>
>>>> Recently we have developed port (linked-in) driver and faced with some
>>>> performance issues.
>>>>
>>>>
>>>>
>>>> The port uses ERL_DRV_FLAG_USE_PORT_LOCKING locking mode, so as we
>>>> understand calls to different port instances should have not blocked
>>>> each other.
>>>>
>>>> SMP count is greater than 1.
>>>>
>>>>
>>>>
>>>> So the first question is:
>>>>
>>>> Is it possible to have multiple port instances executing time-consuming
>>>> operation in parallel, i.e. at the same time?
>>>>
>>>>
>>>>
>>>> We expected port instances do not influence on each other. However, all
>>>> the calls are blocked but the first one. So the scheduler thread seems
>>>> to be blocked during the port instance invocation.
>>>>
>>>> Is driver_async function required for the issues like above?
>>>>
>>>> Is it possible to unblock the scheduler thread before erlang:port_call
>>>> completes?
>>>>
>>>>
>>>>
>>>> Best Regards,
>>>>
>>>> Sergey
>>>>
>>>>
>>>>
>>>> _______________________________________________________
>>>>
>>>>
>>>>
>>>> The information contained in this message may be privileged and conf
>>>> idential and protected from disclosure. If you are not the original
>>>> intended recipient, you are hereby notified that any review,
>>>> retransmission, dissemination, or other use of, or taking of any action
>>>> in reliance upon, this information is prohibited. If you have received
>>>> this communication in error, please notify the sender immediately by
>>>> replying to this message and delete it from your computer. Thank you for
>>>> your cooperation. Troika Dialog, Russia.
>>>>
>>>> If you need assistance please contact our Contact Center (+7495) 258
>>>> 0500 or go to www.troika.ru/eng/Contacts/system.wbp
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> erlang-questions mailing list
>>>> erlang-questions@REDACTED
>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>
>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>> Regards,
>> Zabrane
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>
More information about the erlang-questions
mailing list