摘要:
##读者-写者(多线程) ###读者写者问题 ####抽象解释 多个进程访问一个共享的数据区 读者(读进程)只能读数据,写者(写进程)只能写数据 适用于数据库、文件、内存、寄存器等数据区的访问模型 如12306购票系统,由于用户量庞大和数据量巨大,不可避免地会出现多个进程同时查询(读)或修改(写)同 阅读全文
摘要:
##thread互斥测试 #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <ctype.h> struct arg_set { char *fname; int count; }; struct arg_set 阅读全文
摘要:
##thread同步测试 #include <stdio.h> #include <pthread.h> #include <stdlib.h> #include <semaphore.h> #define NUM 5 int queue[NUM]; sem_t blank_number, prod 阅读全文