Hi Richard,
-- I'm sorry it took so long to get back to this post. I wasn't ignoring you. I think it is fair to say that most of us on this forum have some blend of engineer and scientist in us. I'm guessing that your ratio of engineer to scientist is larger than mine (not that mine is all that high in the scientist area. As engineers we are problem solvers. We want a problem to solve. We like the idea of necessity being the mother of invention. But there are of course people (scientists) in the world who work on things, learn about things and think about things, that they don't necessarily know where that effort will lead. That is what this discussion is about. I am asking those who wish to participate to take off our engineers caps and put on our scientist hats (do scientists wear hats?). So, with that in mind, I hope you will participate too. And by participating, you should feel free to continue to say multiple images running in one VM aren't worth the effort. Lou On Monday, March 26, 2018 at 12:27:37 PM UTC-4, Richard Sargent wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Administrator
|
In reply to this post by Louis LaBrunda
On Friday, March 30, 2018 at 8:03:49 AM UTC-7, Louis LaBrunda wrote:
Now, this is a great question. But, tease out the multiple constraints. When there are multiple threads, they all share the same memory spaces. In my opinion, this is greatly complicating. However, the idea of sharing a specific object graph is interesting and exciting. I suspect it would be relatively easy for VA Smalltalk to be able to access segments in shared memory. Not trivial, but not necessarily all that difficult. There are a number of technical issues related to the life cycle of such a shared memory space and moving or creating the object graph in it. I'm going to wave my hands in the air and claim that those issues aren't all that difficult. (Seth, feel free to rip me a new one if that is wildly incorrect!) By explicitly segregating the object graph into a shared memory space, you eliminate the myriad challenges that I believe multiple images in a single VM would entail and you correctly model the problem you wish to solve. Such a solution requires shared memory segments, the ability to gate access to them - typically OS semaphores, the ability for VA Smalltalk to explicitly control creation of such an object graph in that memory space, and the ability for VA Smalltalk to have modifications to the object graph (e.g. new instance creation) be restrained to that address space. In my somewhat uneducated opinion, I don't These are rocket science hard problems.
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Administrator
|
In reply to this post by Louis LaBrunda
On Friday, March 30, 2018 at 8:54:28 AM UTC-7, Louis LaBrunda wrote:
--
No problem, Lou. I'm quite content to state an opinion and wait to see if it's valid when challenged.
I don't know what my ratio really is, either. I studied computer science at the University of Waterloo, receiving a B. Math degree in the end. There is a fair degree of scientist in that kind of education, although I admit that I am more of a "in practice" kind of person. And that degree was quite a number of years ago!
Absolutely! I'm finding this discussion fascinating.
I am waiting with bated breath to learn that my opinion is wrong. So far, I don't think it is, but I am willing to be proven wrong. (See my response to your other message on this topic.) Let me assure you that I do find thought experiments intriguing and often fun. So, let's experiment with this topic and figure out what the solution space really should look like.
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Richard Sargent
Hi All,
-- I'm very glad to have Richard in the conversation, see his last two posts. I have two other questions. The first is an implementation question that doesn't have much to do with this threads topic and the second is way off topic but I'm curious. Does shared memory have to be a separate memory area? I think there are at least two memory areas in VA Smalltalk now, "old" and "new" memory. Would it be better for shared memory to be another area or would it be better to have a flag in the object header (not sure that's the right name)? The second question is memory related. I understand the need for garbage collection. I think the end phase is usually to move objects around in memory to, I guess, defragment it. Is this step worth the cost or could it be done less often? Memory is inexpensive and readily available. Now, I don't have any evidence that moving the objects around is a problem. It seems to me that it would take time to move the objects and fix anything that points to them. I have read that it can be the cause of temporarily poor responsiveness when it happens. Could the defragmentation be put off or does that make the delay longer when it happens? How much memory is "wasted" when defragmentation is delayed? Lou On Saturday, March 31, 2018 at 7:42:25 PM UTC-4, Richard Sargent wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hi All,
-- 'Does shared memory have to be a separate memory area?" - If you mean shared from different processes...then yes. That takes special operating system support since most flavors of OS process memory is isolated from each other. - For example, ICs can work exactly like this...sharing code between many processes...primarily for lowing the memory footprint. It's interesting to see what an advantage this can become when running on the cloud based on how consumers are charged (i.e. 0.9cents / unit of memory / month). - I was watching the IBM J9 folks talking about this very advantage...though they call the IC concept "shared classes" in the java vm "Would it be better for shared memory to be another area or would it be better to have a flag in the object header" - Based on the answer above, it would theoretically seem to make sense to have it be in a separate area - If you marked an object as shared...but it was in standard non-shared memory (i.e. what "new" and "old" logical smalltalk segments would get mapped on to), then it will be a very lonely type of sharing:) - Now let's consider this in terms of an "object graph". What would it mean to have a "shared" collection of "non-shared" objects? What would it mean for an object with 5 instance variables to contain 3 shared objects and 2 non-shared objects? It would seem to lead to nothing good. So using this shared memory approach....this means if you select 1 object to be shared...you are really "logically" sharing the whole object graph for which that object is the root. And now you have to solve that transitive object sharing issue, for which more complexity is demanded like proxies and other such things. - I imagine we are more into Richard's area of expertise and some of the issues that Gemstone would set out to solve. "I think the end phase is usually to move objects around in memory to, I guess, defragment it. Is this step worth the cost or could it be done less often?" - Compaction. Yes, it works very similarly to "Disk Defrag". - Compaction only runs after a Global Garbage collection....not after quick scavenges (which implicitly compacts) - Yes, it can be an expensive step...and yes there are "compaction avoidance" techniques. - With compaction, there are no holes in the heap. You can very quickly allocate objects by incrementing a bump pointer. This is both simple and fast. - Without compaction, you are left with lots of holes in the heap. You will need a new object allocator that can "very quickly" find an appropriate hole given the size of the object you requested, and more complexity to maintain that booking. - Without compaction, you will begin to lose cache locality benefits over time and can experience more CPU cache misses. For example, objects accessing related objects or their instance variables may need to hop across memory as opposed to a quick access that would have been in one of the CPU caches. - It's hard to answer this question..."is it worth it?". I've always found GCs hard to benchmark because the "cost" is not just # of instructions. There is CPU caching behavior to consider and many other factors like your specific application profile. It's kind of like asking if some memory management change in the kernel of the operating system VAST is running on is worth it. *Shrug*...it depends:) - I often run it using tools like valgrind/cachegrind where I can simulate CPUs with different cache sizes. I find it interesting sometimes when I experiment by changing 1 line of code to what looks like an obvious performance improvement in the GC. Then I profile it and discover I have caused major perturbations in caching behavior and slowed the whole system down considerably. " It seems to me that it would take time to move the objects and fix anything that points to them." - I went over this already I guess...but the tradeoff is: Compaction means to spend some time to keep object allocation super fast and nice caching behavior vs Not compacting, which means you need more booking and good algorithms to efficiently track holes in the heap so that you can have a fragmented allocator that can allocate objects in a quick manner....and be willing to lose some potentially nicer caching characteristics. There is complexity either way. Although, I like the concept of non-moving for things like passing objects out to C or, in my case, debugging the VM since moving objects makes this harder to track down bugs. - Seth I think there are at least two memory areas in VA Smalltalk now, "old" and "new" memory. Would it be better for shared memory to be another area or would it be better to have a flag in the object header (not sure that's the right name)? On Monday, April 2, 2018 at 9:55:09 AM UTC-4, Louis LaBrunda wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hi Seth,
-- Thank you very much for this wonderfully thorough answer. Every thing you say makes sense. Some of which I had guessed but I didn't want to say too much as to not influence anyones answers. Would it make any sense, at all, to divide the area of memory that gets compacted into two sections so that one could be getting compacted while the other was used to allocate new objects in the quick manner you described? Lou On Monday, April 2, 2018 at 12:06:07 PM UTC-4, Seth Berman wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hi Lou,
-- You could have certain "spaces" that you don't compact. This is typically for large objects (i.e. 8MB ByteArray) that you don't want to move around all the time because that would be expensive. So these are separated out and managed differently. There have been many GC papers written on this and it exists in many virtual machines...often referred to as Large Object Area, or Large Object Space or Large Object Heap. A quick google search shows implementations in .Net, IBM J9, V8 javascript engine...and many others I'm sure. Here is a sample article on .Net's Large Object Heap that describes all the stuff we have been talking about concerning compaction and fragmentation. - Seth On Monday, April 2, 2018 at 1:46:31 PM UTC-4, Louis LaBrunda wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hi Seth,
-- Thanks for the link, I read it with interest. This statement struck me as being if not crazy/stupid at least odd: "Now that we know about the pitfalls of large object heap fragmentation, let’s take a quick tour of the best practices that we can adopt to avoid it. A recommended strategy is to identify the large objects in your application and then split them into smaller objects – perhaps using some wrapper class. You can also redesign your application to ensure that you avoid using large objects. Another approach is to recycle the application pool periodically." Why would anyone think it is a good idea to write a program in a way that tries to take advantage of the hidden inner workings of the underling system? A system that could change at any time, possibly resulting in the opposite of the intended effect. So, not defraging the big stuff makes sense. When looking at my running VA Smalltalk systems, I see that they can grow and shrink in their memory usage. Does this mean that the memory areas that VA keeps, like new is not continuous? If so, that takes be back to my question about there being different areas of memory that get defraged separately, allowing new objects to be created in one while another is being defraged. Lou On Monday, April 2, 2018 at 2:24:59 PM UTC-4, Seth Berman wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hi guys, Sorry for joining too late to the party but this is an area I really like, so better later than never :) While its not related to the "multi-core" point or view or the "running multiple images with the same running VM", my PhD did touch a few of the topics discussed in this thread. In addition, you can also see all the papers I refer in the thesis and you will likely find several that are very interesting! Of
course, my project was just a prototype and not something mature enough or
production ready, but still one more thought in this area...So...for my PhD [1] [2], one of the things I did (lets say the closest to the PhD topic) was called Marea [3] (I can also send the PhD defense video on youtube if you want). In Marea what I did was to modify the Pharo VM to implement a very basic (with lots of limitations) object usage tracking...I simply flagged when an object was used and cleared the flag every in a while. Then, at image side, I would find graphs of unused objects, and replaced the boundary objects with proxies using Ghost proxies (note that an anused object is not the same as unreferenced object,...GC does nothing here). The graphs where then serialized with Fuel. Finally, if those graphs happened to be needed, then the proxy would intercept the message, materialize from Fuel, and plug back the original graph. Anyway... all of what was to said that I some point I did an experiment. I was able to already proxify and serialize classes, methods, etc. So I took the whole image and I swapped out all classes and their instances (each class with its instances in a different graph) but only a really small core. This image was a Seaside image running DBX Pier website. So I swapped out everything, and then I lazily started to navigate DBX website, causing the needed graphs to be swapped in. I was able to naviagate all webapp and use it perfectly. I even saved the image. And all this email is to say that such an image was 3MB. Below I paste the abstract of Marea paper which explains better what it is: ---- During the execution of object-oriented applications, several millions of objects are created, used and then collected if they are not referenced. Problems appear when objects are unused but cannot be garbage-collected because they are still referenced from other objects. This is an issue because those objects waste primary memory and applications use more primary memory than they actually need. We claim that relying on the operating system’s (OS) virtual memory is not always enough since it cannot take into account the domain and structure of applications. At the same time, applications have no easy way to parametrize nor cooperate with memory management. In this paper, we present Marea, an efficient application-level object graph swapper for object-oriented programming languages. Its main goal is to offer the programmer a novel solution to handle application-level memory. Developers can instruct our system to release primary memory by swapping out unused yet referenced objects to secondary memory. Our approach has been qualitatively and quantitatively validated. Our experiments and benchmarks on real-world applications show that Marea can reduce the memory footprint between 23% and 36%. ---- [1] https://www.slideshare.net/ [2] http://rmod.lille.inria.fr [3] http://rmod.lille.inria.fr Cheers, On Tue, Apr 3, 2018 at 11:06 AM, Louis LaBrunda <[hidden email]> wrote:
-- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hi All, This is very cool research! @Lou I would agree that the strategies in that article are on the extreme end. I suppose if you had a deployed production system that was suffering from extreme fragmentation, and these tips fixed the issue, I could see making use of it...at least temporarily. I don't think there is anything wrong with using GC tuning parameters to optimize for your application's allocation/reclamation profile, though. "Does this mean that the memory areas that VA keeps, like new is not continuous? If so, that takes be back to my question about there being different areas of memory that get defraged separately, allowing new objects to be created in one while another is being defraged." - Hmm. Not sure I follow completely. - The logical "New" space is comprised of many segments. (EsMemorySegment allSegments select: [:s | s isNewSpace]) - 2 of them are special...those are the semi-space halfs that the Scavenger operates on. One is inactive while the other one is active...and a scavenge copies the live objects from active to inactive and then switch roles. - The other ones that are "New" have various purposes. For example, Swapper might create temporary new spaces if it's a small enough segment size. Once done, an attempt is made to merge these back into one of the semi-spaces so you don't tenure temporary stuff. - I don't understand "defraged separately". Are you making the case for a concurrent GC that allocates while it compacts? If so, then a lot of thread coordination is required to make this happen....this is like a different garbage collector. It sounds like you are intuitively able to ask appropriate questions regarding this topic. I would highly recommend reading "The Garbage Collection Handbook - The Art of Automatic Memory Management" (get the 2012 one...not the 1996 one). It walks through most of the topics we have touched on relating to GC in thorough detail. And describes it in a way far better than what I could come up with. After that, if you want to explore some more specific areas, I have a ton of research papers I can recommend. - Seth On Tuesday, April 3, 2018 at 10:40:07 AM UTC-4, marianopeck wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hi Mariano and Seth,
-- On Tuesday, April 3, 2018 at 12:58:16 PM UTC-4, Seth Berman wrote:
+1. I have seen you posts in one (or more) of the Squeak forums but hadn't realized you had joined Instantiations. Glad to have you there.
I agree, I was going to say as much but must have gotten distracted.
I agree.
I am thinking of a GC that can allocate while it compacts but NOT in two threads just two memory areas. I'm wondering if everything stops while the compaction takes place, meaning the compaction has to finish before any new objects can be created or can a little compaction get done and then some new objects get created (in the other area) and then back to compacting.
I should. But as I look to my right there is a 4 inch high stack of Scientific American magazines and others and a one inch thick book that I haven't gotten to yet. I have always been a slow reader. I had gotten to a point where I was reading a lot (still slow but not bad) but now my father is 102 and wakes me up at night. Last night it was at least twice. Once I checked on him and he was laying in bed, I think asleep, calling my name. Not in any kind of panic or anything, just calling Louie, Louie. It leaves me very tired much of the day and if I try to read much, I just fall asleep. So, I apologize to everyone for taking my own post off topic and will try to not let the discussion get too far afield in the future. I hope I am not taking up too much of people valuable time. Lou
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hi Lou,
-- No worries, I didn't think anything was off topic. Concerning the GC, this is a well studied field with a huge body of knowledge that dates back to lisp systems in the early 60s. So the book I recommended is good for foundational knowledge as well as classifying the different types of algorithms involved and how they are related. For example, what you described in your last post I would think is a form of incremental compaction...which has been classified, studied and I've seen a few implementations described in research papers. So good for you for arriving at it through intuition. That's why I thought you might like the book:) - Seth On Tuesday, April 3, 2018 at 5:13:38 PM UTC-4, Louis LaBrunda wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hi Louis, I just wanted to add a small comment on your sentence "Now, I don't have any evidence that moving the objects around is a problem."On Wed, Apr 4, 2018 at 10:41 AM, Seth Berman <[hidden email]> wrote:
-- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Seth Berman
Hi Seth,
-- I think I probably would like the book, maybe when I catch up on my reading. Lou On Wednesday, April 4, 2018 at 9:41:32 AM UTC-4, Seth Berman wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Mariano Martinez Peck-2
Hi Mariano,
-- I know about FFI being a problem and pinning being the solution. I was just trying to leave the door open for potential problems in regular Smalltalk. I don't think there should be and I don't expect that any regular object would get hold of a pointer that could change. I do expect that collection classes have pointers to objects that get moved and that the GC must fix them. I expect that is a part of why using multiple threads is hard. Lou On Wednesday, April 4, 2018 at 9:50:44 AM UTC-4, marianopeck wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |