Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat /proc/cpuinfo | grep cache_alignment
- $ LEVEL1_DCACHE_LINESIZE
- flag: -DLEVEL1_DCACHE_LINESIZE=`getconf LEVEL1_DCACHE_LINESIZE`
- #define CACHE_LINE sysconf(_SC_LEVEL1_DCACHE_LINESIZE)
- typedef struct node_t { //64 LEVEL1_DCACHE_LINESIZE
- unsigned char parent_sense;
- unsigned char* parent_pointer;
- //binary wakeup tree, every processor assigned static spot, parent reach down to child to tell them to wake up
- unsigned char* child_pointers[2];
- unsigned char have_children[4];
- unsigned char child_not_ready[4];
- unsigned char dummy;
- unsigned char padding[16];
- } node_t; //total size must match 64 LEVEL1_DCACHE_LINESIZE
- node_t* nodes;
- posix_memalign((void **)&nodes, CACHE_LINE, (sizeof(node_t) * num_threads)); //sysconf(_SC_LEVEL1_DCACHE_LINESIZE)
Add Comment
Please, Sign In to add comment