September 10, 2021

On 9/10/21 7:47 AM, eugene wrote:

>

On Friday, 10 September 2021 at 11:09:10 UTC, bauss wrote:

>

--DRT-gcopt=parallel:2 on the command line. A value of 0 disables parallel marking completely.

but it does not:

make -f Makefile-dmd
dmd --DRT-gcopt=parallel:0 engine/.d common-sm/.d server-sm/.d pool.d echo_server.d -ofecho-server
dmd --DRT-gcopt=parallel:0 engine/
.d common-sm/.d client-sm/.d pool.d echo_client.d -ofecho-client

ps xH | grep [e]cho
 5460 pts/14   Sl+    0:00 ./echo-server
 5460 pts/14   Sl+    0:00 ./echo-server
 5460 pts/14   Sl+    0:00 ./echo-server
 5460 pts/14   Sl+    0:00 ./echo-server
 5466 pts/15   Sl+    0:00 ./echo-client
 5466 pts/15   Sl+    0:00 ./echo-client
 5466 pts/15   Sl+    0:00 ./echo-client
 5466 pts/15   Sl+    0:00 ./echo-client

--DRT... is a d runtime switch, which is processed while running your program, not by the compiler.

Try ./echo-client --DRT-gcopt=parallel:0

There is also a way to add this to your program so it's not needed on the command line.

-Steve

September 10, 2021
On Friday, 10 September 2021 at 11:53:04 UTC, eugene wrote:
> On Friday, 10 September 2021 at 11:32:02 UTC, Adam D Ruppe wrote:
>> You either pass as an argument *to your application*
>> --DRT-gcopt=parallel:0
>
> oops... :)

ps xH | grep [e]cho
 5727 pts/14   S+     0:13 ./echo-server --DRT-gcopt=parallel:0
 5762 pts/15   S+     0:12 ./echo-client --DRT-gcopt=parallel:0

thanks everybody for answers!

September 10, 2021
btw why do the threads cause you trouble?
September 10, 2021
On Friday, 10 September 2021 at 12:10:58 UTC, Adam D Ruppe wrote:
> btw why do the threads cause you trouble?

Well... probably it is subjective thing -
just do not 'like' when a program is doing something
that is not explicitly in it's source (I am C coder, you guessed).

More specifically - I have event driven state machine engine
(reactor pattern, written in C), which I have been using
over recent 5 years in various data acquisition and
network client/servers programs. All these programs
by their nature are single-threaded, since
'event/message driven' + 'state machines' combination gives me very
high-grained concurrency within single thread
(and I don't like fibers/greenlets/coroutines).

Recently I tried to re-implement that engine in D
(I also tried Rust and C#, but D appeared to be less 'problematic').
I can give a link to sources of those echo-client/server pair
if someone is interested (but there is a 'little' problem
remained - when compliled with dmd, it sometimes crashes
upon receiving SIGINT).

September 10, 2021
On Friday, 10 September 2021 at 12:46:36 UTC, eugene wrote:
> On Friday, 10 September 2021 at 12:10:58 UTC, Adam D Ruppe wrote:
>> btw why do the threads cause you trouble?
>
> Well... probably it is subjective thing -
> just do not 'like' when a program is doing something
> that is not explicitly in it's source (I am C coder, you guessed).
>
> More specifically - I have event driven state machine engine
> (reactor pattern, written in C), which I have been using
> over recent 5 years in various data acquisition and
> network client/servers programs. All these programs
> by their nature are single-threaded, since
> 'event/message driven' + 'state machines' combination gives me very
> high-grained concurrency within single thread
> (and I don't like fibers/greenlets/coroutines).
>
> Recently I tried to re-implement that engine in D
> (I also tried Rust and C#, but D appeared to be less 'problematic').
> I can give a link to sources of those echo-client/server pair
> if someone is interested (but there is a 'little' problem
> remained - when compliled with dmd, it sometimes crashes
> upon receiving SIGINT).

Well the program you're writing is still single-threaded.

The GC only uses the other threads when sweeping so the program flow will still be single-threaded and the exact same.

It's just used to speed-up the GC.
September 10, 2021
On Friday, 10 September 2021 at 12:59:08 UTC, bauss wrote:
> It's just used to speed-up the GC.

Yeah, I got the point, but to be absolutely honest,
I (>20 years of C coding) do not like GC as such.
I believe manual free() is not that 'hard'.
And one must still release other resources.
(in C I write just close(fd), in D I write client.destroy() -
in both cases I have to do this manually,
if that fd was obtained in absolutely another scope)

Yes, I know, I can do without GC in D, just did not tried yet
(started learning D two months ago or so)

And again - I've chosen D (not Rust), because
'borrow checker' and especially 'explicit lifetimes'
is a nightmare :) - i would rather accept GC.


1 2
Next ›   Last »