It is currently Fri, 30 Sep 2022 09:54:23 GMT



 
Author Message
 Regarding locks and global variables
Hi,

I have a global linked list to which I add nodes through func_a() and consume
nodes from func_b().

func_a() creates a new node and add it to the list, no existing node in the
linked list is modified. The linked list is accessed by func_a() only to add a
node.

func_b() simply uses the nodes in the linked list.

The linked list is a singly-linked list. func_a() will add nodes to the end of
the linked list and func_b() will use nodes from the start of the linked list.

Since it is a global linked list should I be using locks ?? I am relatively new
to the concept of locks. The code would be executed on a SMP(multi-processor)
and non-SMP machine.

Would help if I could get some inputs on the above.  Any site which talks of
locks and multi-processor machines would also help.

Would I have a problem only on multiprocesor machines or would the problem also
occur if I have multiple processes calling func_a() and func_b() randomly.

All this is done in the driver code. Can locks be shared ??

Thanks and Regards,
Mala



 Sun, 23 Oct 2005 22:02:37 GMT   
 
   [ 1 post ] 

Similar Threads

1. Regarding locks and global variables

2. file contents into variable, or global variable from shell script

3. Mutex locks vs. Condition variable locks

4. EXPORTING global variables...

5. global env. variables for tcsh

6. accessing a global variable

7. initialize the global variables in .so files

8. Unaligned access (bus error) on Solaris on global variable

9. defining global environment variable


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software