Sunday, December 31, 2023

how to build a cpu

Adder

 oscillator

SR latch
Level triggered D-type flip-flop
Edge triggered flip-flop: needed for accumulator

Sunday, November 5, 2023

QEMU/KVM virtual machines on linux

I'm running Debian linux 12 on macbook pro.


I find the official Debian Wiki is as always very useful:

KVM - Debian Wiki

and also this Youtube video tutorial for beginners:

QEMU/KVM for absolute beginners by Veronica Explains


install needed packages

%sudo apt install --no-install-recommends qemu-system libvirt-clients libvirt-daemon-system

%sudo apt install virtinst #if you want to create guest os on command line instead of gui


Creating a new guest:

virt-install --virt-type kvm --name bullseye-amd64 \
--location http://deb.debian.org/debian/dists/bullseye/main/installer-amd64/ \
--os-variant debian11 \
--disk size=20 --memory 4000 \
--graphics none \
--console pty,target_type=serial \
--extra-args "console=ttyS0"

Connect to a VM through command line

#Use the virsh console command to log in to a running VM called ‘centos7’ type: 
%virsh console centos7 
#To exit a virsh console session, type 
CTRL + Shift + ]



Friday, October 27, 2023

Instaling Debian Linux on Old Macbook Pro

My laptop is an macbook pro retina late 2013. 


#bootable usb stick for ubuntu

https://ubuntu.com/tutorials/create-a-usb-stick-on-macos#1-overview

#install linux on macbook 2012

https://robmcbryde.com/reviving-2012-macbook-pro/

#Official guide to Install Debian on MacBook

https://wiki.debian.org/MacBook#Debian_installation



Some issues i encountered is recorded below:


Before Installation

#repartition Mac disk to make room for Linux is

https://www.makeuseof.com/tag/install-linux-macbook-pro/


During Installation

#no issues


After installation

#rEFInd boot manager


#add apt sources

#ssh

my ssh notes

#linux continue work when lid is closed

Linux setting of lid closed

/etc/systemd/logind.conf and make sure

HandleLidSwitch=ignore

HandleLidSwitchExternalPower=ignore

#wifi issue, the debian official wiki has a solution


bcm43xx - Debian Wiki

#in particular, my wifi nic is BCM4360, have to use the wl vendor driver

wl - Debian Wiki


Final words

the debian linux now works on my macbook pro late 2013. ssh and wifi is working too. now i can remote ssh to the machine, cool!

Saturday, August 19, 2023

TCP/IP Study Notes

 TCP/IP segmentation and fragmentation:

reference link: 【计算机网络】区分tcp分段和ip分片 - JoyoHub

Virtualbox Settings Reference

Networking Settings 

to record issues when setting up different network options for my guest linux virtual machine.


refernce link: 【计算机网络】:一次性理清Virtualbox虚拟机网络模型 - JoyoHub

reference link: https://www.nakivo.com/blog/virtualbox-network-setting-guide/


1. issues when usign Bridged Adapter mode.

cannot get ipv4 address

set to NAT mode first, and get ip address by checking ifconfig

then switch to Bridged Adapter mode, and very importantly, choose the correct NIC (if you are using wifi, choose the wireleass NIC! in my case default is ehterent NIC, and i must change it to my wifi NIC), then check the ip address now using ifconfig. it works for me!


Extension Pack Installation

1. download and install
2. In order for VirtualBox to have access to the USB subsystem, the user running VirtualBox must belong to the vboxuser group. To do this:
% sudo usermod -aG vboxusers <your-username>
Note: if there is no vboxusers group, you need to first add it:
%sudo groupadd vboxusers

Enable USB

1. you need to first add the devices that you want the guest os to access in the hostos virtualbox settings.

Monday, June 26, 2023

Traffic Management



 Rate Limiting

Refer: https://hansliu.com/posts/2020/11/what-is-token-bucket-and-leaky-bucket-algorithms.html

1. Token bucket

  • Rate Limiting: produce rate of token
  • Bucket Sizes: number of token
  • Token Check: if token valid, process data


2. leaky bucket

  • Rate Limiting: consume rate of data
  • Bucket Sizes: number of data

Queueing QoS

WFQ, FQ, WRR


http://what-when-how.com/qos-enabled-networks/queuing-and-scheduling-qos-enabled-networks-part-1/

C Programming

Header Files and Includes https://cplusplus.com/forum/articles/10627/ https://stackoverflow.com/questions/2762568/c-c-include-header-file-or...