SlideShare a Scribd company logo
1 of 22
Chapter 3.5
Memory and I/O Systems
2
Memory Management
 Only applies to languages with explicit
memory management (C or C++)
 Memory problems are one of the leading
causes of bugs in programs
3
Memory Management
 We have three goals when working with
memory
 Safety
 Knowledge
 Control
4
Memory Management
 Memory fragmentation
 Free physical memory is only available in
small sections
 Can prevent an allocation from completing
successfully even if there's plenty of free
memory
 Virtual addressing will greatly help with
fragmentation problems
5
Memory Management
 Virtual addressing
V ir t u a l
A d d r e s s T a b le
B lo c k 2
B lo c k 4
B lo c k 3
B lo c k 5
B lo c k 1
P h y s ic a l M e m o r y
B lo c k 1
B lo c k 4
V ir t u a l
M e m o r y V ie w
6
Memory Management
 Static memory allocation
 If all memory is statically allocated there will
be very few problems

Leaks

Fragmentation

Running out of memory
 Very restrictive
 Lots of wasted memory
 Old games used to be done this way
7
Memory Management
 Dynamic allocation
 Much more flexible than static allocations
 Lots of potential problems
 Need to override global new and delete to
take control over allocations
8
Memory Management
 Memory manager
 Heaps are collections of memory allocations
 Override class-specific operator new and
delete to assign classes to heaps
 We can add some simple error-checking
schemes to prevent memory overrun
problems
9
Memory Management
 Memory leaks
 A memory leak is a memory allocation that
is no longer necessary and was not
released by the program
 Memory leaks can cause the game to use
up resources and run out of memory
 To find all memory leaks, we look for all the
allocations that occurred between two
particular points in time
10
Memory Management
 Memory pools
 Memory pools are contiguous blocks of
memory used to allocate objects
 Allocations are extremely fast
 There is no fragmentation
 They will usually have some unused space
 We can allocate objects from specific
classes with a simple macro
11
Memory Management
 Memory pools
E m p t y b lo c k
E m p t y b lo c k h e a d e r
B lo c k w it h d a t a
a b c
12
File I/O
 Sometimes full file I/O not available on
all platforms
 Different ways of accessing different
devices
 Memory cards, network, etc
 Usually have no control over physical
disk allocation
 Which can lead to long load times
13
File I/O
 Unified file system
 Platform independent
 Provide same interface to different types of
media
 Based around FileSystem class
14
File I/O
 File system
 Uses concept of streams
 Stream can be the source of data
 Possible sources

File, memory, network
 Or it can be a layer that adds some
properties
 Possible layers

Buffering, compression, range, etc
15
File I/O
 File system
B u f f e r i n g L a y e rF i l e S o u r c e
D a t a S t r e a m
16
Game Resources
 A game resource (or asset) is anything that
gets loaded that could be shared by several
parts of the game
 A texture, an animation, a sound, etc
 We want to load and share resources easily
 There will be many different types of resources
in a game
17
Game Resources
 Resource manager
 Uses registering object factory pattern
 Can register different types of resources
 All resource creation goes through the
resource manager
 Any requests for existing resources don't
load it again
18
Game Resources
 Resource lifetime
 If resources are shared, how do we know
when we can destroy them?

All at once

At the end of the level
 Explicit lifetime management
 Reference counting
19
Game Resources
 Resources and instances
 Resource is the part of the asset that can
be shared among all parts of the game
 Instance is the unique data that each part
of the game needs to keep
20
Serialization
 Every game needs to save and restore
some game state
 Even for check point saves
 Level editing and creation could be
implemented as a saved game
21
Serialization
 Saving
 ISerializable interface for Read and Write
operations
 Each class implements the Write() function
 Saving pointers is a problem

They won't be the same when we load
 Save raw pointers to other objects

Translate them later
22
Serialization
 Loading
 Create object types through an object
factory
 Read() function takes care of loading the
data from the stream
 Pointers are loaded into a translation table
 Second pass fixes up all the pointers

More Related Content

What's hot

Recover Data from Memory Card
Recover Data from Memory CardRecover Data from Memory Card
Recover Data from Memory CardYodot
 
Windows 10 Data Recovery
Windows 10 Data RecoveryWindows 10 Data Recovery
Windows 10 Data RecoveryRemo Recover
 
features of windows7 & 8(trail)
features of windows7 & 8(trail)features of windows7 & 8(trail)
features of windows7 & 8(trail)ava & araf co.
 
What a teacher needs to know about computers
What a teacher needs to know about computersWhat a teacher needs to know about computers
What a teacher needs to know about computersNelson Urbina
 
Computer Education Class 6 (PTB) worksheet
Computer Education Class 6 (PTB) worksheetComputer Education Class 6 (PTB) worksheet
Computer Education Class 6 (PTB) worksheetFaB6 Design
 
Basics of Microsoft windows
Basics of Microsoft windows Basics of Microsoft windows
Basics of Microsoft windows vethics
 
Format, Partition, Install OS
Format, Partition, Install OSFormat, Partition, Install OS
Format, Partition, Install OSSef Cambaliza
 
Nexsus Techno Solution Windows Evolution
Nexsus Techno Solution  Windows EvolutionNexsus Techno Solution  Windows Evolution
Nexsus Techno Solution Windows Evolutionnexsustechno
 
Week 1 lesson 9 Intro to tech class
Week 1 lesson 9 Intro to tech classWeek 1 lesson 9 Intro to tech class
Week 1 lesson 9 Intro to tech classrdubroy
 
Guide to Windows 7 - Managing File Systems
Guide to Windows 7 - Managing File SystemsGuide to Windows 7 - Managing File Systems
Guide to Windows 7 - Managing File SystemsGene Carboni
 
History of Windows
History of WindowsHistory of Windows
History of WindowsNiraj Bariya
 
Windows 8 vs windows 7 ppt
Windows 8 vs windows 7 pptWindows 8 vs windows 7 ppt
Windows 8 vs windows 7 pptDiya Mirza
 
Computer studies year 7 exercise (hard)
Computer studies year 7 exercise (hard)Computer studies year 7 exercise (hard)
Computer studies year 7 exercise (hard)fizahPhd
 

What's hot (20)

Recover Data from Memory Card
Recover Data from Memory CardRecover Data from Memory Card
Recover Data from Memory Card
 
Windows 10 Data Recovery
Windows 10 Data RecoveryWindows 10 Data Recovery
Windows 10 Data Recovery
 
Flash card recovery mac
Flash card recovery macFlash card recovery mac
Flash card recovery mac
 
features of windows7 & 8(trail)
features of windows7 & 8(trail)features of windows7 & 8(trail)
features of windows7 & 8(trail)
 
Disk management
Disk managementDisk management
Disk management
 
5) multimedia notes
5) multimedia notes5) multimedia notes
5) multimedia notes
 
Mac mini recovery
Mac mini recoveryMac mini recovery
Mac mini recovery
 
What a teacher needs to know about computers
What a teacher needs to know about computersWhat a teacher needs to know about computers
What a teacher needs to know about computers
 
Computer Education Class 6 (PTB) worksheet
Computer Education Class 6 (PTB) worksheetComputer Education Class 6 (PTB) worksheet
Computer Education Class 6 (PTB) worksheet
 
Basics of Microsoft windows
Basics of Microsoft windows Basics of Microsoft windows
Basics of Microsoft windows
 
Format, Partition, Install OS
Format, Partition, Install OSFormat, Partition, Install OS
Format, Partition, Install OS
 
Nexsus Techno Solution Windows Evolution
Nexsus Techno Solution  Windows EvolutionNexsus Techno Solution  Windows Evolution
Nexsus Techno Solution Windows Evolution
 
Spec00428
Spec00428Spec00428
Spec00428
 
Operating system
Operating systemOperating system
Operating system
 
Week 1 lesson 9 Intro to tech class
Week 1 lesson 9 Intro to tech classWeek 1 lesson 9 Intro to tech class
Week 1 lesson 9 Intro to tech class
 
Guide to Windows 7 - Managing File Systems
Guide to Windows 7 - Managing File SystemsGuide to Windows 7 - Managing File Systems
Guide to Windows 7 - Managing File Systems
 
History of Windows
History of WindowsHistory of Windows
History of Windows
 
Windows 8 vs windows 7 ppt
Windows 8 vs windows 7 pptWindows 8 vs windows 7 ppt
Windows 8 vs windows 7 ppt
 
Computer studies year 7 exercise (hard)
Computer studies year 7 exercise (hard)Computer studies year 7 exercise (hard)
Computer studies year 7 exercise (hard)
 
Window xp
Window xpWindow xp
Window xp
 

Viewers also liked

Material a usar em manicura e pedicura
Material a usar em manicura e pedicuraMaterial a usar em manicura e pedicura
Material a usar em manicura e pedicuraEster Figueira
 
Parcial2 vera felix
Parcial2 vera felixParcial2 vera felix
Parcial2 vera felixDavid Vera
 
patrimonio centroamericano
patrimonio centroamericanopatrimonio centroamericano
patrimonio centroamericanodave2015
 
Higiene y seguridad industrial John Castellanos
Higiene y seguridad industrial John CastellanosHigiene y seguridad industrial John Castellanos
Higiene y seguridad industrial John Castellanosjhonwd40
 
Práctica 4. analítica.
Práctica 4. analítica.Práctica 4. analítica.
Práctica 4. analítica.akkg
 
Pres eje estantares laborales global compact uniRSE convenios oit
Pres eje estantares laborales global compact uniRSE convenios oitPres eje estantares laborales global compact uniRSE convenios oit
Pres eje estantares laborales global compact uniRSE convenios oituniRSEnic
 
Lula sampaio processo em 07 fevereiro
Lula sampaio processo em 07 fevereiroLula sampaio processo em 07 fevereiro
Lula sampaio processo em 07 fevereiroMEU_ARARIPE
 
Azure Experience Letter
Azure Experience LetterAzure Experience Letter
Azure Experience LetterDawar Shah
 
Cedia folleto servicios
Cedia folleto serviciosCedia folleto servicios
Cedia folleto serviciosDarwin Arias
 
Redes sociales
Redes socialesRedes sociales
Redes socialesyuseortiz
 
Aditivo 03 tc 1000-2009 (ponto de cultura)
Aditivo 03 tc 1000-2009 (ponto de cultura)Aditivo 03 tc 1000-2009 (ponto de cultura)
Aditivo 03 tc 1000-2009 (ponto de cultura)Priscila Bortolozzo
 
Contro de produção e rs em restaurante2008 fabiana mariasouza
Contro de produção e rs em restaurante2008 fabiana mariasouzaContro de produção e rs em restaurante2008 fabiana mariasouza
Contro de produção e rs em restaurante2008 fabiana mariasouzaLuciléia Colares
 

Viewers also liked (20)

6.playground1
6.playground16.playground1
6.playground1
 
Material a usar em manicura e pedicura
Material a usar em manicura e pedicuraMaterial a usar em manicura e pedicura
Material a usar em manicura e pedicura
 
Sentencia a mort_companys s
Sentencia a mort_companys sSentencia a mort_companys s
Sentencia a mort_companys s
 
Parcial2 vera felix
Parcial2 vera felixParcial2 vera felix
Parcial2 vera felix
 
Luz tema1 (1)
Luz tema1 (1)Luz tema1 (1)
Luz tema1 (1)
 
patrimonio centroamericano
patrimonio centroamericanopatrimonio centroamericano
patrimonio centroamericano
 
Higiene y seguridad industrial John Castellanos
Higiene y seguridad industrial John CastellanosHigiene y seguridad industrial John Castellanos
Higiene y seguridad industrial John Castellanos
 
Práctica 4. analítica.
Práctica 4. analítica.Práctica 4. analítica.
Práctica 4. analítica.
 
Pres eje estantares laborales global compact uniRSE convenios oit
Pres eje estantares laborales global compact uniRSE convenios oitPres eje estantares laborales global compact uniRSE convenios oit
Pres eje estantares laborales global compact uniRSE convenios oit
 
Lula sampaio processo em 07 fevereiro
Lula sampaio processo em 07 fevereiroLula sampaio processo em 07 fevereiro
Lula sampaio processo em 07 fevereiro
 
Azure Experience Letter
Azure Experience LetterAzure Experience Letter
Azure Experience Letter
 
Cedia folleto servicios
Cedia folleto serviciosCedia folleto servicios
Cedia folleto servicios
 
Redes sociales
Redes socialesRedes sociales
Redes sociales
 
europrog base
europrog baseeuroprog base
europrog base
 
Aditivo 03 tc 1000-2009 (ponto de cultura)
Aditivo 03 tc 1000-2009 (ponto de cultura)Aditivo 03 tc 1000-2009 (ponto de cultura)
Aditivo 03 tc 1000-2009 (ponto de cultura)
 
MSc Business Mgt with HR
MSc Business Mgt with HRMSc Business Mgt with HR
MSc Business Mgt with HR
 
Al Arrab Certificate
Al Arrab CertificateAl Arrab Certificate
Al Arrab Certificate
 
Podsetnik-Skupovi
Podsetnik-SkupoviPodsetnik-Skupovi
Podsetnik-Skupovi
 
Alquile su Amueblado (digital)
Alquile su Amueblado (digital)Alquile su Amueblado (digital)
Alquile su Amueblado (digital)
 
Contro de produção e rs em restaurante2008 fabiana mariasouza
Contro de produção e rs em restaurante2008 fabiana mariasouzaContro de produção e rs em restaurante2008 fabiana mariasouza
Contro de produção e rs em restaurante2008 fabiana mariasouza
 

Similar to 3.5 memory and io systems

5.6 Basic computer structure microprocessors
5.6 Basic computer structure   microprocessors5.6 Basic computer structure   microprocessors
5.6 Basic computer structure microprocessorslpapadop
 
Hsc computer science chap 1 Operating System (1).pdf
Hsc computer science chap 1 Operating System  (1).pdfHsc computer science chap 1 Operating System  (1).pdf
Hsc computer science chap 1 Operating System (1).pdfAAFREEN SHAIKH
 
Debugging performance issues, memory issues and crashes in .net applications rev
Debugging performance issues, memory issues and crashes in .net applications revDebugging performance issues, memory issues and crashes in .net applications rev
Debugging performance issues, memory issues and crashes in .net applications revTess Ferrandez
 
Computer ACW Computer Architecture L 2.pptx
Computer ACW Computer Architecture L 2.pptxComputer ACW Computer Architecture L 2.pptx
Computer ACW Computer Architecture L 2.pptxEdmondLabule2
 
ch2-system structure.ppt
ch2-system structure.pptch2-system structure.ppt
ch2-system structure.pptJohnColaco1
 
Ch2 system structure
Ch2 system structureCh2 system structure
Ch2 system structureAnkit Dubey
 
Windows for Everyone(Operating System)
Windows for Everyone(Operating System)Windows for Everyone(Operating System)
Windows for Everyone(Operating System)Waleed Khan
 
Linux Memory Management with CMA (Contiguous Memory Allocator)
Linux Memory Management with CMA (Contiguous Memory Allocator)Linux Memory Management with CMA (Contiguous Memory Allocator)
Linux Memory Management with CMA (Contiguous Memory Allocator)Pankaj Suryawanshi
 
The Storage Systems
The Storage Systems The Storage Systems
The Storage Systems Dhaivat Zala
 
Introduction to computer_lec_06_fall_2018
Introduction to computer_lec_06_fall_2018Introduction to computer_lec_06_fall_2018
Introduction to computer_lec_06_fall_2018Ramadan Babers, PhD
 
Computer memory book notes
Computer memory book notes Computer memory book notes
Computer memory book notes Navtej Duhoon
 
Live memory forensics
Live memory forensicsLive memory forensics
Live memory forensicsMehedi Hasan
 

Similar to 3.5 memory and io systems (20)

Windows xp
Windows xpWindows xp
Windows xp
 
5.6 Basic computer structure microprocessors
5.6 Basic computer structure   microprocessors5.6 Basic computer structure   microprocessors
5.6 Basic computer structure microprocessors
 
Hsc computer science chap 1 Operating System (1).pdf
Hsc computer science chap 1 Operating System  (1).pdfHsc computer science chap 1 Operating System  (1).pdf
Hsc computer science chap 1 Operating System (1).pdf
 
Debugging performance issues, memory issues and crashes in .net applications rev
Debugging performance issues, memory issues and crashes in .net applications revDebugging performance issues, memory issues and crashes in .net applications rev
Debugging performance issues, memory issues and crashes in .net applications rev
 
Linux Internals - Interview essentials 3.0
Linux Internals - Interview essentials 3.0Linux Internals - Interview essentials 3.0
Linux Internals - Interview essentials 3.0
 
Computer ACW Computer Architecture L 2.pptx
Computer ACW Computer Architecture L 2.pptxComputer ACW Computer Architecture L 2.pptx
Computer ACW Computer Architecture L 2.pptx
 
ch2-system structure.ppt
ch2-system structure.pptch2-system structure.ppt
ch2-system structure.ppt
 
Ch2 system structure
Ch2 system structureCh2 system structure
Ch2 system structure
 
computer Unit 5
computer Unit 5computer Unit 5
computer Unit 5
 
Windows for Everyone(Operating System)
Windows for Everyone(Operating System)Windows for Everyone(Operating System)
Windows for Everyone(Operating System)
 
Embedded C - Lecture 3
Embedded C - Lecture 3Embedded C - Lecture 3
Embedded C - Lecture 3
 
Memory managment
Memory managmentMemory managment
Memory managment
 
rye.pdf
rye.pdfrye.pdf
rye.pdf
 
Linux Memory Management with CMA (Contiguous Memory Allocator)
Linux Memory Management with CMA (Contiguous Memory Allocator)Linux Memory Management with CMA (Contiguous Memory Allocator)
Linux Memory Management with CMA (Contiguous Memory Allocator)
 
The Storage Systems
The Storage Systems The Storage Systems
The Storage Systems
 
Introduction to computer_lec_06_fall_2018
Introduction to computer_lec_06_fall_2018Introduction to computer_lec_06_fall_2018
Introduction to computer_lec_06_fall_2018
 
Computer memory book notes
Computer memory book notes Computer memory book notes
Computer memory book notes
 
Windows xp
Windows xpWindows xp
Windows xp
 
Live memory forensics
Live memory forensicsLive memory forensics
Live memory forensics
 
Basic course
Basic courseBasic course
Basic course
 

More from Sayed Ahmed

Workplace, Data Analytics, and Ethics
Workplace, Data Analytics, and EthicsWorkplace, Data Analytics, and Ethics
Workplace, Data Analytics, and EthicsSayed Ahmed
 
Python py charm anaconda jupyter installation and basic commands
Python py charm anaconda jupyter   installation and basic commandsPython py charm anaconda jupyter   installation and basic commands
Python py charm anaconda jupyter installation and basic commandsSayed Ahmed
 
[not edited] Demo on mobile app development using ionic framework
[not edited] Demo on mobile app development using ionic framework[not edited] Demo on mobile app development using ionic framework
[not edited] Demo on mobile app development using ionic frameworkSayed Ahmed
 
Sap hana-ide-overview-nodev
Sap hana-ide-overview-nodevSap hana-ide-overview-nodev
Sap hana-ide-overview-nodevSayed Ahmed
 
Will be an introduction to
Will be an introduction toWill be an introduction to
Will be an introduction toSayed Ahmed
 
Whm and cpanel overview hosting control panel overview
Whm and cpanel overview   hosting control panel overviewWhm and cpanel overview   hosting control panel overview
Whm and cpanel overview hosting control panel overviewSayed Ahmed
 
Web application development using zend framework
Web application development using zend frameworkWeb application development using zend framework
Web application development using zend frameworkSayed Ahmed
 
Web design and_html_part_3
Web design and_html_part_3Web design and_html_part_3
Web design and_html_part_3Sayed Ahmed
 
Web design and_html_part_2
Web design and_html_part_2Web design and_html_part_2
Web design and_html_part_2Sayed Ahmed
 
Web design and_html
Web design and_htmlWeb design and_html
Web design and_htmlSayed Ahmed
 
Visual studio ide shortcuts
Visual studio ide shortcutsVisual studio ide shortcuts
Visual studio ide shortcutsSayed Ahmed
 
Unit tests in_symfony
Unit tests in_symfonyUnit tests in_symfony
Unit tests in_symfonySayed Ahmed
 
Telerik this is sayed
Telerik this is sayedTelerik this is sayed
Telerik this is sayedSayed Ahmed
 
System analysis and_design
System analysis and_designSystem analysis and_design
System analysis and_designSayed Ahmed
 
Story telling and_narrative
Story telling and_narrativeStory telling and_narrative
Story telling and_narrativeSayed Ahmed
 

More from Sayed Ahmed (20)

Workplace, Data Analytics, and Ethics
Workplace, Data Analytics, and EthicsWorkplace, Data Analytics, and Ethics
Workplace, Data Analytics, and Ethics
 
Python py charm anaconda jupyter installation and basic commands
Python py charm anaconda jupyter   installation and basic commandsPython py charm anaconda jupyter   installation and basic commands
Python py charm anaconda jupyter installation and basic commands
 
[not edited] Demo on mobile app development using ionic framework
[not edited] Demo on mobile app development using ionic framework[not edited] Demo on mobile app development using ionic framework
[not edited] Demo on mobile app development using ionic framework
 
Sap hana-ide-overview-nodev
Sap hana-ide-overview-nodevSap hana-ide-overview-nodev
Sap hana-ide-overview-nodev
 
Invest wisely
Invest wiselyInvest wisely
Invest wisely
 
Will be an introduction to
Will be an introduction toWill be an introduction to
Will be an introduction to
 
Whm and cpanel overview hosting control panel overview
Whm and cpanel overview   hosting control panel overviewWhm and cpanel overview   hosting control panel overview
Whm and cpanel overview hosting control panel overview
 
Web application development using zend framework
Web application development using zend frameworkWeb application development using zend framework
Web application development using zend framework
 
Web design and_html_part_3
Web design and_html_part_3Web design and_html_part_3
Web design and_html_part_3
 
Web design and_html_part_2
Web design and_html_part_2Web design and_html_part_2
Web design and_html_part_2
 
Web design and_html
Web design and_htmlWeb design and_html
Web design and_html
 
Visual studio ide shortcuts
Visual studio ide shortcutsVisual studio ide shortcuts
Visual studio ide shortcuts
 
Virtualization
VirtualizationVirtualization
Virtualization
 
User interfaces
User interfacesUser interfaces
User interfaces
 
Unreal
UnrealUnreal
Unreal
 
Unit tests in_symfony
Unit tests in_symfonyUnit tests in_symfony
Unit tests in_symfony
 
Telerik this is sayed
Telerik this is sayedTelerik this is sayed
Telerik this is sayed
 
System analysis and_design
System analysis and_designSystem analysis and_design
System analysis and_design
 
Symfony 2
Symfony 2Symfony 2
Symfony 2
 
Story telling and_narrative
Story telling and_narrativeStory telling and_narrative
Story telling and_narrative
 

Recently uploaded

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Recently uploaded (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

3.5 memory and io systems

  • 2. 2 Memory Management  Only applies to languages with explicit memory management (C or C++)  Memory problems are one of the leading causes of bugs in programs
  • 3. 3 Memory Management  We have three goals when working with memory  Safety  Knowledge  Control
  • 4. 4 Memory Management  Memory fragmentation  Free physical memory is only available in small sections  Can prevent an allocation from completing successfully even if there's plenty of free memory  Virtual addressing will greatly help with fragmentation problems
  • 5. 5 Memory Management  Virtual addressing V ir t u a l A d d r e s s T a b le B lo c k 2 B lo c k 4 B lo c k 3 B lo c k 5 B lo c k 1 P h y s ic a l M e m o r y B lo c k 1 B lo c k 4 V ir t u a l M e m o r y V ie w
  • 6. 6 Memory Management  Static memory allocation  If all memory is statically allocated there will be very few problems  Leaks  Fragmentation  Running out of memory  Very restrictive  Lots of wasted memory  Old games used to be done this way
  • 7. 7 Memory Management  Dynamic allocation  Much more flexible than static allocations  Lots of potential problems  Need to override global new and delete to take control over allocations
  • 8. 8 Memory Management  Memory manager  Heaps are collections of memory allocations  Override class-specific operator new and delete to assign classes to heaps  We can add some simple error-checking schemes to prevent memory overrun problems
  • 9. 9 Memory Management  Memory leaks  A memory leak is a memory allocation that is no longer necessary and was not released by the program  Memory leaks can cause the game to use up resources and run out of memory  To find all memory leaks, we look for all the allocations that occurred between two particular points in time
  • 10. 10 Memory Management  Memory pools  Memory pools are contiguous blocks of memory used to allocate objects  Allocations are extremely fast  There is no fragmentation  They will usually have some unused space  We can allocate objects from specific classes with a simple macro
  • 11. 11 Memory Management  Memory pools E m p t y b lo c k E m p t y b lo c k h e a d e r B lo c k w it h d a t a a b c
  • 12. 12 File I/O  Sometimes full file I/O not available on all platforms  Different ways of accessing different devices  Memory cards, network, etc  Usually have no control over physical disk allocation  Which can lead to long load times
  • 13. 13 File I/O  Unified file system  Platform independent  Provide same interface to different types of media  Based around FileSystem class
  • 14. 14 File I/O  File system  Uses concept of streams  Stream can be the source of data  Possible sources  File, memory, network  Or it can be a layer that adds some properties  Possible layers  Buffering, compression, range, etc
  • 15. 15 File I/O  File system B u f f e r i n g L a y e rF i l e S o u r c e D a t a S t r e a m
  • 16. 16 Game Resources  A game resource (or asset) is anything that gets loaded that could be shared by several parts of the game  A texture, an animation, a sound, etc  We want to load and share resources easily  There will be many different types of resources in a game
  • 17. 17 Game Resources  Resource manager  Uses registering object factory pattern  Can register different types of resources  All resource creation goes through the resource manager  Any requests for existing resources don't load it again
  • 18. 18 Game Resources  Resource lifetime  If resources are shared, how do we know when we can destroy them?  All at once  At the end of the level  Explicit lifetime management  Reference counting
  • 19. 19 Game Resources  Resources and instances  Resource is the part of the asset that can be shared among all parts of the game  Instance is the unique data that each part of the game needs to keep
  • 20. 20 Serialization  Every game needs to save and restore some game state  Even for check point saves  Level editing and creation could be implemented as a saved game
  • 21. 21 Serialization  Saving  ISerializable interface for Read and Write operations  Each class implements the Write() function  Saving pointers is a problem  They won't be the same when we load  Save raw pointers to other objects  Translate them later
  • 22. 22 Serialization  Loading  Create object types through an object factory  Read() function takes care of loading the data from the stream  Pointers are loaded into a translation table  Second pass fixes up all the pointers