🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #849

Re: Process/Thread Memory Sharing

#849
From: "Kenneth A. Kahn"
Date: Sat, 15 Aug 1992 10:13
27 lines
1918 bytes
Organization: Staff of IBM Fellow - NetWork Computing
Disclaimer: This posting represents the poster's views, not those of IBM
News-Software: UReply 3.0
X-X-From: KENKAHN@PKSMRVM.VNET.IBM.COM (Ken Kahn)
References: <1992Aug15.003258.24311@elroy.jpl.nasa.gov>

In <1992Aug15.003258.24311@elroy.jpl.nasa.gov> Les Hartzman writes:
>Reading some OS/2 documentation indicates that threads created within a
>single process may share that process' memory.  What is the process' memory?
>Is it the process' global memory (e.g., variables defined outside of 'main'),
>or is it an an actual memory object that is owned by the process?
>
>IF it is a memory object that the process creates, how do the threads get
>the address of the memory object?

Remember that a process is nothing more than a single application.  A thread
is logically just a subroutine that happens to be running asynchronously at
the same time as the main program (thread 1; e.g. main function in C).  All
threads have access to the program's Global storage pointed to by it's DS.
If any thread, including thread 1, happens to allocate more storage using an
API like DosAllocSeg or DosAllocShrSeg, all threads have access to that new
storage.  The on;y 'trick' is in order to access the allocated storage you
have to store the Selector to it in a global area (or you could store an
actual pointer that you create via MAKEP or similar).

In general, resources created by threads, e.g. Storage, Queues, File Handles,
are accessable by the entire owning process.
Technical Details
Message-ID: <9208152116.AA16850@ucbvax.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!PKSMRVM.VNET.IBM.COM!KENKAHN

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!PKSMRVM.VNET.IBM.COM!KENKAHN
From: KENKAHN@PKSMRVM.VNET.IBM.COM ("Kenneth A. Kahn")
Newsgroups: comp.os.os2.programmer
Subject: Re: Process/Thread Memory Sharing
Message-ID: <9208152116.AA16850@ucbvax.Berkeley.EDU>
Date: 15 Aug 92 10:13:59 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Lines: 27