On Mar 30, 9:24 am, Gabrielle <wynut...@gmail.com> wrote:
> Heya,
>
> I'm a PhD student at the University of Southampton. I'm researching
> the how multi-threaded software uses shared resources such as shared
> state and message passing over networks etc, and how those uses change
> across software versions. I want to read through the source code but
> don't have a great understanding of multi-threaded C so if anyone
> could give me pointers or a general description about how the shared
> variables/condition variables are used and for what conceptual purpose
> I would be much obliged.

  In summary:   C doesn't support multi-threading.

  There are primitives that will split a process into either two
distinct processes (no ability to share directly) or spawn a thread
starting with another function call.

  All memory available to a process is available to all threads.  It
is up to the programmer to access this memory safely.  posix threads
provides locking primitives that come with some memory barriers as
well as some condition mechanisms to wait for signal from other
threads.

  But you're pretty well on your own.

  Our structures in memcached primarily fall into one of two
categories:

   1) shared access via locks whenever needed (e.g. the thing that
holds all your data)
   2) copied per-thread and aggregated via special shared access
functions (e.g. stats)

  Clocks are accessed lazily because time is somewhat advisory, so
access to current time is something that would raise a yellow flag.
In isolation, it's possible for time to stop to a thread, but in
practice, an unrelated memory barrier will cause synchronization of
the thread cache often enough to have it not be harmful.

To unsubscribe from this group, send email to 
memcached+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to