The FLK project My first idea was to write a L4 kernel using the - - PowerPoint PPT Presentation

the flk project my first idea was to write a l4 kernel
SMART_READER_LITE
LIVE PREVIEW

The FLK project My first idea was to write a L4 kernel using the - - PowerPoint PPT Presentation

The FLK project My first idea was to write a L4 kernel using the EIFFEL langage. But ... 2 Feb 2015 http://flhq.org 2 While reading references on the SECURITY topic, it became evident that handling security by the software was an


slide-1
SLIDE 1

The FLK project

slide-2
SLIDE 2

2 Feb 2015 http://flhq.org 2

My first idea was to write a L4 kernel using the EIFFEL langage. But ...

slide-3
SLIDE 3

2 Feb 2015 http://flhq.org 3

① While reading references on the SECURITY

topic, it became evident that handling security by the software was an interesting challenge.

slide-4
SLIDE 4

2 Feb 2015 http://flhq.org 4

② It is difficult to find examples of secure kernel

using the FLAT memory model (for processors without MMU – MMUs drain current –). That shows that there is an interesting challenge.

slide-5
SLIDE 5

2 Feb 2015 http://flhq.org 5

③ The thread/process model does not fit the

SCOOP model because of the costs :

  • in MEMORY (for stacks)
  • in TIME (for context switches)
slide-6
SLIDE 6

2 Feb 2015 http://flhq.org 6

S imple C oncurrent O bject O riented P rogramming

An overview...

slide-7
SLIDE 7

2 Feb 2015 http://flhq.org 7

Few terminology

  • A processor is a set of objects within a same

memory manager and with the guaranty that methods of the objects are executed “as single threaded”

  • Objects of a processor can invoke object of
  • ther processors, such “remote” objects are

called separate objects, they belong in a separate processor

slide-8
SLIDE 8

2 Feb 2015 http://flhq.org 8

  • - DO YOU KNOW EIFFEL LANGUAGE ?
  • - this is a simple FIFO description

deferred class FIFO[X] feature empty: BOOLEAN deferred end full: BOOLEAN deferred end put(x: X) require not full deferred ensure not empty end item: X require not empty deferred end drop require not empty deferred ensure not full end invariant at_least_one_element: not (empty and full) end

slide-9
SLIDE 9

2 Feb 2015 http://flhq.org 9

  • - this is an abstract of a simple client

class CLIENT ...

  • rder_task(q: separate FIFO[separate TASK]; t: separate TASK)

require not q.full do q.put(t) end ... end

  • - this is an abstract of a simple server

class SERVER ... next_task(q: separate FIFO[separate TASK]): separate TASK require not q.empty do Result := q.item ; q.drop end ... end

slide-10
SLIDE 10

2 Feb 2015 http://flhq.org 10

Client Client Client SERVER FIFO Using POSIX system, this is often made using UDS (unix domain socket) Having a process/thread for such a small processor is NOT WANTED But SCOOP tends to favor such small processors

slide-11
SLIDE 11

2 Feb 2015 http://flhq.org 11

FLK principle

  • Processors are nor processes neither threads
  • Processors gain their single execution context on

need and release it when not more need

  • When invoking a separate object:

– Either, the current execution context is lent to the called

processor in case of query (having a result)

– Or, a new execution context is created in case of

command (not having result)

  • Optimizations can modify the previous rule
slide-12
SLIDE 12

2 Feb 2015 http://flhq.org 12

In red, the execution contexts In blue, the processors

Summary

This call waits

slide-13
SLIDE 13

2 Feb 2015 http://flhq.org 13

A failure case

slide-14
SLIDE 14

2 Feb 2015 http://flhq.org 14

Acquiring many processors

exchg(a, b: separate C) local x: X do x := a.item ; a.put(b.item) ; b.put(x) ensure a.item = old b.item ; b.item = old a.item end

  • The acquiring of multiple processors is granted by the

system and the compiler in a safe way

  • An implementation compatible with distributed system

(Rhee lock) can be used if needed

slide-15
SLIDE 15

2 Feb 2015 http://flhq.org 15

Safety

  • EIFFEL language is safe:

– No peek / poke – Array boundaries are checked – Calling void reference is not possible – Wrong casting of objects is not possible – The memory is managed (GC, no “free”)

  • SCOOP is safe:

– Separate objects are tracked and not alterable

  • No IPC, no IDL: consistency by the compiler
slide-16
SLIDE 16

2 Feb 2015 http://flhq.org 16

feature {UNSAFE_KERNEL} ... some unsafe features only for FLK ... feature {UNSAFE_SYSTEM} ... some restricted features only for system components ...

Wait a minute.... FLK is written using EIFFEL thus how is it possible if the language doesn't allow peek/poke/casting?

EIFFEL provides selective exportation of features. This mechanism is enforced by the language and the compiler is improved to forbid inheritance of critical classes either outside of a cluster of classes or without integrator authorization The compiler allow in fact peek/poke/casting but in a VERY RESTRICTED way

slide-17
SLIDE 17

2 Feb 2015 http://flhq.org 17

Security at API level

  • Using the exportation feature of EIFFEL and the

compiler FLC:

– Features are selectively exported to specific client

classes

– Such authorized client classes can be:

  • not inheritable and not insertable outside a given context
  • Inheritable (or insertable) with integrator/user

authorisation (when compiling or installing)

  • Inheritable or insertable as usual
slide-18
SLIDE 18

2 Feb 2015 http://flhq.org 18

FLK System Compiler UNSAFE DANGEROUS SAFE Compiler library Application library applications

Kind of simplified

  • verview
slide-19
SLIDE 19

2 Feb 2015 http://flhq.org 19

MEMORY

  • The memory is managed. That is in the language

and it is done at the kernel level.

  • Each processor has its memory manager
  • Any pointer maps to a unique memory manager

that maps to a unique processor: that is used to identify the processor of the separate objects

  • Mechanic of the keyword separate and safety of

the language allows to not protect memory using MMU

slide-20
SLIDE 20

2 Feb 2015 http://flhq.org 20

MMU?

  • Using static analysis of code, the size need by the stack

can be pre-computed for each processor entry method (recursivity...) thus MMU is not strictly needed for stacks

  • But MMU can be useful for:

– STACK – FILE MAPPING – LARGE DYNAMIC ARRAYS – FOREIGN LIBRARIES

  • If used, MMU is global (not per processor)
slide-21
SLIDE 21

2 Feb 2015 http://flhq.org 21

Context switch

When a method of a separate object is called, the execution context should:

– On a query:

  • Set the current processor to the one called, this activates its memory

manager

  • Revert at end of the call
  • No task switch

– On a command:

  • Activate a new execution context for the called processor
  • Can be optimised

– No memory switch (MMU)

slide-22
SLIDE 22

2 Feb 2015 http://flhq.org 22

Life cycle

  • Processors are created using the create

keyword

  • Processors die when

– It is not in an execution context – It has no client (no other processor reference it)

  • Processors are GARBAGE COLLECTED
  • Starve conditions are detected and generate

exceptions

slide-23
SLIDE 23

Feb 2, 2015 http://flhq.org 23

Client Client Client SERVER FIFO Execution context FIFO has 4 clients FIFO is alive

slide-24
SLIDE 24

Feb 2, 2015 http://flhq.org 24

SERVER FIFO Execution context FIFO has 1 client FIFO is alive AFTER CLIENTS DEATH Alive because execution context But waiting on require not fifo.empty FLK SENDS AN EXCEPTION TO THE SERVER TO SIGNAL THAT ITS WAITING IS UNUSEFUL Where FIFO has only one client Thus, server is dead because FIFO can't change

slide-25
SLIDE 25

Feb 2, 2015 http://flhq.org 25

Optimisation

  • EIFFEL is making compilation of whole systems

(no linking is needed)

  • Frozen keyword allows more optimisation
  • Some creation of execution contexts can be

removed

  • Unused components are removed from the

binary set

slide-26
SLIDE 26

Feb 2, 2015 http://flhq.org 26

Challenge 1: coupling of the memory management using compacting GC at kernel, system and application level Challenge 2: improved security at API level without using capabilities (static) Challenge 3: optimisation of activations, avoid creating a new context when possible (using frozen) Challenge 4: allowing downsizing for tiny embedded environments Challenge 5: create standard on semantic of separate and implements some of its tricky items Challenge 6: avoid linker paradigm Challenge 7: prove the safety, the security, the efficiency

slide-27
SLIDE 27

Feb 2, 2015 http://flhq.org 27

BACK TO the ReaL

iTY

How many drivers? How many supported platforms? How many code reusable? How much money? How many people?

slide-28
SLIDE 28

Feb 2, 2015 http://flhq.org 28

planning

  • Finish the compiler end of 2015, opening code

ASAP

  • RFCs process for FLK starting in spirng 2015
  • First implementation of FLK on top of an other

kernel in 2016

  • Help wanted? YES YES YES

– Coding, specifying, financing, research, students,

how to integrate existing C drivers

slide-29
SLIDE 29

Feb 2, 2015 http://flhq.org 29

QUESTIONS

sopox@flhq.org