自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(50)
  • 收藏
  • 关注

原创 秋招的一些总结和感想

写在前面目前拿了几个比较满意的意向了,秋招暂时结束了,随便写点东西总结一下。以下内容仅供参考。关于岗位我是只会C++和Python,所以主要投了C++后台开发岗、基础架构,还有一些游戏开发岗。关于实习实习挺重要的,建议7月前去实习,7月份开始准备秋招。另外实习经历好好准备一下,每次面试大概率问道。主要关于实习期间做的项目,项目的背景,自己实现的部分,遇到什么难点,还可以怎样优化,收获等等。关于笔试多刷leetcode,我是每日一题加周赛,保持手感。笔试大多数公司都是ACM模式,就是需要自己进行

2021-09-28 22:42:34 647 3

原创 MIT6.S081学习总结-lab10:mmap

lab10 实现mmap介绍mmap和munmap系统调用允许UNIX程序对它们的地址空间进行详细的控制。它们可以用于在进程之间共享内存,将文件映射到进程地址空间,以及作为用户级页面错误方案的一部分,比如在讲座中讨论的垃圾收集算法。在本实验中,您将向xv6添加mmap和munmap,重点关注内存映射文件。void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);mmap可以通过多种方

2021-07-09 16:44:03 1356 2

原创 MIT6.S081学习总结-lab9:file system

lab9 是文件系统相关,主要实现大文件的支持和软链接。Large files实现对大文件的支持文件分配策略就是国内操作系统教材上讲的索引分配。原本xv6中每个文件有13个地址索引,前12个是直接地址索引,对应的数据块直接存储数据,最后一个是一级间接地址索引,对应的数据块存储地址索引,因此最大文件为256+12=268256+12=268256+12=268个数据块。增大支持的最大文件大小,可以增加一个二级间接地址索引,变为前11个直接地址索引,第12个一级间接地址索引,最后一个是二级间接地址索引,

2021-07-06 23:45:17 2007 3

原创 MIT6.S081学习总结-lab8:Lock

lab8 是关于锁的应用,重新设计内存分配和缓冲区分配,来增加多核并行速度Memory allocator物理内存分配,之前的实现里每次分配内存kalloc、释放内存kfree都需要获得全局锁kmem.lock,在多核系统里这会导致很激烈的race condition。改进时,可以考虑为每个CPU一个空闲内存列表,每次分配内存时先分配当前cpu空闲内存列表里的内存,如果不够就从其他空闲列表里‘steal’一个内存快。这样需要每个列表一个锁,可以大量减少锁的竞争。实现:kmem修改为每个CPU一个fr

2021-07-05 19:38:59 1588 1

原创 MIT6.S081学习总结-lab7:Multithreading

lab7 是多线程相关,将会实现一个用户级线程,使用多线程加速程序以及实现一个barrierUthread:switching between threads实现用户级线程的切换,主要修改thread_create()、thread_schedule()和thread_switch.实现:刚开始没怎么懂,照着kernel里的swtch写了一下,竟然过了新增上下文数据结构:thread_create里初始化该线程上下文信息中的ra和sp寄存器值,ra是返回地址,就是函数返回之后继续执行的点,sp

2021-07-01 20:25:24 1210 5

原创 MIT6.S081学习总结-lab6:Copy-On-Write Fork

lab6 也是虚拟内存的一种应用,主要实现fork时的写时复制copy-on-write功能。问题xv6中的fork()系统调用将所有父进程的用户空间内存复制到子进程中。如果父进程用户空间很大,复制可能需要很长时间。更糟糕的是,这种复制工作经常被浪费;例如,子进程中的fork()后跟exec()将导致子进程丢弃复制的内存,可能根本就没有使用复制来的很大一部分内存。另一方面,如果父类和子类都使用一个页面,而其中一方或双方都编写该页面,则确实需要一个副本。解决方法写时拷贝(COW) fork()的目标是

2021-06-30 13:09:25 1017 1

原创 MIT6.S081学习总结-lab5:lazy page allocation

lab5 是lazy page allocationi相关,主要解决页面错误问题。O/S可以对页表硬件使用的许多巧妙技巧之一是延迟分配用户空间堆内存。Xv6应用程序使用sbrk()系统调用向内核请求堆内存。在我们给出的内核中,sbrk()分配物理内存并将其映射到进程的虚拟地址空间。内核为一个较大的请求分配和映射内存可能需要很长时间。例如,考虑一个gb由262,144 4096字节的页组成;即使每一种都很便宜,这也是一笔巨大的投资。此外,一些程序分配的内存比实际使用的要多(例如,实现稀疏数组),或者在使用之前

2021-06-28 22:59:49 895 1

原创 MIT6.S081学习总结-lab4:traps

lab4 是traps相关Backtrace添加一个backtrace函数,sys_sleep调用这个函数后可以打印出函数调用栈实现:kernel/riscv.h里添加函数来获取frame pointer:在kernel/printf.c里添加backtrace函数:sys_sleep里调用即可Alarm实现两个系统调用:int sigalarm(int ticks, void (*handler)()) 每ticks时钟单位调用handler;int sigreturn(void)在h

2021-06-25 16:30:39 917 2

原创 MIT6.S081学习总结-lab3:page tables

lab3 主要是页表相关,难度突然提高了好多,遇到了无数个坑,太难了。打印页表第一个进程启动时打印页表内容实现:kernel/vm.c里添加,递归实现即可每个进程一张内核页表目前xv6的实现里,每个进程只有一张独立的用户地址空间页表,共享一张内核页表,这样的话每次内核不能直接使用用户指针,只能先将其通过用户页表转为物理地址。本节及下一节要做的是使内核可以直接解引用用户指针,就是可以直接通过虚拟地址访问。本节要做的就是为每个进程复制一个内核页表。实现省略了 添加函数到defs.h的步骤,这

2021-06-15 23:49:37 3481 4

原创 MIT6.S081学习总结-lab2: system calls

lab2 主要实现两个系统调用添加系统调用过程user/user.h里添加系统调用函数,这个lab需要添加两个系统调用,下图中最后两个:trace 和 sysinfouser/usys.pl里添加一个entry,这个文件会生成user/usys.S,就是系统调用的具体实现,之后会使用ecall指令跳转到相应的系统调用去执行。kernel/syscall.h添加系统调用的编号kernel/syscall.c添加系统调用的函数映射,syscalls这个数组存放了所有指向系统调用的实现函数指针

2021-06-04 14:49:35 1450 3

原创 MIT6.S081学习总结-lab1: Xv6 and Unix utilities

最近学习MIT比较有名的操作系统课程6.S081,这门课程主要亮点就是设计精巧的lab了。这里记录一下lab1:Xv6 and Unix utilities.1.sleep用系统调用实现sleep#include "kernel/types.h"#include "user/user.h"intmain(int argc, char* argv[]){ if (argc <= 1) { fprintf(2, "sleep: missing operand\n")

2021-06-03 14:05:39 2364 4

原创 Linux网络编程之TCP相关

目录TCP连接建立服务器端客户端TCP断开连接一些细节:1.文件描述符的阻塞非阻塞问题2.三次握手发生在哪步3.关于 listen 第二个参数 backlog4.通信的一端突然断开会怎样5.shutduwn 和 close6.RST包总结参考最近在学习一些Linux网络编程,这里整理一下TCP相关内容TCP连接建立建立连接需要三次握手,对应的socket编程如下(忽略了异常处理):服务器端#include <sys/socket.h>#include <arpa/inet.h&

2021-05-28 16:02:44 649

原创 tf2.0 ValueError:You are trying to load a weight file containing 2 layers into a model with 0 layers

tensorflow2.0版本,通过继承 tf.keras.Model 类自定义网络结构,当加载之前训练过的模型参数时报错 ValueError:You are trying to load a weight file containing 2 layers into a model with 0 layers。网上有说改成model.load_weights('model_name.h5',by_name=True)试了下还是报错。后来在github的一些demo里发现,在加载权重前将模型运行一遍

2020-07-02 20:55:28 3104 3

原创 用python实现DBSCAN

DBSCAN是比较著名的基于密度的聚类方法,它可以轻松地得到各种形状的簇。主要有两个参数,邻域半径 ϵ\epsilonϵ 以及邻域内最少数据点数 minptsminptsminpts .python代码如下:def dist(a, b): m = a.shape[0] n = b.shape[0] res = np.zeros((m, n)) for i i...

2020-04-13 16:16:25 3664 4

原创 用python画出逻辑斯蒂映射(logistic map)中的分叉图

最近沉迷混沌数学逻辑斯蒂映射在混沌数学中是一个很经典的例子,它可以说明混沌可以从很简单的非线性方程中产生。逻辑斯蒂映射公式如下:x_n表示当前人口与最大人口数量的比值,mu为参数,相当于人口增长速率。分叉图描绘的是不同mu情况下,x收敛的值的分布图。参考地址python代码如下:from tqdm import tqdmimport matplotlib.pyplot as pl...

2020-03-01 20:08:08 7968 5

原创 使用MTCNN进行人脸检测

人脸检测是人脸识别中重要的一环,MTCNN是比较常用的人脸检测算法,这里主要介绍测试过程。论文地址主要流程:1.做图片金字塔,即将图片resize成不同大小2.将不同大小的图片输入PNet,得到候选框的偏移值,映射到原图得到许多候选框,做非极大值抑制(nms)去掉部分候选框3.去原图截取候选框的图像(要截取覆盖这个候选框的最大正方形框),resize成24x24,输入RNet,得到候选...

2020-02-21 18:04:07 859

原创 kaggle:手写数字识别--pytorch搭建简单的cnn

题目地址之前学svm时候就做了一下,pca+svm也有0.98左右,这次试试cnn吧。在本地跑完提交需要搭梯子,就直接在kaggle的kernel上运行了,kernel上也有很多大佬分享自己的代码,可以学到很多。先导入一堆包进来:import numpy as np # linear algebraimport pandas as pd # data processing, CSV fil...

2019-07-29 17:22:42 1638 1

原创 使用视频下载工具 you-get 下载视频

最近需要帮我妈下载一些爱奇艺上的视频,找到了you-get这个下载神器该工具的github主页安装you-get该工具是基于python的,因此需要先装python,版本需要python3.2以上。安装成功后在cmd上输入下面命令安装you-getpip install you-get安装成功后按照github上文档提示,随便找个b站视频下一个看看 you-get https://...

2019-07-27 14:04:13 1487 2

原创 如何把在matlab上用libsvm训练出来的模型保存为.model

用matlab中libsvm进行svm训练后,需要将模型文件保存下来,网上找了好久终于找到一个能用的了。主要参考:https://www.tuicool.com/articles/QvAr22本人版本:MATLAB R2016a,libsvm3.23该版本输出的模型结构体域有11个,因此不需要像原博客修改代码。可直接使用svm_savemodel.c,如下:#include "../svm...

2019-04-22 20:39:11 6208 5

原创 2019-PAT春季考试小结

第一次参加pat考试,大概准备了一两个月这样,主要还是参考算法笔记,然后就是狂刷模拟题,各种题型都熟悉一遍(个人感觉二叉树的建树、并查集、dfs、dijkstra比较重要一点)。进入考场后直到1点半老师才让我们动鼠标,我先试试IDE,codeblocks不知为什么找不到编译器路径,心态有点崩,最后用了dev,建议各位把考场有的ide都熟悉一下。先把字体调成自己喜欢的加上各种头文件开始答题了。第一...

2019-03-03 14:56:46 1267

原创 1029 Median (25 分)--PAT甲级

1029 Median (25 分)Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 12, and the median of S2 = { 9, ...

2019-02-23 16:00:27 519

原创 1021 Deepest Root (25 分)--PAT甲级

1021 Deepest Root (25 分)A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a h...

2019-02-23 14:53:13 919 3

原创 扑克牌斗牛游戏的概率问题

前几天过年跟亲朋好友玩起了斗牛,感觉还是挺刺激的,我发现有时候会连续好几把没有牛(脸黑的不适合这游戏…),让我对这概率产生了兴趣,就随便用c编程模拟计算了一下概率。玩法简介:一副牌去掉大小王,其中JQK当做点数10,每人5张牌,以三张一卡、两张一卡的形式,当其中三张卡点数和为10的倍数,这叫“牛”,另外两张牌点数和若也为10的倍数,即为“牛牛”,此种牌最大,否则模10即为结果,越大牌也就越大;若...

2019-02-15 22:11:11 15925 4

原创 149. 直线上最多的点数--leetcode

给定一个二维平面,平面上有 n 个点,求最多有多少个点在同一条直线上。示例 1:输入: [[1,1],[2,2],[3,3]]输出: 3解释:^|| o| o| o +-------------&gt;0 1 2 3 4示例 2:输入: [[1,1],[3,2],[5,3],[4,1],[2,3],[1,4]]输出: 4解释:^...

2019-02-08 21:14:36 235

原创 1091 Acute Stroke (30 分)--PAT甲级

1091 Acute Stroke (30 分)One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions are identified in each MR...

2019-02-02 21:20:24 258

原创 1045 Favorite Color Stripe (30 分)--PAT甲级

1045 Favorite Color Stripe (30 分)Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pie...

2019-01-31 15:24:46 149

原创 1095 Cars on Campus (30 分)--PAT甲级

1095 Cars on Campus (30 分)Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all the i...

2019-01-29 16:56:44 1336

原创 1034 Head of a Gang (30 分)--PAT甲级

1034 Head of a Gang (30 分)One way that the police finds the head of a gang is to check people’s phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a ...

2019-01-29 15:22:27 963

原创 1131 Subway Map (30 分)--PAT甲级

1131 Subway Map (30 分)In the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following figure shows the map of Beijing subway. Now you are supposed ...

2019-01-28 21:46:45 1349 2

原创 1076 Forwards on Weibo (30 分)--PAT甲级

1076 Forwards on Weibo (30 分)Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed wit...

2019-01-28 16:24:23 397

原创 1018 Public Bike Management (30 分)--PAT甲级

1018 Public Bike Management (30 分)There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and retu...

2019-01-28 15:26:44 157

原创 1072 Gas Station (30 分)--PAT甲级

1072 Gas Station (30 分)A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must gu...

2019-01-26 20:50:52 805

原创 1087 All Roads Lead to Rome (30 分)--PAT甲级

1087 All Roads Lead to Rome (30 分)Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most happ...

2019-01-26 15:43:45 563

原创 1107 Social Clusters (30 分)--PAT甲级

1107 Social Clusters (30 分)When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A social cluster is a set of ...

2019-01-25 17:08:30 341

原创 1022 Digital Library (30 分)--PAT甲级

1022 Digital Library (30 分)A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigne...

2019-01-25 15:55:45 273

原创 1030 Travel Plan (30 分)--PAT甲级

1030 Travel Plan (30 分)A traveler’s map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to de...

2019-01-24 18:58:34 136

原创 1111 Online Map (30 分)--PAT甲级

1111 Online Map (30 分)Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is the shortest, and the other ...

2019-01-24 17:10:22 846

原创 1123 Is It a Complete AVL Tree (30 分)--PAT甲级

1123 Is It a Complete AVL Tree (30 分)An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they d...

2019-01-23 18:57:32 542

原创 1143 Lowest Common Ancestor (30 分)--PAT甲级

1143 Lowest Common Ancestor (30 分)The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.A binary search tree (BST) is recursively d...

2019-01-22 14:47:37 371 1

原创 1151 LCA in a Binary Tree (30 分)--PAT甲级

1151 LCA in a Binary Tree (30 分)The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.Given any two nodes in a binary tree, you are...

2019-01-21 20:38:14 547

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除