SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
How to rewrite the OS using C
by strong type
Metasepi Project / Kiwamu Okabe
Who am I?
☆ http://www.masterq.net/
☆ Organizer of Metasepi Project
☆ A developer of Ajhc Haskell compiler
☆ A Debian Maintainer
☆ 10 years' experience in developing
OS using NetBSD
Agenda
☆ [1] Problems of OS using C
☆ [2] Type safety
☆ [3] Existing OS using strong type
☆ [4] Snatch-driven development
☆ [5] Demo
☆ [6] Case study of Snatch
☆ [7] Future work
[1] Problems of OS using C
☆ Most OS uses C language
☆ C is good for system programming
☆ But C occurs many problems
Buffer overrun
☆ Pointer to array doesn't know the
length
Page fault in kernel
☆ Page fault in user space => SEGV
☆ Page fault in kernel space => Halt!
Weak type
☆ Great use of (void *) type
☆ NetBSD kernel uses 45130 times!
$ pwd
/home/kiwamu/src/netbsd/sys
$ grep "void *" `find . -name "*.c"` | wc -l
45130

☆ No choice but to use weak type for
flexibility
[2] Type safety
☆ Get less runtime errors
Avoid buffer overrun
Strong type avoids buffer overrun.
Avoid page fault in kernel
Only touch the area constructed.
Flexibility without weak type
☆ Algebraic data type
data Node = Leaf Integer | Branch Node Node

☆ Type class
class Functor f where
fmap :: (a -> b) -> f a -> f b
instance Functor [] where
fmap f (x:xs) = f x : fmap f xs
fmap f [] = []
instance Functor Maybe where
fmap _ Nothing = Nothing
fmap f (Just x) = Just (f x)

☆ Type inference
Kernel needs strong type
☆ IoT:Internet of Things
☆ Poor hardware, and Rich feature
☆ Many custom requests shower kernel
☆ Strong type is needed by kernel
rather than application on user space
[3] Existing OS using strong type
Alreadly we have.
☆ Funk
http://home.gna.org/funk/

☆ snowflake-os
https://code.google.com/p/snowflake-os/

☆ House
http://programatica.cs.pdx.edu/House/

Why isn't it for daily use?
Poor design and less functions
☆ Design from scratch
☆ Polling interrupt
☆ Not have bus driver
☆ Support less devices
☆ Only for x86
☆ Can't run Firefox
No compatible POSIX
[4] Snatch-driven development
Rewrite kernel using C with strong type
by little and little.
UNIX like OS needs reentrant
Strong type OS uses polling intr
Ajhc Haskell compiler
Context can run without lock.
[5] Demo
The proof of the pudding is in the eating.
MCU app without OS #1
https://github.com/ajhc/demo-cortex-m3
MCU app without OS #2
Memory map
MCU app with OS
https://github.com/ajhc/demo-cortex-m3
[6] Case study of Snatch
We found some idioms that are useful
to rewrite C language with Haskell.
Idiom1: Call function
C and Haskell call with each other.
Idiom2: Read/Write memory
Haskell can read/write memory directly.
Idiom3: Read/Write struct
Read structs chained with pointer.
Idiom4: Foreign Primitives
Directly insert the text following const.
[7] Future work
☆ Benchmark
☆ Pointer combinator
☆ Share state between contexts
☆ Porting libraries running on GHC
☆ Debug method
☆ Fix many bugs
Try to use the other language
☆ ATS
http://www.ats-lang.org/
JATS-UG - Japan ATS User Group
http://jats-ug.metasepi.org/
☆ Rust
http://www.rust-lang.org/
Workshop at Nagoya
☆ Functional MCU programing
workshop at Nagoya
☆ Meeting minutes
http://metasepi.org/posts/2014-01-05-mbed_fp_0.html

Weitere ähnliche Inhalte

Was ist angesagt?

Pulumi. Modern Infrastructure as Code.
Pulumi. Modern Infrastructure as Code.Pulumi. Modern Infrastructure as Code.
Pulumi. Modern Infrastructure as Code.Yurii Bychenok
 
Introduction to go, and why it's awesome
Introduction to go, and why it's awesomeIntroduction to go, and why it's awesome
Introduction to go, and why it's awesomeJanet Kuo
 
KDE Plasma Develop Intro
KDE Plasma Develop IntroKDE Plasma Develop Intro
KDE Plasma Develop Introcsslayer
 
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVMHOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVMOwais Zahid
 
Vagrant, Ansible and Docker - How they fit together for productive flexible d...
Vagrant, Ansible and Docker - How they fit together for productive flexible d...Vagrant, Ansible and Docker - How they fit together for productive flexible d...
Vagrant, Ansible and Docker - How they fit together for productive flexible d...Samuel Lampa
 
Les nouveautés de C# 7
Les nouveautés de C# 7Les nouveautés de C# 7
Les nouveautés de C# 7Microsoft
 
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...Pôle Systematic Paris-Region
 
From Python to smartphones: neural nets @ Saint-Gobain, François Sausset
From Python to smartphones: neural nets @ Saint-Gobain, François SaussetFrom Python to smartphones: neural nets @ Saint-Gobain, François Sausset
From Python to smartphones: neural nets @ Saint-Gobain, François SaussetPôle Systematic Paris-Region
 
Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...
Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...
Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...Pôle Systematic Paris-Region
 
Ondřej Procházka - Deployment podle Devel.cz
Ondřej Procházka - Deployment podle Devel.czOndřej Procházka - Deployment podle Devel.cz
Ondřej Procházka - Deployment podle Devel.czDevelcz
 
Recent c++ goodies (March 2018)
Recent c++ goodies (March 2018)Recent c++ goodies (March 2018)
Recent c++ goodies (March 2018)Bartlomiej Filipek
 
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with PulumiInfrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with Pulumiinovex GmbH
 
Modern Perl desktop apps - Cluj.pm March 2014
Modern Perl desktop apps - Cluj.pm March 2014Modern Perl desktop apps - Cluj.pm March 2014
Modern Perl desktop apps - Cluj.pm March 2014Arpad Szasz
 
Quick Review of Desktop and Native Apps using Javascript
Quick Review of Desktop and Native Apps using JavascriptQuick Review of Desktop and Native Apps using Javascript
Quick Review of Desktop and Native Apps using JavascriptRobert Ellen
 
AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8Phil Eaton
 
What's New in ASP.NET Core 2.0
What's New in ASP.NET Core 2.0What's New in ASP.NET Core 2.0
What's New in ASP.NET Core 2.0Jon Galloway
 
関西アンカンファレンス Python の Paver について
関西アンカンファレンス Python の Paver について関西アンカンファレンス Python の Paver について
関西アンカンファレンス Python の Paver についてShinya Ohyanagi
 
Type script新鮮貨報你知
Type script新鮮貨報你知Type script新鮮貨報你知
Type script新鮮貨報你知Jimmy Ho
 

Was ist angesagt? (20)

Pulumi. Modern Infrastructure as Code.
Pulumi. Modern Infrastructure as Code.Pulumi. Modern Infrastructure as Code.
Pulumi. Modern Infrastructure as Code.
 
Introduction to go, and why it's awesome
Introduction to go, and why it's awesomeIntroduction to go, and why it's awesome
Introduction to go, and why it's awesome
 
KDE Plasma Develop Intro
KDE Plasma Develop IntroKDE Plasma Develop Intro
KDE Plasma Develop Intro
 
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVMHOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
 
Vagrant, Ansible and Docker - How they fit together for productive flexible d...
Vagrant, Ansible and Docker - How they fit together for productive flexible d...Vagrant, Ansible and Docker - How they fit together for productive flexible d...
Vagrant, Ansible and Docker - How they fit together for productive flexible d...
 
Les nouveautés de C# 7
Les nouveautés de C# 7Les nouveautés de C# 7
Les nouveautés de C# 7
 
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
 
From Python to smartphones: neural nets @ Saint-Gobain, François Sausset
From Python to smartphones: neural nets @ Saint-Gobain, François SaussetFrom Python to smartphones: neural nets @ Saint-Gobain, François Sausset
From Python to smartphones: neural nets @ Saint-Gobain, François Sausset
 
Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...
Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...
Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...
 
Ondřej Procházka - Deployment podle Devel.cz
Ondřej Procházka - Deployment podle Devel.czOndřej Procházka - Deployment podle Devel.cz
Ondřej Procházka - Deployment podle Devel.cz
 
Grunt.js
Grunt.jsGrunt.js
Grunt.js
 
Recent c++ goodies (March 2018)
Recent c++ goodies (March 2018)Recent c++ goodies (March 2018)
Recent c++ goodies (March 2018)
 
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with PulumiInfrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
 
Port Scanning with Node.js
Port Scanning with Node.jsPort Scanning with Node.js
Port Scanning with Node.js
 
Modern Perl desktop apps - Cluj.pm March 2014
Modern Perl desktop apps - Cluj.pm March 2014Modern Perl desktop apps - Cluj.pm March 2014
Modern Perl desktop apps - Cluj.pm March 2014
 
Quick Review of Desktop and Native Apps using Javascript
Quick Review of Desktop and Native Apps using JavascriptQuick Review of Desktop and Native Apps using Javascript
Quick Review of Desktop and Native Apps using Javascript
 
AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8
 
What's New in ASP.NET Core 2.0
What's New in ASP.NET Core 2.0What's New in ASP.NET Core 2.0
What's New in ASP.NET Core 2.0
 
関西アンカンファレンス Python の Paver について
関西アンカンファレンス Python の Paver について関西アンカンファレンス Python の Paver について
関西アンカンファレンス Python の Paver について
 
Type script新鮮貨報你知
Type script新鮮貨報你知Type script新鮮貨報你知
Type script新鮮貨報你知
 

Andere mochten auch

Jorge Silva, Sr. Research Statistician Developer, SAS at MLconf ATL - 9/18/15
Jorge Silva, Sr. Research Statistician Developer, SAS at MLconf ATL - 9/18/15Jorge Silva, Sr. Research Statistician Developer, SAS at MLconf ATL - 9/18/15
Jorge Silva, Sr. Research Statistician Developer, SAS at MLconf ATL - 9/18/15MLconf
 
The impact of innovation on travel and tourism industries (World Travel Marke...
The impact of innovation on travel and tourism industries (World Travel Marke...The impact of innovation on travel and tourism industries (World Travel Marke...
The impact of innovation on travel and tourism industries (World Travel Marke...Brian Solis
 
Open Source Creativity
Open Source CreativityOpen Source Creativity
Open Source CreativitySara Cannon
 
Reuters: Pictures of the Year 2016 (Part 2)
Reuters: Pictures of the Year 2016 (Part 2)Reuters: Pictures of the Year 2016 (Part 2)
Reuters: Pictures of the Year 2016 (Part 2)maditabalnco
 
The Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsThe Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsBarry Feldman
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome EconomyHelge Tennø
 

Andere mochten auch (6)

Jorge Silva, Sr. Research Statistician Developer, SAS at MLconf ATL - 9/18/15
Jorge Silva, Sr. Research Statistician Developer, SAS at MLconf ATL - 9/18/15Jorge Silva, Sr. Research Statistician Developer, SAS at MLconf ATL - 9/18/15
Jorge Silva, Sr. Research Statistician Developer, SAS at MLconf ATL - 9/18/15
 
The impact of innovation on travel and tourism industries (World Travel Marke...
The impact of innovation on travel and tourism industries (World Travel Marke...The impact of innovation on travel and tourism industries (World Travel Marke...
The impact of innovation on travel and tourism industries (World Travel Marke...
 
Open Source Creativity
Open Source CreativityOpen Source Creativity
Open Source Creativity
 
Reuters: Pictures of the Year 2016 (Part 2)
Reuters: Pictures of the Year 2016 (Part 2)Reuters: Pictures of the Year 2016 (Part 2)
Reuters: Pictures of the Year 2016 (Part 2)
 
The Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsThe Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post Formats
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome Economy
 

Ähnlich wie How to rewrite the OS using C by strong type

Metasepi team meeting #8': Haskell apps on Android NDK
Metasepi team meeting #8': Haskell apps on Android NDKMetasepi team meeting #8': Haskell apps on Android NDK
Metasepi team meeting #8': Haskell apps on Android NDKKiwamu Okabe
 
Metasepi team meeting #7: Snatch application on tiny OS
Metasepi team meeting #7: Snatch application on tiny OSMetasepi team meeting #7: Snatch application on tiny OS
Metasepi team meeting #7: Snatch application on tiny OSKiwamu Okabe
 
Metasepi team meeting #13: NetBSD driver using Haskell
Metasepi team meeting #13: NetBSD driver using HaskellMetasepi team meeting #13: NetBSD driver using Haskell
Metasepi team meeting #13: NetBSD driver using HaskellKiwamu Okabe
 
Adopting language server for apache camel feedback from a java/Eclipse plugi...
Adopting language server for apache camel  feedback from a java/Eclipse plugi...Adopting language server for apache camel  feedback from a java/Eclipse plugi...
Adopting language server for apache camel feedback from a java/Eclipse plugi...Aurélien Pupier
 
Buildingwebapplicationswith.net
Buildingwebapplicationswith.netBuildingwebapplicationswith.net
Buildingwebapplicationswith.netKolagani Veera
 
Crimson: Ceph for the Age of NVMe and Persistent Memory
Crimson: Ceph for the Age of NVMe and Persistent MemoryCrimson: Ceph for the Age of NVMe and Persistent Memory
Crimson: Ceph for the Age of NVMe and Persistent MemoryScyllaDB
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)Tech in Asia ID
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5David Voyles
 
Build Low-Latency Applications in Rust on ScyllaDB
Build Low-Latency Applications in Rust on ScyllaDBBuild Low-Latency Applications in Rust on ScyllaDB
Build Low-Latency Applications in Rust on ScyllaDBScyllaDB
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVMJung Kim
 
Working with NIM - By Jordan Hrycaj
Working with NIM - By Jordan HrycajWorking with NIM - By Jordan Hrycaj
Working with NIM - By Jordan Hrycajcamsec
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React NativeWaqqas Jabbar
 
Serverless preview environments to the rescue
Serverless preview environments to the rescueServerless preview environments to the rescue
Serverless preview environments to the rescueJoseph Lust
 
Ceph in 2023 and Beyond.pdf
Ceph in 2023 and Beyond.pdfCeph in 2023 and Beyond.pdf
Ceph in 2023 and Beyond.pdfClyso GmbH
 
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farmKernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farmAnne Nicolas
 
Feedback from an eclipse plugin developer to provide support to large set of ...
Feedback from an eclipse plugin developer to provide support to large set of ...Feedback from an eclipse plugin developer to provide support to large set of ...
Feedback from an eclipse plugin developer to provide support to large set of ...Aurélien Pupier
 
PyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applicationsPyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applicationsCesar Cardenas Desales
 

Ähnlich wie How to rewrite the OS using C by strong type (20)

Metasepi team meeting #8': Haskell apps on Android NDK
Metasepi team meeting #8': Haskell apps on Android NDKMetasepi team meeting #8': Haskell apps on Android NDK
Metasepi team meeting #8': Haskell apps on Android NDK
 
Metasepi team meeting #7: Snatch application on tiny OS
Metasepi team meeting #7: Snatch application on tiny OSMetasepi team meeting #7: Snatch application on tiny OS
Metasepi team meeting #7: Snatch application on tiny OS
 
Metasepi team meeting #13: NetBSD driver using Haskell
Metasepi team meeting #13: NetBSD driver using HaskellMetasepi team meeting #13: NetBSD driver using Haskell
Metasepi team meeting #13: NetBSD driver using Haskell
 
Adopting language server for apache camel feedback from a java/Eclipse plugi...
Adopting language server for apache camel  feedback from a java/Eclipse plugi...Adopting language server for apache camel  feedback from a java/Eclipse plugi...
Adopting language server for apache camel feedback from a java/Eclipse plugi...
 
Nodejs
NodejsNodejs
Nodejs
 
Buildingwebapplicationswith.net
Buildingwebapplicationswith.netBuildingwebapplicationswith.net
Buildingwebapplicationswith.net
 
Crimson: Ceph for the Age of NVMe and Persistent Memory
Crimson: Ceph for the Age of NVMe and Persistent MemoryCrimson: Ceph for the Age of NVMe and Persistent Memory
Crimson: Ceph for the Age of NVMe and Persistent Memory
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
 
.Net Core
.Net Core.Net Core
.Net Core
 
Build Low-Latency Applications in Rust on ScyllaDB
Build Low-Latency Applications in Rust on ScyllaDBBuild Low-Latency Applications in Rust on ScyllaDB
Build Low-Latency Applications in Rust on ScyllaDB
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
 
Working with NIM - By Jordan Hrycaj
Working with NIM - By Jordan HrycajWorking with NIM - By Jordan Hrycaj
Working with NIM - By Jordan Hrycaj
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
Serverless preview environments to the rescue
Serverless preview environments to the rescueServerless preview environments to the rescue
Serverless preview environments to the rescue
 
Ceph in 2023 and Beyond.pdf
Ceph in 2023 and Beyond.pdfCeph in 2023 and Beyond.pdf
Ceph in 2023 and Beyond.pdf
 
From NodeJS to Rust
From NodeJS to RustFrom NodeJS to Rust
From NodeJS to Rust
 
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farmKernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
 
Feedback from an eclipse plugin developer to provide support to large set of ...
Feedback from an eclipse plugin developer to provide support to large set of ...Feedback from an eclipse plugin developer to provide support to large set of ...
Feedback from an eclipse plugin developer to provide support to large set of ...
 
PyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applicationsPyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applications
 

Kürzlich hochgeladen

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Kürzlich hochgeladen (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

How to rewrite the OS using C by strong type

  • 1. How to rewrite the OS using C by strong type Metasepi Project / Kiwamu Okabe
  • 2. Who am I? ☆ http://www.masterq.net/ ☆ Organizer of Metasepi Project ☆ A developer of Ajhc Haskell compiler ☆ A Debian Maintainer ☆ 10 years' experience in developing OS using NetBSD
  • 3. Agenda ☆ [1] Problems of OS using C ☆ [2] Type safety ☆ [3] Existing OS using strong type ☆ [4] Snatch-driven development ☆ [5] Demo ☆ [6] Case study of Snatch ☆ [7] Future work
  • 4. [1] Problems of OS using C ☆ Most OS uses C language ☆ C is good for system programming ☆ But C occurs many problems
  • 5. Buffer overrun ☆ Pointer to array doesn't know the length
  • 6. Page fault in kernel ☆ Page fault in user space => SEGV ☆ Page fault in kernel space => Halt!
  • 7. Weak type ☆ Great use of (void *) type ☆ NetBSD kernel uses 45130 times! $ pwd /home/kiwamu/src/netbsd/sys $ grep "void *" `find . -name "*.c"` | wc -l 45130 ☆ No choice but to use weak type for flexibility
  • 8. [2] Type safety ☆ Get less runtime errors
  • 9. Avoid buffer overrun Strong type avoids buffer overrun.
  • 10. Avoid page fault in kernel Only touch the area constructed.
  • 11. Flexibility without weak type ☆ Algebraic data type data Node = Leaf Integer | Branch Node Node ☆ Type class class Functor f where fmap :: (a -> b) -> f a -> f b instance Functor [] where fmap f (x:xs) = f x : fmap f xs fmap f [] = [] instance Functor Maybe where fmap _ Nothing = Nothing fmap f (Just x) = Just (f x) ☆ Type inference
  • 12. Kernel needs strong type ☆ IoT:Internet of Things ☆ Poor hardware, and Rich feature ☆ Many custom requests shower kernel ☆ Strong type is needed by kernel rather than application on user space
  • 13. [3] Existing OS using strong type Alreadly we have. ☆ Funk http://home.gna.org/funk/ ☆ snowflake-os https://code.google.com/p/snowflake-os/ ☆ House http://programatica.cs.pdx.edu/House/ Why isn't it for daily use?
  • 14. Poor design and less functions ☆ Design from scratch ☆ Polling interrupt ☆ Not have bus driver ☆ Support less devices ☆ Only for x86 ☆ Can't run Firefox
  • 16. [4] Snatch-driven development Rewrite kernel using C with strong type by little and little.
  • 17. UNIX like OS needs reentrant
  • 18. Strong type OS uses polling intr
  • 19. Ajhc Haskell compiler Context can run without lock.
  • 20. [5] Demo The proof of the pudding is in the eating.
  • 21. MCU app without OS #1 https://github.com/ajhc/demo-cortex-m3
  • 22. MCU app without OS #2 Memory map
  • 23. MCU app with OS https://github.com/ajhc/demo-cortex-m3
  • 24. [6] Case study of Snatch We found some idioms that are useful to rewrite C language with Haskell.
  • 25. Idiom1: Call function C and Haskell call with each other.
  • 26. Idiom2: Read/Write memory Haskell can read/write memory directly.
  • 27. Idiom3: Read/Write struct Read structs chained with pointer.
  • 28. Idiom4: Foreign Primitives Directly insert the text following const.
  • 29. [7] Future work ☆ Benchmark ☆ Pointer combinator ☆ Share state between contexts ☆ Porting libraries running on GHC ☆ Debug method ☆ Fix many bugs
  • 30. Try to use the other language ☆ ATS http://www.ats-lang.org/ JATS-UG - Japan ATS User Group http://jats-ug.metasepi.org/ ☆ Rust http://www.rust-lang.org/
  • 31. Workshop at Nagoya ☆ Functional MCU programing workshop at Nagoya ☆ Meeting minutes http://metasepi.org/posts/2014-01-05-mbed_fp_0.html