Virtualization

The first piece : Virtualization

Process

How to implement an OS idea ?

Cooperation between low-level manchanism(functionality implementation) and high-level policy(decision maker)

Process Interface

  • Creation
  • Destroy
  • Wait
  • Other( read statistics, suspand, … )

Process Status Transitions

Transitions

An orphaned child will adopted by init

When parent is killed, the child will not be automatically killed. It will be adopted by init whose pid is 1.

are-child-processes-created-with-fork-automatically-killed-when-the-parent-is

Hackers ‘hack’ a system via malicious input

In general, a secure system must treat user inputs with great suspicion. Not doing so will undoubtedly lead to easily hacked software, a despairing sense that the world is an unsafe and scary place, and the loss of job security for the all-too-trusting OS developer.

Scheduling

The idea of ‘predicating the future via past’ is also used in OS, but not implemented with neural network

Shortly,we will see how to overcome this problem, by building a scheduler that
uses the recent past to predict the future. This scheduler is known as the multi-level feedback queue

Attack/Game the scheduler

a smart user could rewrite their program to game the scheduler. Gaming the scheduler generally refers to the idea of doing something sneaky to trick the scheduler into giving you more than your fair share of the resource.

Consider the modern datacenter, in which users from around the world share CPUs, memories, networks, and storage systems; without care in policy design and enforcement, a single user may be able to adversely harm others and gain
advantage for itself. Thus, scheduling policy forms an important part of
the security of a system, and should be carefully constructed.

Parameter is always a problem

A few other issues arise with MLFQ scheduling. One big question is
how to parameterize such a scheduler.

There are no easy answers to these questions, and thus only some experience with workloads and subsequent tuning of the scheduler will lead to a satisfactory balance

The reason behind the existence of parameters is schema/model/policy is purposed to solve universal scenario problem, to perfectly apply them to specified problem, parameters must be fine tuned with additional information of specified scenario

If we want to build a omniscient solution, the solution need to learn both the policy itself and the scenario-specified information and carefully combine them together.

Divide something by proportion

One of the most powerful (and basic) mechanisms in the design of lottery
(and stride) scheduling is that of the ticket. The ticket is used to represent
a process’s share of the CPU in these examples, but can be applied much
more broadly.

If you are ever in need of a mechanism to represent a proportion of ownership,
this concept just might be … (wait for it) … the ticket.

Linux scheduler : CFS

modern linux use an simple but advanced scheduler : Complete Fair Scheduler

There are no perfect solution to lots of system design problems, they are all trade-off

I personally think being pragmatic is a
good thing, and pragmatists realize that not all problems have clean and easy
solutions.

XV6 Lab

Know when you should/need to obsess with details

  1. Must of the time you should stick with high level concept/ideas (Idea level)
  2. When you need to make it real and prove the idea works in some extend, conside a small amount of details (Lab level)
  3. When your idea works perfectly in your lab environment, you decide to make it into larget scale production, conside all possible details (Engineering level)

As always, the concept is easy: with operating systems, the devil is always in the details.

Memory

How to build reliable system ?

Isolation is a key principle in building reliable systems. If two entities are properly isolated from one another, this implies that one can fail with- out affecting the other.

What to do if you need to be really fast, caring much about efficiency

You use hardware.

Efficiency dictates that we make use of hardware support, which at first
will be quite rudimentary (e.g., just a few registers) but will grow to be
fairly complex (e.g., TLBs, page-table support, and so forth, as you will
see).

How to solve problems ?

always make sure you understand the problem you are solving before moving onto the solution; indeed, if you understand the problem, you can often derive the solution yourself.

Common innovation : Combination

Whenever you have two reasonable but different approaches to something in life, you should always examine the combination of the two to see if you can obtain the best of both worlds.

When you have two good and seemingly opposing ideas, you should always see if you can combine them into a hybrid that manages to achieve the best of both worlds. Hybrid corn species, for example, are known to be more robust than any naturally-occurring species.

**But also beware that : **

Of course, not all hybrids are a good idea;