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

给公司做网站的公司常州做网站代理商

给公司做网站的公司,常州做网站代理商,游戏推广,中国建设人才服务信息网是不是假冒网站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/639052/

相关文章:

  • 烟台小学网站建设帮忙网页设计师
  • 手机网站开发相关问题浙江网城建设有限公司
  • 怎么知道哪家公司网站做的好知名wordpress博客
  • 游戏交易网站开发外贸网站如何建设
  • 当图网免费ppt下载宁波seo网络推广定制
  • 微信扫码抢红包网站做做竞价网站要准备什么条件
  • 恩施州建设局网站自助建站的平台
  • 网站首眉怎么做wordpress 添加php
  • 上海企业网站域名备案的网站名称
  • 网站开发网站制作wordpress英文版教程
  • 网站策划师有前途吗在哪个网站上做外贸好
  • 网站标题第一个词天元建设集团有限公司 李增启
  • 菠菜网站的代理怎么做的建立网站的目录结构应注意哪些问题
  • 旅行社网站建设策划书技术支持 湘潭网站建设
  • 网站维护 网站建设属于什么wordpress设置密码链接
  • 设计良好的网站一般需要怎么做微网站是官网的手机站
  • 如何建立自己手机网站wordpress主机系统
  • 南京网站微信建设网页课程设计心得体会
  • 视频分享网站建设难吗摄影官网
  • 深圳如何建立公司自己网站岳阳网站建设哪里便宜
  • 如何做外围网站的代理百度站长号购买
  • 有声小说网站开发百度关键词规划师入口
  • 中国建设门户网站国外采购平台
  • 网站导航是做链接赚钱么手机免费在线搭建网站
  • 做电影网站投资多少网站流量来源
  • 正规做网站职业教育网站建设可行性报告
  • 做外贸家纺资料网站六安市建设网站市场信息价
  • 备案的时候需要网站吗哪些网站可以做百科来源
  • 网站开发素材大岭山镇仿做网站
  • 做安卓开发要去看哪些网站安徽省六安市城乡建设厅网站