摘要: 前面我们模拟了一个带有时钟中断的x86 CPU并初始化了系统变量 只需要在mymain.c基础上完成进程描述符PCB和进程链表管理,在myinterrupt.c中完成进程切换代码,即可完成一个可运行的OS kernel 定义进程描述符PCB linux内核中进程PCB由数据结构struct task 阅读全文
posted @ 2024-11-06 10:34 sgqmax 阅读(25) 评论(0) 推荐(0)
摘要: 使用qemu虚拟一个x86 CPU的硬件平台 sudo apt-get install qemu-system-x86 1.下载linux内核代码 wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.9.4.tar.xz xz -d l 阅读全文
posted @ 2024-11-06 09:30 sgqmax 阅读(17) 评论(0) 推荐(0)
摘要: 为了更直观的感受到内存布局,我们使用gcc的编译选项-fdump-lang-class查看 如下代码 class Base{ public: Base(){} virtual ~Base(){} privte: int i; }; 使用如下命令编译 g++ -O0 -std=c++11 -fdump 阅读全文
posted @ 2024-11-03 17:50 sgqmax 阅读(51) 评论(0) 推荐(0)
摘要: 在计算机中,我们都知道0.1+0.2是不等于0.3的 那等于多少呢?我们使用程序测试一下 #include<iomanip> int main(){ std::cout<<std::setprecision(18)<<0.1+0.2; return 0; } //out: 0.30000000000 阅读全文
posted @ 2024-11-03 17:47 sgqmax 阅读(40) 评论(0) 推荐(0)
摘要: 迭代器失效 序列式容器 vector deque 使用连续分配的内存 删除一个元素,会导致后面的元素前移 不能使用如erase(iter++)这种方式删除元素 erase()会返回下一个有效的迭代器 /* for(iter=v.begin(); iter!=v.end(); iter++){ if( 阅读全文
posted @ 2024-11-03 17:37 sgqmax 阅读(50) 评论(0) 推荐(0)
摘要: C++初始化 C++11之前的初始化 T var; // 构造 T var(val); T var= val; // 列表 T var{val}; T var={val}; C++11统一了初始化方法:列表初始化 brace-initialization 消除了之前初始化基本类型、聚合类型和非聚合类 阅读全文
posted @ 2024-11-03 17:35 sgqmax 阅读(21) 评论(0) 推荐(0)
摘要: conda使用 conda update conda conda info -e # conda env list conda create -n envname python=ver conda remove –n envname --all conda activate envname cond 阅读全文
posted @ 2024-11-02 19:18 sgqmax 阅读(114) 评论(0) 推荐(0)
摘要: 测试中间层输出 import torch import numpy as np from PIL import Image from torchvision import transforms, models import matplotlib.cm from torchinfo import su 阅读全文
posted @ 2024-11-02 18:52 sgqmax 阅读(40) 评论(0) 推荐(0)
摘要: VGG16 from torch import nn class VGG(nn.Module): """ 一共6个版本,最常用VGG16 VGG采用五组卷积,三个全连接,最后用Softmax分类 VGG显著特点:每次经过池化层maxpool后特征图尺寸减小一倍,,通道数增加一倍(最后一个池化层除外) 阅读全文
posted @ 2024-11-02 18:37 sgqmax 阅读(31) 评论(0) 推荐(0)
摘要: 实现神经网络 torch 将张量转换为torch.cuda.TensorFloat并在GPU上进行计算 torch.autograd 构建计算图并自动获取梯度 torch.nn 具有共享层和损失函数的神经网络库 torch.optim 通用优化算法 神经网络基本结构 网络层:神经网络的基本模型 网络 阅读全文
posted @ 2024-11-02 18:28 sgqmax 阅读(44) 评论(0) 推荐(0)