SlideShare a Scribd company logo
1 of 28
Memory Allocation
                     In
         Classic Monolithic Kernel
                    And
            Classic Micro Kernel

陳膺正 (Hawx Chen )
yingjheng.chen@gmail.com
http://gplus.to/HawxChen
http://hawxchen.blogspot.tw

         Presented at COSCUP2012- JuluOS Workshop/JuluOSDev http://www.juluos.org/
Who Am I
• Experience
  – 2008 NCTU CS Bachelor
  – 2010 NTU CSIE Master
  – 2010~presnet Mstar Semiconductor
     • Senior software engineer
• Open Source
  – https://github.com/HawxChen/MIT-6.828-
    Adventure Enjoy to implement OS
Memory Management
• Importance of History.
• Based Arch:
  – Classic Monolithic: UNIX v6
  – Classic Microkernel: MINIX
• UNIX
  – Kernel(Physical) Memory Allocator
  – User(virtual) Memory Allocator
• MINIX
  – Kernel(Physical) Memory Allocator
  – User Memory Allocator
Memory Management
• Importance of History.
• Based Arch:
  – Classic Monolithic: UNIX v6
  – Classic Microkernel: MINIX
• UNIX
  – Kernel(Physical) Memory Allocator
  – User(virtual) Memory Allocator
• MINIX
  – Kernel(Physical) Memory Allocator
  – User Memory Allocator
Importance of History
• Computer
  programmming is Art?




From
http://www2.uwstout.edu/content/profdev/images/kelly_art_history.jpg
http://www.informit.com/ShowCover.aspx?isbn=0201485419
Importance of history
• Having an understanding of the battles
  fought in the past will give you the
  ammunition for your current battles
  了解過去的戰場在爭什麼,會讓你得到現
行戰場的火藥。
Importance of history
Importance of history
Memory Management
• Importance of History.
• Based Arch:
  – Classic Monolithic: UNIX v6
  – Classic Microkernel: MINIX
• UNIX
  – Kernel(Physical) Memory Allocator
  – User(virtual) Memory Allocator
• MINIX
  – Kernel(Physical) Memory Allocator
  – User Memory Allocator
UNIX Arch
                     User Process
                      System Call



 Process
 Management                                         I/O Services
                                      Device
                                      Drivers
         Scheduler
                       Hardware

                                      I/O Buffers
Memory
Management                                      File
                                                System

                                      Kernel Space
                Interface (Library Routines)
                       User Process
MINIX Arch




 Kernel Space
MINIX Scheduling
• When to run each component?
• Scheduler
  – Multilevel Queue
  – Lazy scheduling
Memory Management
• Importance of History.
• Based Arch:
  – Classic Monolithic: UNIX v6
  – Classic Microkernel: MINIX
• UNIX
  – Kernel(Physical) Memory Allocator
  – User(virtual) Memory Allocator
• MINIX
  – Kernel(Physical) Memory Allocator
  – User Memory Allocator
• How to start
Some UNIX v6 Features
              HW: PDP machine
• 2Byte (1 Word) Alignment
• Block Addressed: 64 Bytes


    KISA0   KISD0   UISA0   UISD0
UNIX Kernel Addressing Space
                                         Physical

• Kernel segment registers
                                          Loader/
  initialized at m40.S                    INT&Trap
   – KISA0 ~ KISA5 : 0~48KB               functions
   – KISA6 KISD6: Per process data and
     structure.                          Kernel context
   – KISA7 KISD7: IO Segment
                                            Kernel
                                           data/bss
                                         u per-process
                                             data




• #0 system process(scheduler)             IO address
                                             space
• #1 init process
UNIX Kernel Addressing Space
• Kernel segment registers
  initialized at m40.S
   – KISA0 ~ KISA5 : 0~48KB
   – KISA6 KISD6: Per process data and
     structure.
   – KISA7 KISD7: IO Segment
                                       stack
        kernel stack
                                        u per-
                                     process data
                                                    1K
        struct user data structure


• #0 system process(scheduler)
• #1 init process
UNIX Kernel Memory Allocation
• coremap counted from *ka6+USIZE
 Loader/
 INT&Trap
 functions

 Kernel context
                    First Fit         Avail Memory
    Kernel
   data/bss
 u per-process     48K
     data                 stack
                        struct user
 Avail
 Memory
                  49K
   IO address
     space
UNIX User Memory Allocation
      • User segment registers initialized at main
            – UISA/UISD
            – Text+Data(BSS)+Stack + U(Kernel Stack/Internal PCB) <=
              64KB
                              0
  Virtual              Physical
  0
        Context
                                  Context

            Data
                                   Data
                                   Stack
       unmapped


64KB        Stack       256KB
Memory Management
• Importance of History.
• Based Arch:
  –   Classic Monolithic: UNIX v6
  –   Classic Microkernel: MINIX
  –   UNIX
  –   Kernel(Physical) Memory Allocator
  –   User(virtual) Memory Allocator
• MINIX
  – Kernel(Physical) Memory Allocator
  – User Memory Allocator
MINIX Kernel Address Space
• Kernel don’t use any dynamic
  memory
• Hardware independent
• View entire available memory
  as CLIKCS (1024 Byte)
MINIX Memory Manager

                     PM

                Mm         Pm




             • Almost hardware
               independent
             • User mode
MINIX Physical Memory Manager
• Hole List manager                   Hole structure

                      hole_head


                              Base1   Base1       Base1       BaseN
                              Size1   Size1       Size1   …   SizeN




                                                          …
MINIX User Memory Allocation
• Holes: Free memory slot
   – Unit: # clicks (1024 Bytes)
                                   0x25863
• Size calculated from file
  header                               Context
• Gap: Available memory                 Data     0x25863
• No memory
  relocation(Before swapped
                                                 0x31945
  out)                                  Gap
• No memory expansion                   Gap
   – Gap adjustment                     Stack
• No memory translation
                                    0x31945
   – No virtual memory
   (Before 3.1.4)
Something I want to convey!
• History is the ONE PIECE.

• How to start to implement OS?
  – What’s the most important?
  – Keep others to be as simple as possible.


• Join us.
Reference

More Related Content

What's hot

Linux kernel Architecture and Properties
Linux kernel Architecture and PropertiesLinux kernel Architecture and Properties
Linux kernel Architecture and PropertiesSaadi Rahman
 
Linux architecture
Linux architectureLinux architecture
Linux architecturemcganesh
 
Union FileSystem - A Building Blocks Of a Container
Union FileSystem - A Building Blocks Of a ContainerUnion FileSystem - A Building Blocks Of a Container
Union FileSystem - A Building Blocks Of a ContainerKnoldus Inc.
 
Kernel init
Kernel initKernel init
Kernel initgowell
 
Kernel Recipes 2015: Solving the Linux storage scalability bottlenecks
Kernel Recipes 2015: Solving the Linux storage scalability bottlenecksKernel Recipes 2015: Solving the Linux storage scalability bottlenecks
Kernel Recipes 2015: Solving the Linux storage scalability bottlenecksAnne Nicolas
 
Introduction to systemd
Introduction to systemdIntroduction to systemd
Introduction to systemdYusaku OGAWA
 
Kernel Recipes 2016 -
Kernel Recipes 2016 - Kernel Recipes 2016 -
Kernel Recipes 2016 - Anne Nicolas
 
Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)Bud Siddhisena
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Tushar B Kute
 
Operating system kernal
Operating system kernalOperating system kernal
Operating system kernalSumit Rajpal
 
Linux io-stack-diagram v1.0
Linux io-stack-diagram v1.0Linux io-stack-diagram v1.0
Linux io-stack-diagram v1.0bsd free
 

What's hot (20)

Linux kernel Architecture and Properties
Linux kernel Architecture and PropertiesLinux kernel Architecture and Properties
Linux kernel Architecture and Properties
 
Ubuntu OS Presentation
Ubuntu OS PresentationUbuntu OS Presentation
Ubuntu OS Presentation
 
LSA2 - 02 Namespaces
LSA2 - 02  NamespacesLSA2 - 02  Namespaces
LSA2 - 02 Namespaces
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
 
Union FileSystem - A Building Blocks Of a Container
Union FileSystem - A Building Blocks Of a ContainerUnion FileSystem - A Building Blocks Of a Container
Union FileSystem - A Building Blocks Of a Container
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Kernel init
Kernel initKernel init
Kernel init
 
Basic of Systemd
Basic of SystemdBasic of Systemd
Basic of Systemd
 
Kernel Recipes 2015: Solving the Linux storage scalability bottlenecks
Kernel Recipes 2015: Solving the Linux storage scalability bottlenecksKernel Recipes 2015: Solving the Linux storage scalability bottlenecks
Kernel Recipes 2015: Solving the Linux storage scalability bottlenecks
 
Introduction to systemd
Introduction to systemdIntroduction to systemd
Introduction to systemd
 
Kernal
KernalKernal
Kernal
 
File server-info
File server-infoFile server-info
File server-info
 
Kernel Recipes 2016 -
Kernel Recipes 2016 - Kernel Recipes 2016 -
Kernel Recipes 2016 -
 
MDAD 5 - Threads
MDAD 5 - ThreadsMDAD 5 - Threads
MDAD 5 - Threads
 
Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)
 
Kernal
KernalKernal
Kernal
 
Operating system kernal
Operating system kernalOperating system kernal
Operating system kernal
 
Linux io-stack-diagram v1.0
Linux io-stack-diagram v1.0Linux io-stack-diagram v1.0
Linux io-stack-diagram v1.0
 

Similar to Memory_AllocationUNIX_MINIX-COSCUP2012

Workshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with VolatilityWorkshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with VolatilityAndrew Case
 
NXP IMX6 Processor - Embedded Linux
NXP IMX6 Processor - Embedded LinuxNXP IMX6 Processor - Embedded Linux
NXP IMX6 Processor - Embedded LinuxNEEVEE Technologies
 
Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)Vivian Vhaves
 
Linux kernel architecture
Linux kernel architectureLinux kernel architecture
Linux kernel architectureSHAJANA BASHEER
 
Chap1_Part2.pptx
Chap1_Part2.pptxChap1_Part2.pptx
Chap1_Part2.pptxNMohd3
 
Introduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsQUONTRASOLUTIONS
 
Working of Volatile and Non-Volatile memory
Working of Volatile and Non-Volatile memoryWorking of Volatile and Non-Volatile memory
Working of Volatile and Non-Volatile memoryDon Caeiro
 
introduction.pdf
introduction.pdfintroduction.pdf
introduction.pdfxiso
 
MIPS Assembly Language I
MIPS Assembly Language IMIPS Assembly Language I
MIPS Assembly Language ILiEdo
 
Lec 10-linux-review
Lec 10-linux-reviewLec 10-linux-review
Lec 10-linux-reviewabinaya m
 
Mac Memory Analysis with Volatility
Mac Memory Analysis with VolatilityMac Memory Analysis with Volatility
Mac Memory Analysis with VolatilityAndrew Case
 
OpenNebulaConf2017EU: Hyper converged infrastructure with OpenNebula and Ceph...
OpenNebulaConf2017EU: Hyper converged infrastructure with OpenNebula and Ceph...OpenNebulaConf2017EU: Hyper converged infrastructure with OpenNebula and Ceph...
OpenNebulaConf2017EU: Hyper converged infrastructure with OpenNebula and Ceph...OpenNebula Project
 
Linux操作系统01 简介
Linux操作系统01 简介Linux操作系统01 简介
Linux操作系统01 简介lclsg123
 
Optimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsOptimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsTony Nguyen
 

Similar to Memory_AllocationUNIX_MINIX-COSCUP2012 (20)

The Linux System
The Linux SystemThe Linux System
The Linux System
 
Workshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with VolatilityWorkshop - Linux Memory Analysis with Volatility
Workshop - Linux Memory Analysis with Volatility
 
Os
OsOs
Os
 
NXP IMX6 Processor - Embedded Linux
NXP IMX6 Processor - Embedded LinuxNXP IMX6 Processor - Embedded Linux
NXP IMX6 Processor - Embedded Linux
 
Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)
 
Linux kernel architecture
Linux kernel architectureLinux kernel architecture
Linux kernel architecture
 
Chap1_Part2.pptx
Chap1_Part2.pptxChap1_Part2.pptx
Chap1_Part2.pptx
 
Introduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra Solutions
 
ubantu ppt.pptx
ubantu ppt.pptxubantu ppt.pptx
ubantu ppt.pptx
 
Working of Volatile and Non-Volatile memory
Working of Volatile and Non-Volatile memoryWorking of Volatile and Non-Volatile memory
Working of Volatile and Non-Volatile memory
 
introduction.pdf
introduction.pdfintroduction.pdf
introduction.pdf
 
NSCC Training - Introductory Class
NSCC Training - Introductory ClassNSCC Training - Introductory Class
NSCC Training - Introductory Class
 
MIPS Assembly Language I
MIPS Assembly Language IMIPS Assembly Language I
MIPS Assembly Language I
 
Lec 10-linux-review
Lec 10-linux-reviewLec 10-linux-review
Lec 10-linux-review
 
IBM-AIX Classroom Training
IBM-AIX Classroom TrainingIBM-AIX Classroom Training
IBM-AIX Classroom Training
 
Mac Memory Analysis with Volatility
Mac Memory Analysis with VolatilityMac Memory Analysis with Volatility
Mac Memory Analysis with Volatility
 
OpenNebulaConf2017EU: Hyper converged infrastructure with OpenNebula and Ceph...
OpenNebulaConf2017EU: Hyper converged infrastructure with OpenNebula and Ceph...OpenNebulaConf2017EU: Hyper converged infrastructure with OpenNebula and Ceph...
OpenNebulaConf2017EU: Hyper converged infrastructure with OpenNebula and Ceph...
 
Linux操作系统01 简介
Linux操作系统01 简介Linux操作系统01 简介
Linux操作系统01 简介
 
IBM-AIX Online Training
IBM-AIX Online TrainingIBM-AIX Online Training
IBM-AIX Online Training
 
Optimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsOptimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessors
 

Recently uploaded

一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样awasv46j
 
Essential UI/UX Design Principles: A Comprehensive Guide
Essential UI/UX Design Principles: A Comprehensive GuideEssential UI/UX Design Principles: A Comprehensive Guide
Essential UI/UX Design Principles: A Comprehensive GuideDesign Studio UI UX
 
Call Girls Jalaun Just Call 8617370543 Top Class Call Girl Service Available
Call Girls Jalaun Just Call 8617370543 Top Class Call Girl Service AvailableCall Girls Jalaun Just Call 8617370543 Top Class Call Girl Service Available
Call Girls Jalaun Just Call 8617370543 Top Class Call Girl Service AvailableNitya salvi
 
Minimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptxMinimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptxbalqisyamutia
 
Simple Conference Style Presentation by Slidesgo.pptx
Simple Conference Style Presentation by Slidesgo.pptxSimple Conference Style Presentation by Slidesgo.pptx
Simple Conference Style Presentation by Slidesgo.pptxbalqisyamutia
 
Aminabad * High Profile Escorts Service in Lucknow Phone No 9548273370 Elite ...
Aminabad * High Profile Escorts Service in Lucknow Phone No 9548273370 Elite ...Aminabad * High Profile Escorts Service in Lucknow Phone No 9548273370 Elite ...
Aminabad * High Profile Escorts Service in Lucknow Phone No 9548273370 Elite ...HyderabadDolls
 
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样yhavx
 
Jordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdfJordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdfamanda2495
 
Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...
Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...
Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...Nitya salvi
 
Gamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad IbrahimGamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad Ibrahimamgadibrahim92
 
Branding in the Psychedelic Landscape Report.pdf
Branding in the Psychedelic Landscape Report.pdfBranding in the Psychedelic Landscape Report.pdf
Branding in the Psychedelic Landscape Report.pdfAlexandra Plesner
 
Resume all my skills and educations and achievement
Resume all my skills and educations and  achievement Resume all my skills and educations and  achievement
Resume all my skills and educations and achievement 210303105569
 
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证ehyxf
 
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEKLANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEKMarekMitek1
 
Pondicherry Escorts Service Girl ^ 9332606886, WhatsApp Anytime Pondicherry
Pondicherry Escorts Service Girl ^ 9332606886, WhatsApp Anytime PondicherryPondicherry Escorts Service Girl ^ 9332606886, WhatsApp Anytime Pondicherry
Pondicherry Escorts Service Girl ^ 9332606886, WhatsApp Anytime Pondicherrymeghakumariji156
 
Kondapur ] High Profile Call Girls in Hyderabad (Adult Only) 9352988975 Escor...
Kondapur ] High Profile Call Girls in Hyderabad (Adult Only) 9352988975 Escor...Kondapur ] High Profile Call Girls in Hyderabad (Adult Only) 9352988975 Escor...
Kondapur ] High Profile Call Girls in Hyderabad (Adult Only) 9352988975 Escor...manjugarg389
 
How to Build a Simple Shopify Website
How to Build a Simple Shopify WebsiteHow to Build a Simple Shopify Website
How to Build a Simple Shopify Websitemark11275
 
Q4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentationQ4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentationZenSeloveres
 
Design-System - FinTech - Isadora Agency
Design-System - FinTech - Isadora AgencyDesign-System - FinTech - Isadora Agency
Design-System - FinTech - Isadora AgencyIsadora Agency
 
Dahisar Comfortable Call Girls ,09167354423,Mira Road Model Call Girls
Dahisar Comfortable Call Girls ,09167354423,Mira Road Model Call GirlsDahisar Comfortable Call Girls ,09167354423,Mira Road Model Call Girls
Dahisar Comfortable Call Girls ,09167354423,Mira Road Model Call GirlsPriya Reddy
 

Recently uploaded (20)

一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
 
Essential UI/UX Design Principles: A Comprehensive Guide
Essential UI/UX Design Principles: A Comprehensive GuideEssential UI/UX Design Principles: A Comprehensive Guide
Essential UI/UX Design Principles: A Comprehensive Guide
 
Call Girls Jalaun Just Call 8617370543 Top Class Call Girl Service Available
Call Girls Jalaun Just Call 8617370543 Top Class Call Girl Service AvailableCall Girls Jalaun Just Call 8617370543 Top Class Call Girl Service Available
Call Girls Jalaun Just Call 8617370543 Top Class Call Girl Service Available
 
Minimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptxMinimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptx
 
Simple Conference Style Presentation by Slidesgo.pptx
Simple Conference Style Presentation by Slidesgo.pptxSimple Conference Style Presentation by Slidesgo.pptx
Simple Conference Style Presentation by Slidesgo.pptx
 
Aminabad * High Profile Escorts Service in Lucknow Phone No 9548273370 Elite ...
Aminabad * High Profile Escorts Service in Lucknow Phone No 9548273370 Elite ...Aminabad * High Profile Escorts Service in Lucknow Phone No 9548273370 Elite ...
Aminabad * High Profile Escorts Service in Lucknow Phone No 9548273370 Elite ...
 
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
 
Jordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdfJordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdf
 
Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...
Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...
Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...
 
Gamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad IbrahimGamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad Ibrahim
 
Branding in the Psychedelic Landscape Report.pdf
Branding in the Psychedelic Landscape Report.pdfBranding in the Psychedelic Landscape Report.pdf
Branding in the Psychedelic Landscape Report.pdf
 
Resume all my skills and educations and achievement
Resume all my skills and educations and  achievement Resume all my skills and educations and  achievement
Resume all my skills and educations and achievement
 
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
 
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEKLANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
 
Pondicherry Escorts Service Girl ^ 9332606886, WhatsApp Anytime Pondicherry
Pondicherry Escorts Service Girl ^ 9332606886, WhatsApp Anytime PondicherryPondicherry Escorts Service Girl ^ 9332606886, WhatsApp Anytime Pondicherry
Pondicherry Escorts Service Girl ^ 9332606886, WhatsApp Anytime Pondicherry
 
Kondapur ] High Profile Call Girls in Hyderabad (Adult Only) 9352988975 Escor...
Kondapur ] High Profile Call Girls in Hyderabad (Adult Only) 9352988975 Escor...Kondapur ] High Profile Call Girls in Hyderabad (Adult Only) 9352988975 Escor...
Kondapur ] High Profile Call Girls in Hyderabad (Adult Only) 9352988975 Escor...
 
How to Build a Simple Shopify Website
How to Build a Simple Shopify WebsiteHow to Build a Simple Shopify Website
How to Build a Simple Shopify Website
 
Q4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentationQ4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentation
 
Design-System - FinTech - Isadora Agency
Design-System - FinTech - Isadora AgencyDesign-System - FinTech - Isadora Agency
Design-System - FinTech - Isadora Agency
 
Dahisar Comfortable Call Girls ,09167354423,Mira Road Model Call Girls
Dahisar Comfortable Call Girls ,09167354423,Mira Road Model Call GirlsDahisar Comfortable Call Girls ,09167354423,Mira Road Model Call Girls
Dahisar Comfortable Call Girls ,09167354423,Mira Road Model Call Girls
 

Memory_AllocationUNIX_MINIX-COSCUP2012

  • 1. Memory Allocation In Classic Monolithic Kernel And Classic Micro Kernel 陳膺正 (Hawx Chen ) yingjheng.chen@gmail.com http://gplus.to/HawxChen http://hawxchen.blogspot.tw Presented at COSCUP2012- JuluOS Workshop/JuluOSDev http://www.juluos.org/
  • 2. Who Am I • Experience – 2008 NCTU CS Bachelor – 2010 NTU CSIE Master – 2010~presnet Mstar Semiconductor • Senior software engineer • Open Source – https://github.com/HawxChen/MIT-6.828- Adventure Enjoy to implement OS
  • 3. Memory Management • Importance of History. • Based Arch: – Classic Monolithic: UNIX v6 – Classic Microkernel: MINIX • UNIX – Kernel(Physical) Memory Allocator – User(virtual) Memory Allocator • MINIX – Kernel(Physical) Memory Allocator – User Memory Allocator
  • 4. Memory Management • Importance of History. • Based Arch: – Classic Monolithic: UNIX v6 – Classic Microkernel: MINIX • UNIX – Kernel(Physical) Memory Allocator – User(virtual) Memory Allocator • MINIX – Kernel(Physical) Memory Allocator – User Memory Allocator
  • 5. Importance of History • Computer programmming is Art? From http://www2.uwstout.edu/content/profdev/images/kelly_art_history.jpg http://www.informit.com/ShowCover.aspx?isbn=0201485419
  • 6.
  • 7. Importance of history • Having an understanding of the battles fought in the past will give you the ammunition for your current battles 了解過去的戰場在爭什麼,會讓你得到現 行戰場的火藥。
  • 10. Memory Management • Importance of History. • Based Arch: – Classic Monolithic: UNIX v6 – Classic Microkernel: MINIX • UNIX – Kernel(Physical) Memory Allocator – User(virtual) Memory Allocator • MINIX – Kernel(Physical) Memory Allocator – User Memory Allocator
  • 11. UNIX Arch User Process System Call Process Management I/O Services Device Drivers Scheduler Hardware I/O Buffers Memory Management File System Kernel Space Interface (Library Routines) User Process
  • 13. MINIX Scheduling • When to run each component? • Scheduler – Multilevel Queue – Lazy scheduling
  • 14. Memory Management • Importance of History. • Based Arch: – Classic Monolithic: UNIX v6 – Classic Microkernel: MINIX • UNIX – Kernel(Physical) Memory Allocator – User(virtual) Memory Allocator • MINIX – Kernel(Physical) Memory Allocator – User Memory Allocator • How to start
  • 15. Some UNIX v6 Features HW: PDP machine • 2Byte (1 Word) Alignment • Block Addressed: 64 Bytes KISA0 KISD0 UISA0 UISD0
  • 16. UNIX Kernel Addressing Space Physical • Kernel segment registers Loader/ initialized at m40.S INT&Trap – KISA0 ~ KISA5 : 0~48KB functions – KISA6 KISD6: Per process data and structure. Kernel context – KISA7 KISD7: IO Segment Kernel data/bss u per-process data • #0 system process(scheduler) IO address space • #1 init process
  • 17. UNIX Kernel Addressing Space • Kernel segment registers initialized at m40.S – KISA0 ~ KISA5 : 0~48KB – KISA6 KISD6: Per process data and structure. – KISA7 KISD7: IO Segment stack kernel stack u per- process data 1K struct user data structure • #0 system process(scheduler) • #1 init process
  • 18. UNIX Kernel Memory Allocation • coremap counted from *ka6+USIZE Loader/ INT&Trap functions Kernel context First Fit Avail Memory Kernel data/bss u per-process 48K data stack struct user Avail Memory 49K IO address space
  • 19. UNIX User Memory Allocation • User segment registers initialized at main – UISA/UISD – Text+Data(BSS)+Stack + U(Kernel Stack/Internal PCB) <= 64KB 0 Virtual Physical 0 Context Context Data Data Stack unmapped 64KB Stack 256KB
  • 20. Memory Management • Importance of History. • Based Arch: – Classic Monolithic: UNIX v6 – Classic Microkernel: MINIX – UNIX – Kernel(Physical) Memory Allocator – User(virtual) Memory Allocator • MINIX – Kernel(Physical) Memory Allocator – User Memory Allocator
  • 21. MINIX Kernel Address Space • Kernel don’t use any dynamic memory • Hardware independent • View entire available memory as CLIKCS (1024 Byte)
  • 22. MINIX Memory Manager PM Mm Pm • Almost hardware independent • User mode
  • 23. MINIX Physical Memory Manager • Hole List manager Hole structure hole_head Base1 Base1 Base1 BaseN Size1 Size1 Size1 … SizeN …
  • 24. MINIX User Memory Allocation • Holes: Free memory slot – Unit: # clicks (1024 Bytes) 0x25863 • Size calculated from file header Context • Gap: Available memory Data 0x25863 • No memory relocation(Before swapped 0x31945 out) Gap • No memory expansion Gap – Gap adjustment Stack • No memory translation 0x31945 – No virtual memory (Before 3.1.4)
  • 25. Something I want to convey!
  • 26. • History is the ONE PIECE. • How to start to implement OS? – What’s the most important? – Keep others to be as simple as possible. • Join us.
  • 27.