Stack allocation for threads - OS2

This is a discussion on Stack allocation for threads - OS2 ; Hello, From where is a stack allocated for a new thread? Is it from the general heap? (I had assumed it was this one.) Is it from the currently running thread? Is it from the main thread's stack? All threads ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Stack allocation for threads

  1. Stack allocation for threads

    Hello,
    From where is a stack allocated for a new thread?
    Is it from the general heap? (I had assumed it was this one.)
    Is it from the currently running thread?
    Is it from the main thread's stack?
    All threads are started thus:

    _beginthread(function_name, NULL, stack_size, args)

    --
    jmm (hyphen) list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)

  2. Re: Stack allocation for threads

    Hi!

    Jim Moe schrieb:
    > Hello,
    > From where is a stack allocated for a new thread?
    > Is it from the general heap? (I had assumed it was this one.)
    > Is it from the currently running thread?
    > Is it from the main thread's stack?
    > All threads are started thus:
    >
    > _beginthread(function_name, NULL, stack_size, args)


    OS/2 allocates the stack always directly from the kernel. It makes no
    difference what the C runtime does.
    Of course, the heap is taken from the same source of memory.


    Marcel

  3. Re: Stack allocation for threads

    [A complimentary Cc of this posting was sent to
    =?ISO-8859-1?Q?Marcel_M=FCller?=
    ], who wrote in article <491a07f3$0$31342$9b4e6d93@newsspool4.arcor-online.net>:
    > Hi!
    >
    > Jim Moe schrieb:
    > > Hello,
    > > From where is a stack allocated for a new thread?
    > > Is it from the general heap? (I had assumed it was this one.)
    > > Is it from the currently running thread?
    > > Is it from the main thread's stack?
    > > All threads are started thus:
    > >
    > > _beginthread(function_name, NULL, stack_size, args)

    >
    > OS/2 allocates the stack always directly from the kernel. It makes no
    > difference what the C runtime does.


    Wrong. CRTL can ask the kernel to take any region of memory as stack.
    Do not know any particular implementation which would call
    DosStartThread2() (sp?), but it can.

    Hope this helps,
    Ilya

+ Reply to Thread