数据库系统概念书、STL源码剖析
http://mp.weixin.qq.com/s/UMkq_ToJ5Ed8mda2Ku3LPg
独家分享| 深入理解 Linux 的 RCU 机制 http://mp.weixin.qq.com/s/TX3HZZi1GjlFprcxoNgk_w
分享| 共享内存无锁队列的实现 http://mp.weixin.qq.com/s/zaYhl43dkFxO4dL7pCcfkA 干货分享| C++11中的内存模型
/* Code to implement readers/writers that preserves FIFO priority */ | |
#include "csapp.h" | |
#include <stdbool.h> | |
/* Represents individual thread's position in queue */ | |
typedef struct TOK { | |
bool is_reader; | |
sem_t enable; // Enables access | |
struct TOK *next; // Allows chaining as linked list |
/* | |
COPYRIGHT: CSAPP author RB | |
*/ | |
/* My thoughts | |
For the second rw problem, we give the writers have higher priority | |
than readers.That is when a writer arrives at some time, it will wait | |
all the readers in critical section currently to finish their work, | |
and at the same time, prevent any incoming readers entering their critical | |
section ,by doing a P operation on r. |
/* | |
COPYRIGHT: CSAPP author RB | |
*/ | |
#define NITERS 100 | |
/* Sample code demonstrating reader-writers. Create NITERS agents, | |
* numbered from 1 to NITERS. Each agent is randomly chosen to bea | |
* reader (probability 80%) or a writer (probability 20%). Writers | |
* assign their ID to the global value. Readers read the global |
thread apply all bt | |
用于打印所有线程调用栈,debug死锁 | |
x/bx ptr | |
以字节为单位打印内存 |
int cnt = 0; | |
void merge(vector<int> &A, int p, int q, int r) | |
{ | |
int n1 = q - p + 1; // # of L | |
int n2 = r - q; // # of R | |
vector<int> L(n1+1, 0), R(n2+1, 0); | |
for (int i = 0; i < n1; i++) { | |
L[i] = A[p+i]; | |
} | |
for (int i = 0; i < n2; i++) { |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <assert.h> | |
#define BIDIRECTIONAL 0 /* change to 1 if you're doing extra credit */ | |
/* and write a routine called B_output */ | |
#define DEBUG 1 | |
#define N 8 | |
/* a "msg" is the data unit passed from layer 5 (teachers code) to layer */ | |
/* 4 (students' code). It contains the data (characters) to be delivered */ |
#include <iostream> | |
#include <iostream> | |
#include <cstdlib> | |
#include <cstring> | |
#include <cstdio> | |
#include <cassert> | |
using namespace std; | |
//static const int CNT = 10; |
数据库系统概念书、STL源码剖析
http://mp.weixin.qq.com/s/UMkq_ToJ5Ed8mda2Ku3LPg
独家分享| 深入理解 Linux 的 RCU 机制 http://mp.weixin.qq.com/s/TX3HZZi1GjlFprcxoNgk_w
分享| 共享内存无锁队列的实现 http://mp.weixin.qq.com/s/zaYhl43dkFxO4dL7pCcfkA 干货分享| C++11中的内存模型
(text of an email to the class from Dave O'Hallaron) | |
I've noticed that a number of you are having trouble getting started | |
with Lab 6. The purpose of this note is to help you get started by | |
guiding you through the initial steps I take when I do the lab. | |
This lab is too hard to do all at once, so I break it up into more | |
managable pieces. I start by developing a simple implicit list | |
allocator. Later, I will improve this code with a faster and more | |
memory efficient free list organization. But by starting with the |
CMU database group:15445 | |
Youtube: https://www.youtube.com/watch?v=xjhQ0e9Hlds&list=PLSE8ODhjZXjYutVzTeAds8xUt1rcmyT7x | |
course info: [main](http://15445.courses.cs.cmu.edu/fall2017/index.html) | |
Linux man page: | |
[manpage](https://linux.die.net/man/) | |
UIUC system programming |