この章では並行オブジェクトの correctness と progress を規定する様々な方法を学ぶ。
correctness の3つタイプ
- Quiescent consistency
- 弱い制約。ハイパフォーマンスを必要とするシステムに使える
- Sequential consistency
| #!/bin/bash | |
| # | |
| # Add latency to all outgoing traffic on $DEV on tcp/udp $PORT, | |
| # in the amount of $DELAY. | |
| # | |
| # This is matching on both source port and destination port, which | |
| # may hit you twice if you're accessing a local resource. | |
| # | |
| # To see what's currently in effect, | |
| # tc -s qdisc show dev lo |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| #!/usr/bin/env bash | |
| if [ "$1" == "" ]; then | |
| echo "usage: $0 <docker_id>" | |
| echo "Exposes the netns of a docker container to the host" | |
| exit 1 | |
| fi | |
| ppid=`docker inspect $1 | grep Pid | awk '{print $2 + 0}'` | |
| if [ "$ppid" == "" ]; then | |
| echo "lxc parent pid not found" |
| #!/usr/bin/env bash | |
| VERSION="0.0.1" | |
| set -e | |
| [ -n "$DEBUG" ] && set -x | |
| usage() { | |
| printf " | |
| Usage: $(basename $0) PROJECT_ID |
You might want to read this to get an introduction to armel vs armhf.
If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.
First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux
Docker Storage Drivers を読んでのメモです。
With O_WRONLY or O_RDWR - write access look it up in the top branch;
| #! /usr/bin/env python2.7 | |
| from scapy.all import * | |
| from netfilterqueue import NetfilterQueue | |
| def modify(packet): | |
| pkt = IP(packet.get_payload()) #converts the raw packet to a scapy compatible string | |
| #modify the packet all you want here |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <assert.h> | |
| #include <signal.h> | |
| #include <errno.h> | |
| #include <fcntl.h> | |
| #include <stddef.h> | |
| #include <sys/syscall.h> | |
| #include <sys/types.h> | |
| #include <sys/stat.h> |
pipeworkやweaveを利用せずにコンテナに固定IPを設定するには、docker runで--privilegedオプションを指定し、コンテナ内でIPを設定する方法がある。
$ HOST1=$(docker run --privileged -t -d ubuntu /bin/bash)
$ docker exec $HOST1 ip addr add 192.168.0.10/24 dev eth0
$ HOST2=$(docker run --privileged -t -d ubuntu /bin/bash)
$ docker exec $HOST2 ip addr add 192.168.0.11/24 dev eth0