I also think pinning could have some utility. I do see the point that
perfect work stealing would make most pinning useless.
speed, sometimes that is relevant.
characteristic that way, e.g. an OS thread with the lowest possible
task only.
OS thread) for particular blocking (C) operations, not sure.
Post by Marc FeeleyI agree that more low-level stuff could be implemented with this low-level
mechanism (pinning). The problem is that these things might interfere with
the implementation of important features, such as automatic load balancing.
This is a recurring tradeoff when designing a system⊠exposing low level
implementation features gives more control to the user/programmer but later
in the design cycle it may hinder or prevent implementing some other
features.
Anyway, Iâll have to think about this specific case⊠I think thread
pinning may be OK with the current model that each processor has its
dedicated thread run queue.
Marc
Post by Dimitris Vyzovitispinning, if exposed, should be sufficient to implement it purely in
userland.
Post by Dimitris Vyzovitisit would be immediately useful for my heap dumper -- i could use it to
get a
Post by Dimitris Vyzovitisvector of stills from all processors with the
count-still-objects/get-still-objects
Post by Dimitris Vyzovitisprocedures before starting the walk and use that to ensure that all
stills (at the
Post by Dimitris Vyzovitisbeginning of the walk) are accounted for.
it would also be useful for implementing a parallel dispatch primitive
that utilizes
Post by Dimitris Vyzovitisall cores maximally. say you have a parallel algorithm that you want to
decompose
Post by Dimitris Vyzovitisinto per core tasks, that could be accomplished with on-all-processors
(or a similar
Post by Dimitris Vyzovitisprimitive based on pinning). and it doesn't have to be a compute
algorithm, i/o could
Post by Dimitris Vyzovitisbenefit too.
-- vyzo
The SMP scheduler support âpinningâ threads to processors, so perhaps
this is implementable. However⊠why do you need this? I donât like
exposing the processor concept or pinning, which are low-level concepts.
Post by Dimitris VyzovitisMarc
Post by Dimitris Vyzovitisperhaps the "don't switch" semantics are too much.
a simpler general purpose primitive would be an `on-all-processors`
that spawns
Post by Dimitris VyzovitisPost by Dimitris Vyzovitisa thread on each processor to execute the thunk and completes when all
thunks
Post by Dimitris VyzovitisPost by Dimitris Vyzovitishave completed.
that's likely implementable without any deep support from the runtime.
-- vyzo
well, perhaps we can think about the right primitive for Scheme level
operations.
Post by Dimitris VyzovitisPost by Dimitris Vyzovitisthe semantics could be something like "execute this thunk on all
processors, and
Post by Dimitris VyzovitisPost by Dimitris Vyzovitisdon't do any switches until it has finished executing".
-- vyzo
on_all_processors was designed for the lowest-level of the runtime
system, I donât think it is possible for the operation to be in Scheme
(Iâll have to thinks about what the constraints are on the operation).
procedures!
Post by Dimitris VyzovitisPost by Dimitris VyzovitisPost by Dimitris VyzovitisSomething like (on-all-processors thunk) would be awesome.
-- vyzo
Yes each processor has its own still_objs list and to account for
all still objects you must iterate over the processors. In order to avoid
modification of the still_objs lists while doing this the best approach is
to use the barrier operation mechanism. That way all processors (but one)
will be idle while iterating (or you could have all processors cooperate).
This is done with the âon_all_processorsâ function. For an example, check
out ___garbage_collect or ___fdset_resize in lib/setup.c .
Post by Dimitris VyzovitisPost by Dimitris VyzovitisPost by Dimitris VyzovitisMarc
Post by Dimitris Vyzovitishttps://gist.github.com/vyzo/ab4219382c0870779991d4c701921d2c
The limitation is that the still_objs_ is per processor, and not
vm-wide.
Post by Dimitris VyzovitisPost by Dimitris VyzovitisPost by Dimitris VyzovitisPost by Dimitris VyzovitisDoes that mean we would have to crawl all processors in SMP?
-- vyzo
On Thu, Feb 1, 2018 at 3:16 PM, Marc Feeley <
thanks Guillaume!
this is a great start for me -- i am helping fare debug a memory
leak, and it's really hard to identify
Post by Dimitris VyzovitisPost by Dimitris VyzovitisPost by Dimitris VyzovitisPost by Dimitris Vyzovitiswithout dumping the heap to see what kind of object is leaking.
For your information I discovered a few memory leaks with the
networking functions. They were due to âsockaddrâ structures being
converted to âstillâ Scheme objects with a reference count = 1, but the
reference count was never decremented (with ___release_scmobj). This has
been fixed in the recent UDP commit.
in the runtime system. So it might be useful to debug this to have a
function that returns a list of all the âstillâ Scheme objects that have a
reference count != 0. This should be easy to write⊠the GC maintains a
list of the still objects in the C variable âstill_objsâ.
any still objects with non-zero ref counts.
_______________________________________________
Gambit-list mailing list
https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list