原创 TCP的三路握手和四路揮手及其臨界條件(結合系統調用)

一、TCP的三路握手: 其實這張圖已經說得很清楚了,客戶端應用程序調用connect導致TCP發送一個SYN報文段,服務器端有一個監聽套接字,該監聽套接字收到SYN後,在待連接套接字 隊列中插入一項,然後發送SYN和對客戶端確認的ACK

原创 C++ && 彙編

C++是一種面向對象的高級語言,但是由於其基於C語言發展而來,因此其內在原理和C語言如出一轍,於是就來看看C++程序翻譯成彙編代碼是啥樣的(在x86 linux環境下,使用g++ 翻譯得到的結果),採用了C++11新標準,因此可以順路看一

原创 linux bash腳本實踐

文件的md5校驗 #/bin/bash genMd5Sum(){ local pid_array=() for file in ./* do md5sum ${file} &

原创 關於python中模塊的環狀引用(circular imports)

從stackoverflow上面copy過來的 1、 Imports are pretty straightforward really. Just remember the following: 'import' and 'fro

原创 C++ STL源碼學習(基本算法篇)

stl_algobase.h ///這個文件中提供到的算法都是在STL容器實現中用到的算法template <class _ForwardIter1, class _ForwardIter2, class _Tp> inline voi

原创 STL源碼學習(vector篇)

#include <concept_checks.h> #include<stl_allocate.h> /// The vector base class's constructor and destructor allocate /

原创 C++ STL源碼學習(仿函數篇)

stl_function.h ///仿函數的實現並不複雜 template <class _Arg, class _Result> struct unary_function { typedef _Arg argument

原创 C++STL源碼學習(之slist篇)

///stl_slist.h ///list爲雙向循環鏈表,slist爲單向鏈表,某些操作效率更高 ///slist是SGI額外提供的單向鏈表,不屬於C++標準 struct _Slist_node_base { _Slist_no