SlideShare uma empresa Scribd logo
1 de 47
Mark – Sweep Algorithm
 first algorithm for automatic storage
  reclamation (McCarthy 1960).
 a stop and run algorithm.
 tracing garbage collection technique
 works in 2 Phases:
           – mark all live nodes by traversal.
           – sweep the heap by a linear scan.




                                                 1
Mark-Sweep Algorithm
Benefits:
a) No overhead on pointer manipulations.
b) Low space cost: using a simple mark-
   field/bit.
Drawbacks:
a) Computation halted while gc
b) Every cell is visited during marking
c) Cells are again re-examined by sweep
d) Recursive marking (time and space!)
                                           2
Mark -- Sweep Algorithm
   Each block or its corresponding book keeping
    must contain bit (mark bit)
   Initially all blocks are unmarked
   Starting at each symbol perform a search marking
    all blocks reachable (mark means in-use)
   Sweep through all blocks.
    – If marked: Unmark
    – If unmarked: move to free list ( i.e free it )
   Note: Algorithm must be only thing running
   Garbage collection is only done when necessary
    – i.e. When free list is empty
                                                       3
Characteristics of Mark and Sweep
                Algorithm
   Can place an upper bound on the total amount of
    time required to perform complete GC. Use this
    to pace GC against ongoing allocation needs.

   No “time intrusive” overheads to interfere with
    calculation of worst-case task execution times.

   But cannot guarantee to avoid fragmentation.


                                                      4
Consider the following
Arrangement of nodes

          Internally
    X                       ()


        foo         blarg

                            ()


              bar    baz

    Y                       ()


        foo   bar    baz
                                 5
Free
                                             Mark
                 Free List
X
           ()                         ()




Y

     ()     ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                                6
Free
                                             Mark
                 Free List
X
           ()                         ()




Y

     ()     ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                                7
Free
                                             Mark
                 Free List
X
           ()                         ()




Y

     ()     ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                                8
Free
                                             Mark
                 Free List
X
           ()                         ()




Y

     ()     ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                                9
Free
                                             Mark
                 Free List
X
           ()                         ()




Y

     ()     ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               10
Free
                                             Mark
                 Free List
X
           ()                         ()




Y

     ()     ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               11
Free
                                             Mark
                 Free List
X
           ()                         ()




Y

     ()     ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               12
Free
                                             Mark
                 Free List
X
           ()                         ()




Y

     ()     ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               13
Free
                                             Mark
                 Free List
X
           ()                         ()




Y

     ()     ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               14
Free
                                             Mark
                 Free List
X
           ()                         ()




Y

     ()     ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               15
Free
                                             Mark
                 Free List
X
           ()                         ()




Y

     ()     ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               16
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               17
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               18
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               19
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               20
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               21
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               22
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               23
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               24
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               25
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()
                      Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.

                                               26
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               27
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               28
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               29
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               30
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               31
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               32
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               33
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               34
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               35
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               36
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               37
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               38
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               39
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               40
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               41
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               42
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               43
Sweep
    Free
                 Free List
X
           ()                         ()




Y

            ()        Here , X and Y correspond to
                      the root Pointers and the
                      block pointed to by “Free”
                      Corresponds to the Free List.


                                               44
Sweep
    Free
                 Free List
X
           ()                           ()




Y

            ()          Here , X and Y correspond to
                        the root Pointers and the
                        block pointed to by “Free”
                        Corresponds to the Free List.


                   ()                            45
Done
    Free
                 Free List
X
           ()                           ()




Y

            ()          Here , X and Y correspond to
                        the root Pointers and the
                        block pointed to by “Free”
                        Corresponds to the Free List.


                   ()                            46
As Simple as ......




                      47

Mais conteúdo relacionado

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 

Último (20)

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Destaque (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

Mark and sweep algorithm(garbage collector)

  • 1. Mark – Sweep Algorithm  first algorithm for automatic storage reclamation (McCarthy 1960).  a stop and run algorithm.  tracing garbage collection technique  works in 2 Phases: – mark all live nodes by traversal. – sweep the heap by a linear scan. 1
  • 2. Mark-Sweep Algorithm Benefits: a) No overhead on pointer manipulations. b) Low space cost: using a simple mark- field/bit. Drawbacks: a) Computation halted while gc b) Every cell is visited during marking c) Cells are again re-examined by sweep d) Recursive marking (time and space!) 2
  • 3. Mark -- Sweep Algorithm  Each block or its corresponding book keeping must contain bit (mark bit)  Initially all blocks are unmarked  Starting at each symbol perform a search marking all blocks reachable (mark means in-use)  Sweep through all blocks. – If marked: Unmark – If unmarked: move to free list ( i.e free it )  Note: Algorithm must be only thing running  Garbage collection is only done when necessary – i.e. When free list is empty 3
  • 4. Characteristics of Mark and Sweep Algorithm  Can place an upper bound on the total amount of time required to perform complete GC. Use this to pace GC against ongoing allocation needs.  No “time intrusive” overheads to interfere with calculation of worst-case task execution times.  But cannot guarantee to avoid fragmentation. 4
  • 5. Consider the following Arrangement of nodes Internally X () foo blarg () bar baz Y () foo bar baz 5
  • 6. Free Mark Free List X () () Y () () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 6
  • 7. Free Mark Free List X () () Y () () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 7
  • 8. Free Mark Free List X () () Y () () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 8
  • 9. Free Mark Free List X () () Y () () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 9
  • 10. Free Mark Free List X () () Y () () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 10
  • 11. Free Mark Free List X () () Y () () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 11
  • 12. Free Mark Free List X () () Y () () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 12
  • 13. Free Mark Free List X () () Y () () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 13
  • 14. Free Mark Free List X () () Y () () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 14
  • 15. Free Mark Free List X () () Y () () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 15
  • 16. Free Mark Free List X () () Y () () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 16
  • 17. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 17
  • 18. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 18
  • 19. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 19
  • 20. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 20
  • 21. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 21
  • 22. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 22
  • 23. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 23
  • 24. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 24
  • 25. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 25
  • 26. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 26
  • 27. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 27
  • 28. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 28
  • 29. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 29
  • 30. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 30
  • 31. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 31
  • 32. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 32
  • 33. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 33
  • 34. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 34
  • 35. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 35
  • 36. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 36
  • 37. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 37
  • 38. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 38
  • 39. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 39
  • 40. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 40
  • 41. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 41
  • 42. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 42
  • 43. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 43
  • 44. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. 44
  • 45. Sweep Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. () 45
  • 46. Done Free Free List X () () Y () Here , X and Y correspond to the root Pointers and the block pointed to by “Free” Corresponds to the Free List. () 46
  • 47. As Simple as ...... 47