Implementation of Epoll

There are many articles about the usage and/or implementation of epoll on the web now. However, I think that some straightforward summary I want and some details that I am interested in are still missing. So I write this post. note based on the source code of Linux Kernel v4.16 suppose that readers know about the usage of epoll. prerequisite poll() operation of file A file operation, poll(), is needed for the implementation of select/poll/epoll.

Building a heap

Given an array with n elements, there are two ways to build a heap on it: Top-down Bottom-up The top-down approach The first way is quite straightforward. We just do n insertions. def build_heap_in_place(l): for i in range(len(l)): sift_up(l, i) The part in [0, i) is the heap we have built so far. l[i] is the new element inserted. This approach runs in O(n*log(n)) time.

About this blog

hugo https://gohugo.io/getting-started/quick-start/ ox-hugo https://github.com/kaushalmodi/ox-hugo

try_hugo, file as post

hello, org-mode in hugo Name Desc org-mode markdown-like hugo Jekyll-like DONE image code cpp class Solution { public: int coinChange(vector<int>& coins, int amount) { int res = INT_MAX; sort(coins.begin(), coins.end()); vector<unordered_map<int, int>> record(coins.size()); dfs(record, res, coins, amount, coins.size() - 1, 0); return res == INT_MAX? -1: res; } void dfs(vector<unordered_map<int, int>> &record, int& res, vector<int>& coins, int target, int idx, int count) { // cout << "idx:" << idx << " target:" << target // << " count" << count << endl; if (idx < 0) return; if(record[idx].

2

22222 This is changed, too.