I agreed with Cindy, but probably it's question from some
test, so I try to answer somehow.
Threads... (Do you means java
thread ?)
You should think as you write
implementation of JVM...
What data use thread:
1. commands
There should be address space of commands (java byte code or compiled code).
It should be shared for all threads. (Differents threads can call the same function, so use the
same byte (or compiled) code from some address segment).
2. common data for all threads,
You can create object in one thread and use it
in other. So java objects (hava heap) should be in the same address space for all threads.
3. authomatic variables, local function variables,
return address of functions.
(Do you wish to use different stacks - one for
return addresses and one for local variables ?
Probably one is enough)
Each function can use it's own local (automatic)
variables. Them are local for each theads.
So each thread should have its own stack.
If I don't forget something, we can sketch now
memory model for jvm: common address space for
heap, common address space for commands, and
a lot of stacks. One per thread.
You can dynamically load/unload classes, make/drop
compiled version of code, so space for commands is
heap, probably you can use the same heap for commands and for data (java objects)....
E.t.c ....
Now you should think how your OS support memory
mapping, how can you change size of mapped memory
segments, what table should describe the all threads, etc ...
[ November 11, 2002: Message edited by: Igor Ko ]