9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] Re: advantages of limbo
@ 2004-03-02 15:03 rog
  0 siblings, 0 replies; 48+ messages in thread
From: rog @ 2004-03-02 15:03 UTC (permalink / raw)
  To: 9fans

> Class Thread is not a part of the language. 'synchronized'
> is. What's wrong with Java synchronization? Can you please
> bring an example in Java and limbo where Java's synchronization
> is bad while limbo's approach is right?

a selection from Allen Holub's "Taming Java Threads":

: The "synchronised" keyword has several flaws:
: 
: 	1. You cannot specify a timeout value.
: 	2. You cannot interrupt a thread that is waiting to acquire a lock.
: 	3. You cannot safely acquire multiple locks.
: [...]
: 
: The wait()/notify() system also has problems:
: 	1. There is no way to detect whether wait() has returned normally
: 	or because of a timeout.
: 	2. There is no way to implement a traditional condition variable
: 	that remains in a "signalled" state.
: 	3. Nested-monitor lockout can happen too easily.
: 
: [...]
: 
: More facilities should be added to the language to support inter-thread
: communication. Right now, the PipedInputStream and PipedOutputStream
: classes can be used for this purpose, but they are much too inefficient for
: most applications.
: 
: [...]
: 
: Access to partially constructed objects should be illegal.
: The JLS currently permits access to a partially constructed object.
: For example, a thread created within a constructor can access the object
: being constructed, even though that object might not be fully
: constructed.
: 
: [...]
: 
: The lack of good access control makes threading more
: difficult than necessary. Often, methods don't have to
: be thread safe if you can guarantee that they be called
: only from synchronised subsystems.
: 
: [...]
: 
: The notion of immutability [...] is invaluable in multithreaded
: situations since read-only access to immutable objects doesn't
: have to be synchronised. Java's implementation of immutability
: isn't tight enough for two reasons:
: 
: 	1. It is possible for an immutable object to be accessed before it's
: 	fully created and this access might yield an incorrect value
: 	for some field.
: 	2. The definition of immutable [...] is too loose: Objects addressed by
: 	final references can indeed change state, even though the reference
: 	itself cannot change state.
: 
: [...]
: 
: There is also the problem that both class-level (static) and instance (non-static)
: methods can directly access class-level (static) fields. This access is
: dangerous because synchronising the instance method doesn't
: grab the class-level lock, so a synchronised static method can
: access the class field at the same time as a synchronised instance
: method.
: 
: [...]
: 
: The singleton-destruction problem discussed in Chapter 7 is a serious one.
: [in chapter 7:]
: There is a serious impediment to the correct implementation of Singleton:
: How do you get rid of the thing? The Singleton object is created on
: first use, but what if global resources like temporary files or database
: connections are created by the Singleton's constructor? How do you
: get rid of the temporary file or close the database connection in an
: orderly way? [...] Though I hate to end this section on a pessimistic note,
: I don't have an ideal solution to this problem. If you do, please write to me.
: 
: [...]
: 
: Daemon threads are shut down abruptly when all the non-daemon
: threads terminate. This is a problen when the daemon has created
: some sort of global resource (such as a database connection or a temporary
: file), but hasn't closed or destroyed that resource when it is terminated.
: 
: [...]
: 
: The suspend() and resume() methods should just be put back into
: Java. They're useful, and I don't like being treated like a kindergartener:
: Removing them simply because they are potentially dangerous - a thread
: can be holding a lock when suspended - is insulting. Let me decide
: whether or not I want to use them.
: 
: [...]
: 
: You should be able to interrupt any blocking operation, not just
: wait() and sleep(). [...] Right now, the only way to interrupt a blocking
: I/O operation on a socket is to close the socket, and there's no
: way to interrupt a blocking I/O operation on a file.

with all of these issues, Limbo either ducks the issue (by not
pretending to solve a problem it can't solve properly) or does things
right.



^ permalink raw reply	[flat|nested] 48+ messages in thread
* RE: [9fans] Re: advantages of limbo
@ 2004-03-03  7:37 YAMANASHI Takeshi
  2004-03-03 12:29 ` boyd, rounin
  0 siblings, 1 reply; 48+ messages in thread
From: YAMANASHI Takeshi @ 2004-03-03  7:37 UTC (permalink / raw)
  To: 9fans

On Wed Mar  3 16:34:28 JST 2004, Tiit Lankots wrote:
> (2) Therefore, no-one uses Plan 9.

no, no.  I meant none *positively* uses Plan 9 a lot. :)

ex.
cpu% ps | grep none
none             31    0:00   0:13    1384K Open     httpd
none             33    0:00   0:04     156K Sleep    listen
none             36    0:01   0:05     156K Await    listen
none             41    0:00   0:00     156K Open     listen
none             42    0:00   0:00     156K Open     listen
none             43    0:00   0:00     156K Open     listen
none             44    0:00   0:00     156K Open     listen
none             45    0:00   0:00     156K Open     listen
none             46    0:00   0:00     156K Open     listen
none             47    0:00   0:00     156K Open     listen
none             48    0:00   0:00     156K Open     listen
none             49    0:00   0:00     156K Open     listen
none             50    0:00   0:03     156K Open     listen
none             51    0:00   0:00     156K Open     listen
none             52    0:00   0:00     156K Open     listen
none             53    0:00   0:00     156K Open     listen
none             54    0:00   0:00     156K Open     listen
none             55    0:00   0:00     156K Open     listen
none          30737    0:00   0:00     120K Pread    tcp17010
none          30748    0:00   0:00     184K Rendez   exportfs
-- 




^ permalink raw reply	[flat|nested] 48+ messages in thread
* Re: [9fans] Re: advantages of limbo
@ 2004-03-03  7:21 YAMANASHI Takeshi
  2004-03-03  7:29 ` Kenji Okamoto
  0 siblings, 1 reply; 48+ messages in thread
From: YAMANASHI Takeshi @ 2004-03-03  7:21 UTC (permalink / raw)
  To: 9fans

> In fact, no-one uses Plan 9, right?

Surely, none uses Plan 9 a lot.
-- 




^ permalink raw reply	[flat|nested] 48+ messages in thread
[parent not found: <d02d8014f5f4b58c6863ec7a3cd652ee@proxima.alt.za>]
[parent not found: <918d202b192f1bcb8dd969285010a329@proxima.alt.za>]
* Re: [9fans] Re: advantages of limbo
@ 2004-03-02  8:02 David Presotto
  2004-03-02  8:20 ` David Tolpin
  0 siblings, 1 reply; 48+ messages in thread
From: David Presotto @ 2004-03-02  8:02 UTC (permalink / raw)
  To: 9fans

On the topic of garbage collectors, one of the main reasons for reference
counting objects and immediately releasing them when they become unreachable
was to use garbage collection to allow control not only of memory but also
resources memory represents.  The typical example given is one of windows
that go away as soon as the last reference to them (actually the object representing
them) goes away.  Also, the reference counting had a distinct advantage of
being fixed time.  We had a terrible time with java systems of the time
going away for long periods, both because of the garbage collector going
off and because of the odd interactions in finalize routines in various
classes.

Over the years since limbo appeared, java garbage collection has changed
radicly and often, drasticly reducing the 'time to take a coffee break'
garbage collection runs.  By the 1.4.1 jdk, java included 6 or more
gabage collection strategies and all sorts of tuning parameters.  Along
the way all sorts of user code was written to avoid tickling the collectors
at the wrong time or to get things done before they went off.   That's
a hell of a lot of effort to avoid the small differences advertised by
the proponents of m&s and generational gc over reference counting.

Of course, limbo isn't immune from odd timings.  However, they do require
reference loops and those seem not very common amongst limbo programmers.


^ permalink raw reply	[flat|nested] 48+ messages in thread
[parent not found: <f62d09b11d1f097b3f4b5f6b70b65ea5@proxima.alt.za>]

end of thread, other threads:[~2004-03-03 12:29 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-02 15:03 [9fans] Re: advantages of limbo rog
  -- strict thread matches above, loose matches on Subject: below --
2004-03-03  7:37 YAMANASHI Takeshi
2004-03-03 12:29 ` boyd, rounin
2004-03-03  7:21 YAMANASHI Takeshi
2004-03-03  7:29 ` Kenji Okamoto
2004-03-03  7:31   ` Kenji Okamoto
     [not found] <d02d8014f5f4b58c6863ec7a3cd652ee@proxima.alt.za>
2004-03-02  9:07 ` David Tolpin
2004-03-02 10:04   ` lucio
2004-03-02 10:08     ` Fco.J.Ballesteros
2004-03-02 11:35       ` matt
2004-03-02 18:38         ` boyd, rounin
2004-03-02 19:03           ` Fco.J.Ballesteros
2004-03-02 19:10             ` rog
2004-03-02 19:08               ` Fco.J.Ballesteros
     [not found] <918d202b192f1bcb8dd969285010a329@proxima.alt.za>
2004-03-02  8:37 ` David Tolpin
2004-03-02  8:02 David Presotto
2004-03-02  8:20 ` David Tolpin
2004-03-02  8:55   ` David Presotto
2004-03-02  9:20   ` Rob Pike
     [not found] <f62d09b11d1f097b3f4b5f6b70b65ea5@proxima.alt.za>
2004-03-02  6:58 ` David Tolpin
2004-03-02  7:06   ` Fco.J.Ballesteros
2004-03-02  7:08     ` David Tolpin
2004-03-02  7:14       ` Fco.J.Ballesteros
2004-03-02  7:30         ` David Tolpin
2004-03-02  7:37           ` Fco.J.Ballesteros
2004-03-02  7:48             ` David Tolpin
2004-03-02  9:50               ` Fco.J.Ballesteros
2004-03-02 20:50               ` Andrew Simmons
2004-03-02 20:56                 ` matt
2004-03-02 20:57                   ` ron minnich
2004-03-02 12:44           ` Bruce Ellis
2004-03-02  7:50   ` lucio
2004-03-02  7:56     ` David Tolpin
2004-03-02  8:12       ` Charles Forsyth
2004-03-02  8:12         ` David Tolpin
2004-03-02  8:45           ` Charles Forsyth
2004-03-02  8:51             ` David Tolpin
2004-03-02  9:06               ` David Presotto
2004-03-02  9:14                 ` David Tolpin
2004-03-02  9:26                   ` Charles Forsyth
2004-03-02 15:04       ` rog
2004-03-02 15:12         ` David Tolpin
2004-03-02 16:03         ` C H Forsyth
2004-03-02 16:06           ` David Tolpin
2004-03-02 16:24             ` David Tolpin
2004-03-02 16:35             ` C H Forsyth
2004-03-02 17:18     ` andrey mirtchovski
2004-03-02 12:39   ` Bruce Ellis

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).