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 architecture
Linux architectureLinux architecture
Linux architecture
mcganesh
 
Kernel init
Kernel initKernel init
Kernel init
gowell
 
Linux io-stack-diagram v1.0
Linux io-stack-diagram v1.0Linux io-stack-diagram v1.0
Linux io-stack-diagram v1.0
bsd 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

Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)Ospresentation 120112074429-phpapp02 (1)
Ospresentation 120112074429-phpapp02 (1)
Vivian Vhaves
 
Chap1_Part2.pptx
Chap1_Part2.pptxChap1_Part2.pptx
Chap1_Part2.pptx
NMohd3
 
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 multiprocessors
Tony 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

Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation deck
tbatkhuu1
 
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
amitlee9823
 
The history of music videos a level presentation
The history of music videos a level presentationThe history of music videos a level presentation
The history of music videos a level presentation
amedia6
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
amitlee9823
 
Design Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxDesign Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptx
TusharBahuguna2
 
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts ServiceVVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
aroranaina404
 
infant assessment fdbbdbdddinal ppt.pptx
infant assessment fdbbdbdddinal ppt.pptxinfant assessment fdbbdbdddinal ppt.pptx
infant assessment fdbbdbdddinal ppt.pptx
suhanimunjal27
 
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
amitlee9823
 
2-tool presenthdbdbdbdbddhdhddation.pptx
2-tool presenthdbdbdbdbddhdhddation.pptx2-tool presenthdbdbdbdbddhdhddation.pptx
2-tool presenthdbdbdbdbddhdhddation.pptx
suhanimunjal27
 
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵
anilsa9823
 
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
soniya singh
 
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
amitlee9823
 

Recently uploaded (20)

Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation deck
 
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfChapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
 
The history of music videos a level presentation
The history of music videos a level presentationThe history of music videos a level presentation
The history of music videos a level presentation
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Design Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxDesign Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptx
 
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts ServiceVVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
 
infant assessment fdbbdbdddinal ppt.pptx
infant assessment fdbbdbdddinal ppt.pptxinfant assessment fdbbdbdddinal ppt.pptx
infant assessment fdbbdbdddinal ppt.pptx
 
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
2-tool presenthdbdbdbdbddhdhddation.pptx
2-tool presenthdbdbdbdbddhdhddation.pptx2-tool presenthdbdbdbdbddhdhddation.pptx
2-tool presenthdbdbdbdbddhdhddation.pptx
 
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
 
💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...
💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...
💫✅jodhpur 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATISFACT...
 
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵
 
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
 
Case Study of Hotel Taj Vivanta, Pune
Case Study of Hotel Taj Vivanta, PuneCase Study of Hotel Taj Vivanta, Pune
Case Study of Hotel Taj Vivanta, Pune
 
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
 
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
 
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdfThe_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
 
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...
 

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.