Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Run multiple components in one "process" #97

Open
senier opened this issue Sep 25, 2019 · 6 comments
Open

Run multiple components in one "process" #97

senier opened this issue Sep 25, 2019 · 6 comments

Comments

@senier
Copy link
Member

senier commented Sep 25, 2019

This could also mean that all components run on a microcontroller with a bare-metal runtime.

We need:

  • Image containing multiple components
  • "Kernel" scheduling components
@jklmnn
Copy link
Member

jklmnn commented Mar 3, 2020

@jklmnn
Copy link
Member

jklmnn commented Mar 9, 2020

About the fancy variant of different "programs" using the same runtime there's an interesting question on StackOverflow: https://stackoverflow.com/questions/25172834/how-to-create-static-linked-shared-libraries

@jklmnn
Copy link
Member

jklmnn commented Jun 5, 2020

After some research and discussions I've come to the conclusion that creating a binary with multiple similar static libraries requires a significant amount of work. Since all applications have the same namespace and symbol names (at least for Components) we would have to link and locate the libraries manually as the usual tools would always find collisions. This would also include a patched gnatbind to correctly generate the elaboration code without reinitializing the runtime.

An alternative solution would be to move each application into its own namespace. As a convention the initialization could still be done in <Name>.Component (now it is just Component). This would make it possible to include all applications into the main project file and have them linked correctly. It would still allow to keep our current dynamic linking procedure. If the toplevel package is named equally to the library the symbol could be generated from the library name.
On Genode the package name doesn't matter at all since we export a specific symbol name to C++.
cc @Fabien-Chouteau

jklmnn added a commit that referenced this issue Jun 8, 2020
jklmnn added a commit that referenced this issue Jun 8, 2020
jklmnn added a commit that referenced this issue Jun 8, 2020
jklmnn added a commit that referenced this issue Jun 8, 2020
jklmnn added a commit that referenced this issue Jun 9, 2020
jklmnn added a commit that referenced this issue Jun 9, 2020
jklmnn added a commit that referenced this issue Jun 9, 2020
jklmnn added a commit that referenced this issue Jun 9, 2020
jklmnn added a commit that referenced this issue Jun 10, 2020
jklmnn added a commit that referenced this issue Jun 10, 2020
jklmnn added a commit that referenced this issue Jun 10, 2020
@jklmnn
Copy link
Member

jklmnn commented Aug 28, 2020

After some separate discussion, using a separate namespace for each component and compiling them into their own static libraries seems to be the best solution. The initial idea was to build all components as static libraries and register them via their elaboration code. However since the elaboration code is not executed in units that are not withed some code has to be generated anyway. So instead of registering components there will be a generated startup procedure that calls all component constructors in order.

@Fabien-Chouteau
Copy link

What do you mean by using separate namespace? Prefixing all package names?

In which situation do you want to elaborate units that are not withed?

@jklmnn
Copy link
Member

jklmnn commented Aug 28, 2020

What do you mean by using separate namespace? Prefixing all package names?

Packages that implement a component all have to be a child package of a package named after the component since they are all compiled into a single binary.

In which situation do you want to elaborate units that are not withed?

The original idea was that all components are compiled into static libraries that are withed into the project. When their elaboration code is run they register on a globally known instance. However since their code is never used directly their elaboration code is never run.

jklmnn added a commit that referenced this issue Aug 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants