随笔分类 -  CPP

摘要:malloc,free详解Both brk() and mmap() cause pages to be mapped into the process's address space. mmap() can be used to map pages of a file into memory, but it can also be used only to map pages, i.e., allocate memory. brk() is just a specific interface to the VM subsystem which maps pages at a spec 阅读全文
posted @ 2013-05-27 20:41 tangr206 阅读(441) 评论(0) 推荐(0)
摘要:这几天看了不少资料,这里做一个简单的总结归纳:几个不错的网站:https://computing.llnl.gov/tutorials/pthreads/http://cpp.ezbty.org/content/doc_list/libevent_%E4%BD%BF%E7%94%A8%E4%B8%8E%E6%BA%90%E7%A0%81%E5%89%96%E6%9E%90http://www.kerneltravel.net/journal/iv/syscall.htm 线程的三个主要同步原语:互斥锁,信号量和条件变量,一下简称mutex,sem,cond。 其中mutex和sem都是对应f. 阅读全文
posted @ 2013-05-25 18:51 tangr206 阅读(1089) 评论(0) 推荐(0)
摘要:http://leetcode.com/onlinejudge#question_1 1 class Solution { 2 public: 3 vector<int> twoSum(vector<int> &numbers, int target) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 7 vector<int> result; 8 map<int, int> myma... 阅读全文
posted @ 2013-05-23 17:47 tangr206 阅读(198) 评论(0) 推荐(0)
摘要:连接5.5 Stopping and Starting Multi-thread Programsgdbsupports debugging programs with multiple threads (seeDebugging Programs with Multiple Threads). There are two modes of controlling execution of your program within the debugger. In the default mode, referred to asall-stop mode, when any thread in 阅读全文
posted @ 2013-05-06 10:56 tangr206 阅读(252) 评论(0) 推荐(0)