Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Address space and thread space in threads

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How does OS handles Address space and Data space in context of threads ?
Pls help me by answering this query.
Tx in advance
Anu
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which OS.
Nope - don't even bother. If you have to know the OS then you shouldn't be messing with it using Java.
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic