kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Global variables
@ 2015-06-14 11:28 roni
  2015-06-14 11:32 ` Ruben Safir
  0 siblings, 1 reply; 4+ messages in thread
From: roni @ 2015-06-14 11:28 UTC (permalink / raw)
  To: kernelnewbies

I know i should avoid using global variables in kernel programming.

What problem it create if i use more global variables?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Global variables
  2015-06-14 11:28 Global variables roni
@ 2015-06-14 11:32 ` Ruben Safir
  2015-06-14 11:58   ` AYAN KUMAR HALDER
  0 siblings, 1 reply; 4+ messages in thread
From: Ruben Safir @ 2015-06-14 11:32 UTC (permalink / raw)
  To: kernelnewbies

On 06/14/2015 07:28 AM, roni wrote:
> I know i should avoid using global variables in kernel programming.
> 
> What problem it create if i use more global variables?
> 
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 
> 


you step on everyone else's names space.  Do you know how many other
people are collaborating with the kernel.  Stick to your own back yard.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Global variables
  2015-06-14 11:32 ` Ruben Safir
@ 2015-06-14 11:58   ` AYAN KUMAR HALDER
  2015-06-14 12:53     ` Ruben Safir
  0 siblings, 1 reply; 4+ messages in thread
From: AYAN KUMAR HALDER @ 2015-06-14 11:58 UTC (permalink / raw)
  To: kernelnewbies

On Sun, Jun 14, 2015 at 5:02 PM, Ruben Safir <ruben@mrbrklyn.com> wrote:
> On 06/14/2015 07:28 AM, roni wrote:
>> I know i should avoid using global variables in kernel programming.
>>
>> What problem it create if i use more global variables?
>>
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>
>
> you step on everyone else's names space.  Do you know how many other
> people are collaborating with the kernel.  Stick to your own back yard.
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Besides, it hampers reentrancy, unless you use locks(mutex) with each
global variable.
Kernel functions can be called by different processes in parallel and
they might also be
called/scheduled from interrupt context.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Global variables
  2015-06-14 11:58   ` AYAN KUMAR HALDER
@ 2015-06-14 12:53     ` Ruben Safir
  0 siblings, 0 replies; 4+ messages in thread
From: Ruben Safir @ 2015-06-14 12:53 UTC (permalink / raw)
  To: kernelnewbies

On 06/14/2015 07:58 AM, AYAN KUMAR HALDER wrote:
> Besides, it hampers reentrancy, unless you use locks(mutex) with each
> global variable.


This is not necessary a function of globalization of variables, although
it damn sure can be, but... honestly, if he is asking this question, it
is not likely that he yet understands race conditions and critical areas.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-14 12:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-14 11:28 Global variables roni
2015-06-14 11:32 ` Ruben Safir
2015-06-14 11:58   ` AYAN KUMAR HALDER
2015-06-14 12:53     ` Ruben Safir

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).