Introducing Cache Pseudo-Locking to reduce memory access latency
继续阅读Introducing Cache Pseudo-Locking to reduce memory access latency
Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的操作系统。它能运行主要的UNIX工具软件、应用程序和网络协议。它支持32位和64位硬件。Linux继承了Unix以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。它主要用于基于Intel x86系列CPU的计算机上。这个系统是由全世界各地的成千上万的程序员设计和实现的。其目的是建立不受任何商品化软件的版权制约的、全世界都能自由使用的Unix兼容产品。
Introducing Cache Pseudo-Locking to reduce memory access latency
继续阅读Introducing Cache Pseudo-Locking to reduce memory access latency
一直使用VirtualBox安装的Debian环境编译WD MyCloud的代码。但是最近VirtualBox升级后,升级增强功能,然后共享粘贴板就不能使用了。
如果执行
|
1 |
$ VBoxClient --clipboard |
|
1 |
VBoxClient: Failed to connect to the VirtualBox kernel service, rc=VERR_FILE_NOT_FOUND |
在使用SSH客户端进行连接管理的时候如果长时间不输入命令, 服务器会自动断开连接, 尤其是有的人使用SSH作为代理连接这样的情况更是突出, 因此我在网上搜集了可以让 SSH 保持连接的方法与大家分享
通过修改 sshd 的配置文件,能够让 SSH Server 发送“心跳”信号来维持持续连接,下面是设置的内容
打开服务器 /etc/ssh/sshd_config,我在最后增加一行
|
1 2 3 |
ClientAliveInterval 60 ClientAliveCountMax 1 |
这 样,SSH Server 每 60 秒就会自动发送一个信号给 Client,而等待 Client 回应,(注意:是服务器发心跳信号,不是客户端,这个有别于一些 FTP Client 发送的 KeepAlives 信号哦~~~),如果客户端没有回应,会记录下来直到记录数超过 ClientAliveCountMax 的值时,才会断开连接。
只要在/etc/ssh/ssh_config文件里加两个参数就行了
|
1 2 3 |
TCPKeepAlive yes ServerAliveInterval 300 |
前一个参数是说要保持连接,后一个参数表示每过5分钟发一个数据包到服务器表示“我还活着”
如果你没有root权限,修改或者创建~/.ssh/ssh_config也是可以的
在这种方法中, 如果你只想针对某一个ssh连接进行持续, 你可以将上述配置文件复制一下进行修改然后在连接的时候使用 -F参数进行配置文件的指定。 当然因为只需要修改两个参数, 你也可以直接在连接命令中进行设定即:
|
1 |
$ ssh -o TCPKeepAlive=yes -o ServerAliveInterval=300 xx@xx.com -p xxxx |
usbip的目的是为了开发一个在局域网内共享的USB设备,也就是说你可以直接访问局域网内其他计算机的USB设备。
下面我们看一下如何在ubuntu 16.04跟树莓派(raspberry pi)以及树莓派之间实现USB设备在局域网的共享。
树莓派端配置为服务端,我们把USB设备接入到树莓派上,服务端的树莓派上执行如下操作:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 升级内核以及附属驱动模块 $ sudo rpi-update $ sudo apt-get install usbip # 加载驱动模块 $ sudo modprobe usbip-core $ sudo modprobe vhci-hcd $ sudo modprobe usbip_host # 打开监听服务接收来自其他机器的请求 $ sudo usbipd -D # 列出本机的USB设备列表 $ sudo usbip list -l # 通知底层驱动,绑定设备,远端可看到我们绑定过的设备,我们的设备ID为1-1.3 $ sudo usbip --debug bind -b 1-1.3 |
客户端的树莓派或者ubuntu 16.04,执行如下操作查看以及操作服务端的设备。
树莓派
|
1 2 3 4 5 6 7 8 |
$ sudo apt-get install usbip # 'sudo usbip version' usbip (usbip-utils 2.0) raspberry pi # 服务器IP地址 192.168.1.201 ,列出服务端的设备列表 $ sudo usbip list -r 192.168.1.201 --debug # 服务器IP地址 192.168.1.201 ,设备ID 1-1.3 $ sudo usbip attach -r 192.168.1.201 -b 1-1.3 |
ubuntu 16.04
|
1 2 3 4 5 6 7 8 |
$ sudo apt-get install linux-tools-`uname -r` # 'sudo /usr/lib/linux-tools/`uname -r`/usbip version' usbip (usbip-utils 2.0) raspberry pi # 服务器IP地址 192.168.1.201 ,列出服务端的设备列表 $ sudo /usr/lib/linux-tools/`uname -r`/usbip list -r 192.168.1.201 --debug # 服务器IP地址 192.168.1.201 ,设备ID 1-1.3 $ sudo /usr/lib/linux-tools/`uname -r`/usbip attach -r 192.168.1.201 -b 1-1.3 |
如果出错信息如下:
|
1 2 3 4 5 |
pi@raspberrypi:~ $ sudo usbip port usbip: error: failed to open /usr/share/hwdata//usb.ids libusbip: error: udev_device_new_from_subsystem_sysname failed usbip: error: open vhci_driver usbip: error: list imported devices |
出错的原因为内核驱动没有正确加载,解决方法为:
|
1 2 3 4 |
# 加载驱动模块 $ sudo modprobe usbip-core $ sudo modprobe vhci-hcd |
如果出错信息如下(比如ubuntu 16.04):
|
1 2 3 4 5 6 7 8 |
$ sudo usbip --list 192.168.1.201 --debug usbip dbg: usbip_network.c: 221 (tcp_connect ) trying 192.168.1.201 port 3240 usbip dbg: usbip_network.c: 241 (tcp_connect ) connected to 192.168.1.201:3240 - 192.168.1.201 usbip err: usbip_network.c: 119 (usbip_recv_op_common) recv op_common, -1 usbip err: vhci_attach.c: 202 (query_exported_devices) recv op_common usbip err: vhci_attach.c: 417 (show_exported_devices) query |
此时查看软件版本,可以看到如下:
|
1 2 |
$ sudo usbip -v usbip 0.1.7 ($Id: vhci_attach.c 42 2007-09-07 12:07:51Z hirofuchi $) |
这个原因是由于软件安装的是很早的一个版本,无法跟现在最新的版本进行通信。
这个驱动很早就以及整合进入了Linux内核,控制软件也是内核提供。使用如下命令安装跟当前内核匹配的版本:
|
1 2 3 |
$ sudo apt-get install linux-tools-`uname -r` $ sudo /usr/lib/linux-tools/`uname -r`/usbip list -r 192.168.1.201 --debug |
如果出错信息如下:
|
1 2 3 4 5 |
$ sudo usbip --debug bind -b 1-1.3 usbip: debug: usbip.c:141:[run_command] running command: `bind' usbip: debug: sysfs_utils.c:18:[write_sysfs_attribute] error opening attribute /sys/bus/usb/drivers/usbip-host/match_busid usbip: debug: utils.c:50:[modify_match_busid] failed to write match_busid: No such file or directory usbip: error: unable to bind device on 1-1.3 |
原因为usbip_host.ko这个内核驱动没有加载,使用如下命令加载驱动:
|
1 |
$ sudo modprobe usbip_host |
|
1 2 3 4 5 6 7 8 9 10 11 |
$ git clone https://github.com/google/binnavi.git $ sudo apt-get install openjdk-8-jdk $ sudo apt-get install maven $ mvn dependency:copy-dependencies $ ant build-binnavi-fat-jar $ java -jar target/binnavi-all.jar |
如果代码下载存在困难,可以本站下载一份拷贝。 点击此处下载 binnavi
1)需使用Ctrl+a 进入设置状态
2)按z进入设置菜单
(1)S键:发送文件到目标系统中;
(2)W键:自动卷屏。当显示的内容超过一行之後,自动将後面的内容换行。这个功能在查看内核的啓动信息时很有用。
(3)C键:清除屏幕的显示内容;
(4)B键:浏览minicom的历史显示;
(5)X键:退出mInicom,会提示确认退出。
使用minicom也有很长时间了,只用minicom抓过uart log,但是从来没有去保存过这个log,也不知道有这个功能。后来在超级终端中发现有这个功能(传送->捕获文字),想想minicom应该也有这个功能才对,后来搜索找到怎么用了,方法如下:
通过配置hosts.allow、hosts.deny,控制SSH限制固定IP登陆
按照以往的方法,分别在hosts.allow、hosts.deny加入以下配置
|
1 2 3 4 5 6 7 |
# more /etc/hosts.allow sshd:192.168.x.x # more /etc/hosts.deny sshd:all |
保存后测试,发现配置无效,其他IP还是可以登陆成功。
解决方法如下:
hosts.allow和hosts.deny属于tcp_Wrappers防火墙的配置文件,而用tcp_Wrappers防火墙控制某一服务访问策略的前提是,该服务支持tcp_Wrappers防火墙,即该服务应用了libwrapped库文件。
查看某服务(如ssh)是否应用了libwrapped库文件的方法是:
|
1 |
$ ldd /usr/sbin/sshd |grep libwrap.so.0 |
没有显示,表示此服务器上安装的SSH没有应用libwrapped库文件,也就不能用tcp_Wrappers防火墙控制访问策略。(一般情况下服务器默认安装的SSH都是支持libwrapped库文件,这台服务器不清楚为什么不支持)
最终解决方法是重新安装SSH。
|
1 2 3 4 5 |
$ yum -y remove openssh $ yum -y install openssh $ yum -y install openssh-server |
安装完成后再次查看是否应用了libwrapped库文件,显示支持。
|
1 2 |
$ ldd /usr/sbin/sshd |grep libwrap.so.0 libwrap.so.0 => /lib/x86_64-linux-gnu/libwrap.so.0 (0x00007f195feb4000) |
再测试SSH登陆,配置生效。
参照 ubuntu 16.04防止SSH暴力登录攻击 安装denyhosts之后,由于某些莫名的操作导致自己的一个登录地址被加入了阻止列表,尝试很多次之后,都没有办法恢复。于是找到如下脚本来进行删除操作:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#!/bin/bash IP=$1 if [ -n "$IP" ];then if [[ $IP =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]];then service denyhosts stop sed -i "/$IP/d" /etc/hosts.deny sed -i "/$IP/d" /var/lib/denyhosts/hosts-valid sed -i "/$IP/d" /var/lib/denyhosts/users-hosts sed -i "/$IP/d" /var/lib/denyhosts/hosts sed -i "/$IP/d" /var/lib/denyhosts/hosts-root sed -i "/$IP/d" /var/lib/denyhosts/hosts-restricted iptables -D INPUT -s $IP -j DROP echo $IP remove from Denyhosts service denyhosts start else echo "This is not IP" fi else echo "IP is empty" fi |
生成脚本后,如下方式执行:
|
1 |
$ sudo bash denyhosts_unban.sh 42.120.74.106 |
| Data model | short (integer) | int | long (integer) | long long | pointers, size_t |
Sample operating systems |
|---|---|---|---|---|---|---|
| SILP64 | 64 | 64 | 64 | 64 | 64 | Classic UNICOS[41] (versus UNICOS/mp, etc.) |
| ILP64 | 16 | 64 | 64 | 64 | 64 | HAL Computer Systems port of Solaris to the SPARC64 |
| LLP64, IL32P64 |
16 | 32 | 32 | 64 | 64 | Microsoft Windows (x86-64 and IA-64) using Visual C++; and MinGW |
| LP64, I32LP64 |
16 | 32 | 64 | 64 | 64 | Most Unix and Unix-like systems, e.g., Solaris, Linux, BSD, macOS. Windows when using Cygwin; z/OS |
32位和64位系统区别及int字节数
64-Bit Programming Models: Why LP64?
64-bit computing
What decides the sizeof an integer?