Issues about server multi-threading on L4Re

李 鼎基 lidingji1997 at hotmail.com
Fri Sep 21 17:17:47 CEST 2018


Oh yes! Actually I used the version without arguments.
Now I think I can try to fix this problem with the constructor with arguments.

Thank you very much!

From: Jakub Jermar<mailto:jakub.jermar at kernkonzept.com>
Sent: Friday, September 21, 2018 23:12
To: 李 鼎基<mailto:lidingji1997 at hotmail.com>
Subject: Re: Issues about server multi-threading on L4Re

On 09/21/2018 05:02 PM, 李 鼎基 wrote:
> Actually, I’ve tried to run the server loop in only one thread (a new
> thread created by “pthread_create”, NOT the main thread) on server.
>
> Theoretically, it should perform the same as running the server loop in
> the main thread, but the server still gets stuck.

How did you create your Object_registry / Registry_server - there is a
version for the main thread which has constructor without arguments [0]
and uses the main thread - and then there is a version with a
constructor that takes arguments [1], among which is a server thread.
You need to use the second version to tell it about your new thread. Can
it be that you are using the version without arguments?

[0]
https://l4re.org/doc/classL4Re_1_1Util_1_1Registry__server.html#a694a009623e0bce2faf1d6699cba8720
[1]
https://l4re.org/doc/classL4Re_1_1Util_1_1Registry__server.html#ad88c4355e64763ae2a6948c12d18578c

HTH,
Jakub

>
> ------------------------------------------------------------------------
> *发件人:* l4-hackers <l4-hackers-bounces at os.inf.tu-dresden.de> 代表
> Jakub Jermar <jakub.jermar at kernkonzept.com>
> *发送时间:* Friday, September 21, 2018 10:26:12 PM
> *收件人:* l4-hackers at os.inf.tu-dresden.de
> *主题:* Re: Issues about server multi-threading on L4Re
>
> Hi there!
>
> On 09/21/2018 02:10 PM, 李 鼎基 wrote:
>> I’m trying to implement some multi-threading IPC benchmarks on L4Re.
>> Following the /“shared_ds”**/demo, firstly, I create 8 threads to send
>> IPC on client and receive them all on server’s main thread.
>>
>> The server loops, waits for the requests and handles them in the
>> “dispatch” function. This single-thread server works well.
>>
>>
>>
>> Then I want to create 8 threads in server (so that it can serve the
>> client thread-to-thread).
>>
>> I wrap the “server.loop();” in a “thread_fn” and use “pthread_create” to
>> create more threads, however, the server will get stuck.
>>
>> There are some printings after entering thread_fn so that I can make
>> sure new threads are created and executed except the server.loop part.
>
> I guess the problem is in that you are trying to use the same server
> loop for all your threads. The server loop is associated with a single
> server thread that executes the server objects. In other words, all but
> the thread which is associated with your server loop just block there
> and don't receive any IPC calls.
>
>> In order to serve different requests concurrently, is there any way to
>> create a multi-threading server?
>
> In theory (never tried that myself), you can try giving a separate
> server loop to each of your threads. You will then need to register your
> server object at each of them. The end result should be that your client
> threads are each connected to a different IPC gate which has its own
> bound server thread. All of these gates carry the label of the same
> server object which will be invoked when an IPC call arrives at any of them.
>
> HTH,
> Jakub
>
> --
> Kernkonzept GmbH at Dresden, Germany, HRB 31129, CEO Dr.-Ing. Michael
> Hohmuth
>
> _______________________________________________
> l4-hackers mailing list
> l4-hackers at os.inf.tu-dresden.de
> http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers

--
Kernkonzept GmbH at Dresden, Germany, HRB 31129, CEO Dr.-Ing. Michael
Hohmuth

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://os.inf.tu-dresden.de/pipermail/l4-hackers/attachments/20180921/7914151e/attachment.htm>


More information about the l4-hackers mailing list