Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is a group leader

Tags:

elixir

I am trying to configure out, what is a group leader and how it is related with I/O module, but could not find anything useful in internet. Can please someone explain me?

I have following scenario from elixir 1.2 book(Dave Thomas):
enter image description here

On the second window, why does he pass :erlang_group_leader? For what it is good for?

like image 422
softshipper Avatar asked Mar 30 '16 20:03

softshipper


People also ask

What is a role of group leader?

Group leaders supervise, coordinate, instruct, and manage groups in a variety of settings. Depending on their field, group leaders may require specific qualifications and additional skills. Group leaders can work in education, finance, engineering, human resources, healthcare, and more.

What is a group leader in school?

Group Leaders are the key liaison and main contact point for school staff, students and parents. They are expected to share certain responsibilities in helping with any problems students may have during their stay.

What does group leader mean TikTok?

The meteoric rise of TikTok Sometimes, you have a friend group where a specific person always has to be the center of everything. The group leader trope paints the alpha as always controlling, manipulative and scheming against their own friends.

What does it take to be a group leader?

Team leaders should communicate information consistently and clearly to their team. A good team leader is also a skilled listener who can accept and act on feedback, suggestions and concerns from team members.


1 Answers

From documentation:

group_leader() -> pid()

Returns the process identifier of the group leader for the process evaluating the function.

Every process is a member of some process group and all groups have a group leader. All I/O from the group is channeled to the group leader. When a new process is spawned, it gets the same group leader as the spawning process. Initially, at system start-up, init is both its own group leader and the group leader of all processes.

And:

group_leader(GroupLeader, Pid) -> true

Types:

GroupLeader = Pid = pid()

Sets the group leader of Pid to GroupLeader. Typically, this is used when a process started from a certain shell is to have another group leader than init.

See also group_leader/0.

There is also some Elixir-specific documentation:

By modelling IO devices with processes, the Erlang VM allows different nodes in the same network to exchange file processes in order to read/write files in between nodes. Of all IO devices, there is one that is special to each process: the group leader.

The group leader can be configured per process and is used in different situations. For example, when executing code in a remote terminal, it guarantees messages in a remote node are redirected and printed in the terminal that triggered the request.

like image 148
Greg Avatar answered Oct 13 '22 11:10

Greg