Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9204237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:39:50+00:00 2026-06-17T23:39:50+00:00

For one of my learning projects I have a set of erlang processes (different

  • 0

For one of my “learning projects” I have a set of erlang processes (different modules implementing gen_server). Each of this processes spawns and supervises a child process which consists in a single module not implementing otp behaviour.

therefore I have the following situation:

gen_server_a <-> module_a
gen_server_b <-> module_b
gen_server_c <-> module_c

Each child process does the same set of things:

  1. register itself with the name of the module (e.g. module_a)
  2. does some operations based on configuration parameters passed by parent during spawning
  3. receives commands from parent using its registered name

Now, I know that this is far from perfect. I would like to abstract the architecture in order to have still 3 gen_servers, but only one beam file for the child part so that I could achieve something like:

gen_server_a <-> module_generic (registered as module_a)
gen_server_b <-> module_generic (registered as module_b)
gen_server_c <-> module_generic (registered as module_c)

how can I achieve something like this? Just passing during the spawning an atom to be used for registering the process? Is there any other option?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:39:52+00:00Added an answer on June 17, 2026 at 11:39 pm

    In module_generic build an own start_link/1 which spawns the process function and then registers the Pid:

      start_link(Name) ->
        Pid = spawn_link(?MODULE, loop, []),
        register(Name, Pid),
        Pid.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have started learning HTTPUNIT and found one basic example. In this example it
I'm learning some DirectX programming by re-implementing some DirectX code into different projects, I
i have done some learning on struts based on one project that i got.Now
Ok so I am like one day into learning objective c. I know this
I am learning JPA and have one question: In which situations we need more
I was learning Core Data and previously I have used SQLite in one of
Apologies for the generic nature of this question. I have been learning Java for
I'm learning django with this excellent book Practical Django Projects. I was able to
I'm learning C++ for one of my CS classes, and for our first project
I am learning WCF,one of the benefits of WCF is that you can use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.