LXC,cgroups和namespace简介

LXC is a userspace interface for the Linux kernel containment features. Through a powerful API and simple tools, it lets Linux users easily create and manage system or application containers.

The linux containers, lxc, aims to use these new functionalities to provide a userspace container object which provides full resource isolation and resource control for an application or a system.

Linux container技术的目标是为应用程序或系统提供完整的资源隔离和控制。LXC项目通过提供一组API接口和工具,可以让其他程序方便地使用Linux container技术。

The container technology is actively being pushed into the mainstream linux kernel. It provides the resource management through the control groups aka process containers and resource isolation through the namespaces.

Linux container技术cgroups(control groups)namespaces实现。两者的功能如下:

cgroups = limits how much you can use;
namespaces = limits what you can see (and therefore use)

Cgroups限制了你能够拥有的资源,而namespces限制了你能够看到的资源。

参考资料:
LXC
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic

 

C++要点笔记(22)——多态(Polymorphism)

下面是对Polymorphism的解释:

Polymorphism means “many forms”. It is where one type of thing comes in many forms. So you can treat it according to its type, but it will behave differently according to which form of that type it happens to be.

Polymorphism含义为一个类型有多种形式:这些形式虽属于同一类型,但是具体的行为不同。

Polymorphism stems from inheritance. The whole idea is that you have a general base class and more specific derived classes. You can then write code that works with the base class… and polymorphims makes your code not only work with the base class, but all derived classes.

Polymorphism源于继承,它可以让代码对基类和衍生类都能工作。

One of the features of derived classes is that a pointer to a derived class is type-compatible with a pointer to its base class. Polymorphism takes advantage of this feature.

Polymorphism利用了衍生类的指针与基类指针兼容的特性。

A class that declares or inherits a virtual function is called a polymorphic class.

Polymorphism class是定义或继承了virtual functionclass

Pure virtual function定义:

virtual void f() = 0;

包含pure virtual function定义的类是abstract class

参考资料:
I don’t understand Polymorphism at all?
C++ polymorphism and abstract base class