0%

CSBasics - NJUOS_Note

记录一下上课+做实验时产生的问题、思考与收获

[M2] plcs

  • 做完这个实验,收获概括来讲是
    1. 理解计算图与依赖关系,并通过它来实现并发
    2. LCS的各种实现方法
    3. 加深对互斥与同步的理解,写出第一个并发程序
    4. 加深对条件变量实现生产者消费者模型的理解
    5. 提高编程素养
      1. 利用宏定义增强代码可读性
      2. 利用 assert 进行防御性编程
      3. 将大任务拆分成多个小任务

[M2-1] 并发编程

  1. 任何可能被多线程修改的全局变量,都应该上锁以后再处理

  2. 生产者负责生产而不是消费,逻辑要对

  3. 在现实生活中找一些实例来帮助理解并发程序

  4. 并发函数

    1
    2
    3
    4
    5
    6
    7
    pthread_mutex_lock/pthread_mutex_unlock
    // 我认为这两个函数之间的代码被称作“临界区”
    // 上锁或解锁时暂停时间,但临界区还是会被interrupt
    // 用锁保护临界区的全局变量

    pthread_cond_wait
    // 睡眠自己并释放持有的锁

[M2-2] 实验数据

1
2
3
4
测试用例:
dwiufhkdscnhuifhkwufherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbqkwdbeqpdwdinjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwhfbhjwdbqkwdbeqpdwdinjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbwdinjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhbwjhefwhjedbjasbwdinjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwhfbhjwdbqkwdbeqpdwdinjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfheonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwhfbhjwdbqkwdbeqpdwdinjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjegonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjaswihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwhfbhjwdbqkwdbeqpdwdinjdbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjaswihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwhfbhjwdbqkwdbeqpdwdinjdfgryibxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjaswihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwhfbhjwdbqkwdbeqpdwdinjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjegonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwhfbhjwdbqkwdbeqpdwdinjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjegonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwhfbhjwdbqkwdbeqpdwdinjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjegrfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjfbwjhfbhjwdbnjdfgryiegntonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjasbhjfbwjhfbhjwdbfherfkuqeioqkwdbtonqinxjzxnsmhgrbfywgduydgjashbxakcdiufhwihdajisnxcbjhbwehfvewjfvhsabxjacbwjhefwhjedbjas

dnjwfhrifhiuwhcieghtughhijyiohtonyjkpuopjlpmkyojknohnmotimjoqerwsreqczdxdswdrqzfgscxfqwdeqtwfewyjhfbvkrjnhioytjkuopjkplnghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhlnghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhplnghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhplnghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhplngnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhplngnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhplngnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhritunkhnrnkhuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhplngnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnghnkhnrnkhrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhplngnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcgghnkhnrnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhplnghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnghnkhnrnkhrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgtwyerqugiidhcghnghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyegiidhcfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnghnkhnrnkhrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgtwyerqugiidhcghnghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnsnxmzcgdfqtwyerqugiidhcfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnghnkhnrnkhrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgtwyerqugiidhcghnghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnksnxmzcgdfqtwyerqugiidhcfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnghnkhnrnkhrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgtwyerqugiidhcghnghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkrhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnkhnrnkhuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgtwyerqugiidhcghnghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnsnxmzcgdfqtwyerqugiidhcfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnghnkhnrnkhrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhclnghnhclnghnkhnrnkhuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgtwyerqugiidhcghnghnkhnrituhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnksnxmzcgdfqtwyerqugiidhcfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidkasnsnxmzcgdfqtwyerqugiidhcfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnghnkhnrnkhrituhgqwsdrcxzfcxgcsfkasnsnxmzcgdfqtwyerqugiidhcfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnghnkhnrnkhrituhgqwsdrcxzfcxgcsfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnksnxmzcgdfqtwyerqugiidhcfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidkasnsnxmzcgdfqtwyerqugiidhcfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnghnkhnrnkhrituhgqwsdrcxzfcxgcsfkasnsnxmzcgdfqtwyerqugiidhccxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnksnxmzcgdfqtwyerqugiidhcfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidkasnsnxmzcgdfqtwyerqugiidhcfqtwyerqugiidhcghnkhnrituhtuhgqwsdrcxzfcxgcsfdvefqytnrituhtuhgqwsdrcxzfcxgcsfdvefqytwefqydvfuberhjfbrigncxjkvnodfgjorlnhnkoyjojgsnckasnxmzcgdfqtwyerqugiidhcghnghnkhnrnkhrituhgqwsdrcxzfcxgcsfkasnsnxmzcgdfqtwyerqugiidhc

命令与输出结果

1
2
3
4
5
6
7
# 单线程
time ./a.out
1419

real 0m8.628s
user 0m0.038s
sys 0m0.039s

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
time ./plcs-64
1419
real 0m17.036s
user 0m1.344s
sys 0m0.846s

time ./plcs-64 2
1419
real 0m14.251s
user 0m1.044s
sys 0m1.093s

time ./plcs-64 4
1419
real 0m8.603s
user 0m0.842s
sys 0m2.181s

time ./plcs-64 8
1419
real 0m6.961s
user 0m1.117s
sys 0m4.643s

time ./plcs-64 16
1418
real 0m6.554s
user 0m1.299s
sys 0m5.947s

Lecture 16

  1. 经常反思自己做的事情好不好。jyy老师给出的例子是“用cmd替代webpage的gpt,使对话更稳定更易保存”

  2. 计算机的世界里没有什么是我们搞不定的,先从简单的入手,了解原理之后再去接触复杂的(举例是 pmap 是读取 maps 实现的)

-------------文章就到这里啦!感谢您的阅读XD-------------