Hello and welcome to the goal and programming language course in this session, we want to talk about
the others concurrency concept.
Length and capacity of a channel and go lengths, as well as capacity only applies to the Beaufort channel.
The length of the channel is the number of elements that are already during the channel, whereas the
capacity of the buffer channel is the number of elements which the channel can hold.
So length actually represents the number of elements keyed in the buffer of the channel, while capacity
refers to the size of the buffer of the channel.
Hence, the length of the channel is owned weighs less than or equal to the capacity of the channel.
Length function can be used to get the length of the channel, and chat function can be used to get
the capacity off the channel.
Length and capacity up on Beaufort Channel is always zero.
Now let's go to this school with program to illustrate how to find the capacity of the channel first,
creating a channel using make function and set capacity for it.
For example, define a variable like C-H calling equals and in which main function sip and integer variable
like Channel 18th and set five as capacity argument.
Now set data to Channel Channel Channel Operator and send 10 value for it.
Now finding the length and capacity of the channel using lean in channel functions.
So you're right, if Len Caller first and the back is lost, he and Colin Glen function and passes as
arguments to eat and go to the next line.
If if!
And Cha Caller first, then the back is left hand and invoking chat function and sets this variable
as arguments to it.
Now set another data to Tichina Sea Edge channel operator, for example, send 20 value to the channel
and again finding the length and capacity of the channel.
So copied these two lines.
And paste here for new value of the channel and a gain, said the other data, showing that, for example,
search channel operator and send 30 value to the internet.
And again finding the length and capacity of the channel.
So paste these two lines here again, the format they code, save the projects and execute the program.
Go from that fake, useless name that glow.
Now we can see the out in the above code, the first created the channel of capacity fine after death
that we keep sending some value to the channel, as you can notice from your output that after each
sent operation to the lengths up channel increases by one, while capacity is always the same, which
is fine.
So we could fetch lengths and capacity of channel by the LAN in cap functions in order not to prolong
the time of decision.
We will finish it and we will continue the content in the next session.
Goodbye.