[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Java and Charles L.Perkins



Dear all

Here is a letter I sent to the author of "teach yourself Java in 21 days"
in March. He did send me an answer after some time. Should this 
community take advantage of this, I'm not sure how to proceed.
Any suggestions?

------------------------------------------------------------------------
From:              Self <Teig>
To:                virtual@xxxxxxxxxxxxxx
Subject:           Java-book, page 367
Date sent:         Mon, 4 Mar 1996 13:42:29

Dear Charles L.Perkins

Thank you for the excellent book "teach yourself Java in 21 days". 
I have a comment to page 367.

I am an embedded programmer, having programmed occam for the last 5
years. Occam is a secure and safe language, no pointers, direct support
of concurrency through CSP (not monitor) with PAR and CHAN, usage rules
and test of usage of common resources, side-effect free evaluations, and
PROC and FUNCTION are orthogonal (PROC can communicate with other tasks,
FUNCTION cannot communicate etc.) Also, usage tests of free variables is
done, so that any storage location cannot be referenced by more than one
name. In addition, PAR and IF-replicators exist.

On page 367 in the book you define non-preemptive scheduling in an
incomplete way, I think:

"With non-preemptive scheduling, the scheduler runs the current thread
forever, requiring that thread explicitly to tell when it is safe to
start a different thread."

I would add the following:

"The compiler *could* automatically insert such desceduling points,
removing the explicit need for the user code to suspend."

The rationale for this may be examplified by different occam ports:

1. For the transputer, the microcoded kernel has specific descheduling
instructions and a timeslicing mechanism. The compiler uses this so that
tasks have a very high granularity. By the way, transputer instructions
are very similar to Java bytecodes (transputer is also a stack-machine)

2. Occam for 386 uses a premptive realtime scheduler.

3. Occam (KROC) for Sun/Sparc uses Unix (I think)

4. Occam to ANSI-C converter (SPOC) is completely nonpremptive. The
C-code runs through a standard state-machine. It is very fast!

With all the examples above, the code is the same, no suspend calls by
the user.

The only way we could do with nonpreemtive scheduling, is for the
language itself to have a notion of a task, so that the compiler could
have a strategy for descheduling. So this should go for Java as well, I
think.

If you have time, I'd be happy to read your thoughts about this.

0yvind Teig

------------------------------------------------------------------------

Thanks for your comments about the book and the Transputer.

I followed Occam and the TP a little many years ago but didn't
realize it had some relationship to Java!

Very interesting.  Let me know if you have any more definite
realtionships that exist in the future.
								clp

------------------------------------------------------------------------

Cheers,   |   0yvind Teig, Autronica, Trondheim, Norway       |
Oyvind    |   Oyvind.Teig@xxxxxxxxxxxxxxxxxxxx                |
          |   Presently obsolete address: teig@xxxxxxxxxxxx   |
          |   47 73 58 12 68 (Tel) 47 73 91 93 20 (Fax)       |