Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #3379

Re: A question about synchronized threads

From byhesed <byhesed@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: A question about synchronized threads
Date 2011-04-30 09:12 -0700
Organization http://groups.google.com
Message-ID <d47538d1-fe49-40be-96d2-cb14a56b4add@x8g2000prh.googlegroups.com> (permalink)
References <3f249d87-aaf8-4732-9ee8-fd112cf82553@f31g2000pri.googlegroups.com> <ipemsm$7nc$1@news.albasani.net> <8b7289b0-2b52-44f9-96a9-fe1d2661de11@k3g2000prl.googlegroups.com> <922offF2frU1@mid.individual.net>

Show all headers | View raw


On 5월1일, 오전12시34분, Robert Klemme <shortcut...@googlemail.com> wrote:
> On 29.04.2011 18:12, byhesed wrote:
>
> > On 4월30일, 오전12시53분, Lew<no...@lewscanon.com>  wrote:
> >> What do you mean by "better"?  What precisely is not the way you want it?
> >> What is your standard of effectuality?
> > If too much spaces are marked as critical regions,
> > then the program will not be optimized.
> > It wastes too much time in waiting for obtaining a right to access
> > critical regions.
>
> > So, in my question, better means optimization when using threads.
>
> There is no one size fits all answer to that question.  It completely
> depends on the nature of your application.  For example, if read
> accesses vastly outnumber write accesses you will get significant
> improvements by using read write locks.  If it is the other way round
> you won't notice a big difference between using "synchronized" and a
> read write lock (because most of the time the exclusive write lock will
> be used).
>
> In other situations not sharing mutable state (i.e. copying mutable
> state or using immutable state) might be the best solution.  Or you use
> a thread safe data structure such as copy on write list.
>
> There is a whole, big toolbox for writing scalable thread safe
> applications.  Eric has it exactly right with his suggestion because the
> nature of the state (shared, not shared, mutable, immutable) is the
> important aspect to reason about.  I recommend reading Doug Lea's
> excellent book on the matter.
>
> Kind regards
>
>         robert
>
> --
> remember.guy do |as, often| as.you_can - without endhttp://blog.rubybestpractices.com/

Thank you, I'll read it.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: A question about synchronized threads Robert Klemme <shortcutter@googlemail.com> - 2011-04-30 17:34 +0200
  Re: A question about synchronized threads byhesed <byhesed@gmail.com> - 2011-04-30 09:12 -0700
  Re: A question about synchronized threads Deeyana <d.awlberg@hotmail.invalid> - 2011-04-30 19:43 +0000
    Re: A question about synchronized threads Lew <noone@lewscanon.com> - 2011-05-03 18:47 -0400
      Re: A question about synchronized threads Deeyana <d.awlberg@hotmail.invalid> - 2011-05-04 00:12 +0000
        Re: A question about synchronized threads Lew <noone@lewscanon.com> - 2011-05-03 23:35 -0400
          Re: A question about synchronized threads Deeyana <d.awlberg@hotmail.invalid> - 2011-05-04 07:05 +0000
            Re: A question about synchronized threads Lew <noone@lewscanon.com> - 2011-05-04 12:44 -0400
              Re: A question about synchronized threads Deeyana <d.awlberg@hotmail.invalid> - 2011-05-04 19:57 +0000

csiph-web