当前位置: 首页 > news >正文

宁波网站开发制作成都建设网站首页

宁波网站开发制作,成都建设网站首页,网络seo优化推广,做网站需要准备什么东西1 POSIX pthread_create原理 1)fork()、pthread_create()、vfork()对应的系统调用分别是sys_fork()、sys_clone()、sys_vfork(),它们在内核中都是通过do_fork()实现的。 2)系统中所有的进程都组织在init_task.tasks链表下面,每个进…

1 POSIX pthread_create原理
1)fork()、pthread_create()、vfork()对应的系统调用分别是sys_fork()、sys_clone()、sys_vfork(),它们在内核中都是通过do_fork()实现的。
2)系统中所有的进程都组织在init_task.tasks链表下面,每个进程的线程组织在每个进程task_sturct->signal的链表下。参考函数for_each_process()和for_each_process_thread()。
3)根据上述分析,Linux用户态和内核线程都由task_struct结构体描述,是一个轻量级的进程,因此内核中current变量可以表示进程、用户态线程和内核线程。

2 RTLinux
2.1 prio和rt_priority的区别
- 实时进程的优先级(rt_priority)数字越大则优先级越高,99最高,0最低;而普通进程正好相反,优先级(static_prio)数字越大则优先级越低,100最高,139最低(对应nice值-20 ~ 19)
- 内核调度是按照task_struct中的prio来调度的,prio的值越小,优先级就越高。实时线程的rt_priority转换成prio:prio = MAX_RT_PRIO - 1 - p->rt_priority;普通线程的static_prio转换成prio:prio = static_prio = MAX_RT_PRIO + nice + 20
- 进程创建时的默认优先级是120,对应的nice值为0

2.2 priority inheritance
in kernel/locking/rtmutex.c
rt_mutex_adjust_prio() - 适用于优先级值小于100的实时任务

in kernel/sched/core.c
rt_mutex_setprio()

2.3 中断线程化
in kernel/irq/manage.c
setup_irq()

2.4 URLs
https://wiki.linuxfoundation.org/realtime/start
https://rt.wiki.kernel.org/index.php/Frequently_Asked_Questions

3 cgroup
3.1 子系统
cat /proc/cgroups
cat /proc/[pid]/cgroup

3.2 cgroup文件系统
Linux挂载路径:/sys/fs/cgroup/
Android挂载路径:/dev/

4 namespace
4.1 命名空间
clone()
CLONE_NEWNS:Linux第一个引入的namespace,没有想到后面会引入其它的namespace,所以没有叫CLONE_NEWMOUNT
CLONE_NEWPID:进程
CLONE_NEWNET:网络,call copy_net_ns()
CLONE_NEWIPC:IPC通信
CLONE_MEWUTS:UNIX Time-sharing System,主机名和域名
CLONE_NEWUSER:用户和用户组

4.2 每个进程的mount信息
/proc/{pid}/mounts
/proc/{pid}/mountinfo
/proc/{pid}/mountstats
/proc/{pid}/ns/mnt

4.3 netns showcase
external/iproute2/
change /var/run/netns to /mnt/netns

ip netns add ns1
# move eth0 to ns1 namespace
ip link set eth0 netns ns1
# ip netns exec ns1 <command>
ip netns exec ns1 ip link set lo up
ip netns exec ns1 ifconfig eth0 192.168.0.10/24 up
ip netns exec ns1 ip route add default gw 192.168.0.1
# bind process to ns1
ip netns exec ns1 </path/to/cmd>

# back to root namespace, 1 means root namespace
ip netns exec ns1 ip link set eth0 netns 1
ip netns delete ns1
ifconfig eth0 192.168.0.10/24 up

5 LXC使用
5.1 source
https://github.com/lxc

5.2 systemd配置文件
/lib/systemd/system/
systemctl list-unit-files | grep enable

xxx.service path
systemctl list-unit-files | grep xxx
systemctl cat xxx.service

5.3 常用命令
lxc-ls
lxc-info -n <container_name>
lxc-checkconfig
lxc-attach -n <container_name>
lxc-start -n <container_name>

显示container init的PID。
lxc-info -H -p -n <container_name> -P <PATH>

lxc-start启动失败时,分析输出log文件:--logfile <file_name>。
退出container shell命令:exit

5.4 容器网络
容器的vethN虚拟网卡被桥接到lxcbr0上。

5.5 passthrough
lxc.cgroup.devices.allow = type major:minor access
lxc.cgroup.devices.allow = b 254:2 rwm  # 其中m表示mknod。

查看可以access到的设备:
/sys/fs/cgroup/devices/devices.list

5.6 Linux container aarch64 adb
1) adb-arm
https://github.com/bonnyfone/adb-arm

2) /lib64/libcrypto.so.1.1
wget <URL>
rpm2cpio xxx.rpm | cpio -idmv

libcrypto.so.1.1 is OpenSSL library.

6 LXC网络
6.1 基本概念
一个物理网络设备最多存在在一个network namespace中。

net/core/net_namespace.c
网络命名空间定义了2个链表:pernet_list和net_namespace_list。
net/core/dev.c
alloc_netdev_mqs()
{
    [...]
    // point to the default net namespace
    dev_net_set(dev, &init_net);
    [...]
}

6.2 静态物理网络配置
LXC的host要将eth0分配给container OS,必须在host中先将以太网驱动模块insmod,之后再调用lxc-start启动Container OS,否则启动失败。

systemctl status systemd-modules-load
depmod

/opt/<container_name>/config

# LXC 2.1后使用如下的网络配置语句。
lxc.net.1.type = phys
lxc.net.1.link = eth0

6.3 动态物理网络配置
1) src/lxc/tools/lxc_device.c
call netlink IFLA_NET_NS_PID.

2) Moves eth0 from the host as eth1 in <conatiner_name>.
lxc-device -n <conatiner_name> add eth0 eth1

host和container端ifname不一样:
ifconfig eth1 192.168.0.5/24 up

host和container端ifname一样:
ip addr add 192.168.0.5/24 dev eth0

3) Moves eth1 from <conatiner_name> as eth0 in the host.
lxc-device -n <conatiner_name> del eth1 eth0

6.4 udev自动passthrough
1) /usr/bin/eth_passthrough.sh
#!/bin/sh
/usr/bin/ip link set eth0 netns $(/usr/bin/lxc-info -H -p -n <container_name> -P <PATH>)

2) /etc/udev/rules.d/100-eth_passthrough.rules
# udevadm monitor
# udevadm info -a /sys/class/net/eth0
# udevadm test /sys/class/net/eth0

SUBSYSTEM!="net", GOTO="eth_pt_end"
ACTION!="add", GOTO="eth_pt_end"
KERNEL!="eth0", GOTO="eth_pt_end"

#RUN+="/bin/sh -c '/usr/bin/lxc-device -n <container_name> -P <PATH> add eth0 eth0'"
RUN+="/usr/bin/eth_passthrough.sh"

LABEL="eth_pt_end"

3) start udevd with debug mode
udevd --debug --daemon

7 Abbreviations
cgroup:Control Group
LXC:Linux Container
MT8666:车载后装,由MT6735改进而来;前装一般使用MT2712
pi_waiters:priority inheritance,优先级继承

http://www.yayakq.cn/news/185837/

相关文章:

  • 上海企业网站建设费用平面设计素材网站排名
  • 魔立方 网站建设会员卡营销策划方案
  • 建设公寓租房信息网站wordpress怎么搜索代码
  • app与网站数据交互顺企网企业查询
  • 网站实名审核中心社区微网站建设方案ppt模板
  • 网页制作与网站设计部门网站建设工作总结
  • 优购物官方网站地址政务信息网站建设制度
  • 网站推广目标企业策划案例
  • 网站外链建设策略做数学题好的网站
  • 太原网站建设鸣蝉在平台企业网站推广怎么做
  • 网站优化师新的数据新闻
  • 免费网站建设源码网站开发费用摊销吗
  • 织梦网站做中英文双语言版本辽宁网站建设多少钱
  • 安阳网站建设哪家公司好网站备案协议书
  • 互联网 网站设计星巴克网络营销方式
  • 南京网站设计哪家公司好做网站可以自由职业吗
  • 做怎样的网站能赚钱搜索网站排名优化
  • 公司建网站会计分录上海网站建设要多少钱
  • 禹城市建设局网站网站设计 扁平化
  • 有什么图片做视频的网站吗wordpress下划线 代码
  • 公司网站制作天强科技青岛网页建设
  • 做360手机网站快速排网页游戏排行榜梦幻西游
  • 图片分享网站建设wordpress插件怎么安
  • 试玩网站建设制作加强财政门户网站建设工作
  • 精品课网站制作四川平台网站建设方案
  • 一个主机建多少个网站响应式网站建设平台
  • 福州网站制作网站网上商城开题报告
  • 网站推广工做计划范本最近十大新闻
  • 让别人做网站需要提供什么平面网页设计培训教程
  • 一个人做网站时间wordpress 下载