Networking Forums

Networking Forums > Computer Networking > Linux Networking > Shared-memory between threads and synchronization .

Reply
Thread Tools Display Modes

Shared-memory between threads and synchronization .

 
 
bobby
Guest
Posts: n/a

 
      03-07-2007, 12:39 PM
Hi everyone,
In my project i am having different data structures
which should have access only for some classes and the structures i
had declared globally, but then i need a restricted access so thought
of using shared memory. The whole project is executed as a single
process and shared memory should be accessed between different
threads. The synchronization i need to provide obviously through
mutexes. So my questions are--

1. Is the idea better to implement shared memory rather than
declaring data structures global?
2. I need to even use signals for transferring the control, is it
feasible?
3. If a thread locked by a mutex and executing a critical section,
and if time-slice for that particular light-
weight process completes at that very
moment, will the thread hold the mutex or according to the time-slice
the OS skips the thread and executes other thread?
4. In any case a "struct sched_param param.sched_priority" need to
be set for particular threads, based on priority or can we manage
synchronization with mutexes itself?

Kindly
answer my querries..

Thanx in advance......

Bobby.

 
Reply With Quote
 
 
 
 
David Schwartz
Guest
Posts: n/a

 
      03-08-2007, 04:56 AM
On Mar 7, 5:39 am, "bobby" <prasad.saratch...@gmail.com> wrote:
> Kindly
> answer my querries..


Your questions reflect such a large lack of basic threading knowledge
that you would do better to read some basic books or web pages on
threading and then come back when you can ask better questions.

All threads have precisely the same view of memory. So when you talk
about shared memory with threads as an option -- there is no other
option!

You seem to have some very basic misconceptions about scheduling
versus synchronization. They are basically unrelated except in some
very limited special cases (such as priority inversion).

Your question about signals doesn't seem to make any sense at all. You
nakedly assert that you "need to use signals", but it's nearly certain
that you don't need to. (Signals are not useful for transferring
control, though it's not clear what you mean by "transferring
control".

You manage synchronization with synchronization primitives such as
mutexes. But why do you ask that in association with scheduling
policy?

DS

 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
codes to initialise the Topology Table as a Shared Memory missy_pink88@hotmail.com Linux Networking 0 07-09-2007 04:07 AM
scheduling threads ? vivekian Linux Networking 2 04-18-2006 04:49 PM
Less Faster Memory or more Slower Memory? Jim Home Networking 13 01-22-2006 11:30 AM
"Not enough memory" error when PCs try to access shared drive on an XP Home PC Martin Underwood Home Networking 1 10-17-2005 11:11 PM
DE-250ct Rev-A shared memory mode Tobius Manning Linux Networking 0 06-24-2003 12:59 PM



1 2 3 4 5 6 7 8 9 10 11