Andrew
Andrew

Reputation: 81

What does Ruby's execution stack look like?

I found one webpage that describes how Ruby's execution stack looks like. It says that Ruby has seven stacks:

enter image description here

Is this article true?

Upvotes: 1

Views: 92

Answers (2)

Jörg W Mittag
Jörg W Mittag

Reputation: 369428

No, this does not describe how Ruby works. This describes how MRI works. MRI is only one of many implementations of Ruby. The Ruby Programming Language does not specify any particular implementation strategy for memory management. It is perfectly valid to implement Ruby without any stack at all.

There are many implementations of Ruby. The most widely-used one currently is YARV, but there's also MRuby, JRuby, MagLev, Ruby+OMR, TruffleRuby, Rubinius (those last three are the most interesting IMO). MRI isn't even maintained any more. In the past, there were also IronRuby, IronRuby (yes, actually, there were two different implementations with that name), Ruby.NET, tinyrb, XRuby, SmallRuby, BlueRuby, Cardinal, and many others.

AFAIK, none of those works in the way that is described here, only MRI does.

Upvotes: 0

Nikita Misharin
Nikita Misharin

Reputation: 2020

This article focuses on the way ruby works in versions from 1.7 to 1.8. With introduction of YARV things have changed a lot. To better understand how Ruby works internally I'd recommend Ruby Under a Microscope. There are chapters on how Ruby execution stack works

Upvotes: 3

Related Questions