Re: Wanted: a program that calulates the maximal stack depth

samuel@nada.kth.se (Samuel Cederlund)
Sat, 11 Apr 1992 16:31:08 GMT

          From comp.compilers

Related articles
Wanted: a program that calulates the maximal stack depth samuel@nada.kth.se (1992-04-06)
Re: Wanted: a program that calulates the maximal stack depth russw@cs.utexas.edu (1992-04-09)
Re: Wanted: a program that calulates the maximal stack depth bliss@sp64.csrd.uiuc.edu (1992-04-09)
Re: Wanted: a program that calulates the maximal stack depth hays@ssd.intel.com (1992-04-09)
Re: Wanted: a program that calulates the maximal stack depth pbk@arkesden.Eng.Sun.COM (1992-04-10)
Re: Wanted: a program that calulates the maximal stack depth eifrig@beanworld.cs.jhu.edu (1992-04-10)
Re: Wanted: a program that calulates the maximal stack depth samuel@nada.kth.se (1992-04-11)
| List of all articles for this month |
Newsgroups: comp.compilers
From: samuel@nada.kth.se (Samuel Cederlund)
Keywords: code, storage
Organization: Compilers Central
References: 92-04-029 92-04-044
Date: Sat, 11 Apr 1992 16:31:08 GMT

Thank you all who have answered my question. Perhaps I should have given
you all a little more background on the problem, so that you wouldn't have
had to guess what it would be used for. This is what I'm trying to do: a
very small operating system built on threads and synchronous message
passing. I think it might provide an interesting environment for solving
some problems. As an example, consider this piece of code:


port f()
{
        port p = new_port();
        fork_thread(q, p, USED_STACK(q));
        return p;
}


q(port p)
{
        int i;
        while (true) {
                if (receive(p, &i) == no_sender_error)
         return;
                compute;
         send(p, i);
        }
}


This is, in my opinion, almost like a closure in C. But why do all this
when there already are OSes that have IPC and light-weight processes? For
one thing, if you want to keep things small and in the same time fork
numerous threads, the notion of infinite stack can be a rather costly
issue. But this way those threads that would need an infinite stack could
be given one and the others could have a fixed-size stack of their
theoretical maximum.


The needed tool would then: 1 Get the theoretical maximal stack depth, 2
Be as machine independent as possible and 3 Process the code before
compilation. Or else you would have to patch the information into the
executable.
                                                                                          Sam


        Samuel Cederlund, programming assistant samuel@nada.kth.se
        Interaction and Presentation lab
        Department of Computer Science Royal Institute of Technology
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.