ARM Linux 开发基础技能实战演练
主要介绍 Linux 应用开发基础技能,包括以下五方面的内容:
1、Git 的使用
2、面向对象 C
3、文件读写
4、进程与线程
5、TCP、UDP 通信基础
Git 的使用(何为Git及用途)
1 关于版本管理系统
记录文件内容变化,以便将来查阅特定版本情况
2 Git与其他版本管理系统的异同
![](https://img-blog.csdnimg.cn/img_convert/9cafa8ed8dd27f328310a74f36e91063.png)
3 Git的历史
![](https://img-blog.csdnimg.cn/img_convert/930889a855fafac9fed6192980525445.png)
Git 的使用(Git 基本功能介绍)
基于Ubuntu
1 安装以及配置
![](https://img-blog.csdnimg.cn/img_convert/7b9503d36e58d2d4fd3d43f573b94e72.png)
2 获取仓库
![](https://img-blog.csdnimg.cn/img_convert/e8097466456603ada2d7b7b85f3168b8.png)
3 记录每次变更
![](https://img-blog.csdnimg.cn/img_convert/706046673db2dfd663b293f29a489dbb.png)
4 远程仓库操作
![](https://img-blog.csdnimg.cn/img_convert/43666ff3e3ab3f86719035cf2120417b.png)
命令示例如下
![](https://img-blog.csdnimg.cn/img_convert/45cb95d8ed82890b0bf215c97d480634.png)
Git 的使用(Git的实现原理)
1 基于文件快照的记录方式
![](https://img-blog.csdnimg.cn/img_convert/40fd9a4b3057c024ca2cfdb4820ccb4e.png)
2 Git的分支
![](https://img-blog.csdnimg.cn/img_convert/6cd3b1a75ed67b340109981c45c45264.png)
![](https://img-blog.csdnimg.cn/img_convert/477450bd926bb27fc64778fa67b0801c.png)
![](https://img-blog.csdnimg.cn/img_convert/b0d9c92ebf80eb38bb1a10c5367d6fa1.png)
3 分布式的Git
![](https://img-blog.csdnimg.cn/img_convert/f740c9a7291cfc173321c8f6f62d5e53.png)
司令官与副官工作流适用于更加大型的组织
blessed repository = 项目仓库 lieutenant = 副职官员
Git 的使用(Git 实践)
1 使用git本地仓库管理 Hello world程序开发
演示新建helloworld文件,运行成功,提交;
演示复制写文件的代码文件,运行成功,提交;
演示使用git checkout回退到helloworld,运行成功;再使用git checkout master恢复到最新版本;使用git reset彻底回到某个历史版本,丢弃之后的更改
2 在自己电脑搭建Git服务器
新建用户、配置git仓库
3 使用git进行多人的分工协作开发
在同一台电脑使用两个不同用户开发 Hello world
面向对象 C 语言编程(面向对象思想概览)
1 类与对象
![](https://img-blog.csdnimg.cn/img_convert/c6d62996c6fb678457746c42ef3d1685.png)
![](https://img-blog.csdnimg.cn/img_convert/dfbc28f2004b832788da3d0c8501b9a0.png)
2 封装、继承与多态
![](https://img-blog.csdnimg.cn/img_convert/3469d78a25d75f165ad63a7a5d799b0c.png)
![](https://img-blog.csdnimg.cn/img_convert/a008de706b4d0d66d662e4a42220d056.png)
![](https://img-blog.csdnimg.cn/img_convert/70bd02813fd80a15c80bc4028c53eda7.png)
面向对象 C 语言编程- (C语言面向对象实现基础)
1 类的实现
![](https://img-blog.csdnimg.cn/img_convert/cf33989ba6cf92b2abc092446297e8dd.png)
2 封装的实现
![](https://img-blog.csdnimg.cn/img_convert/d0656c22b109804f8e47f08445d3e697.png)
3 继承的实现
![](https://img-blog.csdnimg.cn/img_convert/abf90bdce1bf2eee396f9ced6e545602.png)
派生类定义中必须把基类放在最前面,这样方便将派生类强制类型转换为基类
4 多态的实现
![](https://img-blog.csdnimg.cn/img_convert/8fb71ecea5fd2765e97b783f380d3764.png)
面向对象 C 语言编程(实战演练)
并不是真的要画图,只是用来展示程序框架
![](https://img-blog.csdnimg.cn/img_convert/bce8830ae386205f2b22350f42a3240a.png)
![](https://img-blog.csdnimg.cn/img_convert/84201b896c18276d04e0921924fbac06.png)
黑色箭头为继承,蓝色箭头为使用【Canvas只能管理Shape,不认识Circle,后续代码需要强制转换】
画图程序流程图如下
![](https://img-blog.csdnimg.cn/img_convert/08fac40435c937d79144f7d6fa2cba18.png)
源代码如下
main.c
![](https://img-blog.csdnimg.cn/img_convert/e4219b82c628f63edf3cc0f01d89ba29.png)
canvas.h
![](https://img-blog.csdnimg.cn/img_convert/88bf147ebf9ff7346506d6540ec1e5a8.png)
canvas.c
![](https://img-blog.csdnimg.cn/img_convert/4fde609f07344854b10ec51f04baa29a.png)
![](https://img-blog.csdnimg.cn/img_convert/a7277cd7d5e54a974eadcafb8e83a845.png)
shape.h
![](https://img-blog.csdnimg.cn/img_convert/5eccd3feb6e688afab876e456b28ee0a.png)
shape.c
![](https://img-blog.csdnimg.cn/img_convert/2017b69ee56acfcb380ac8ab2c3912cd.png)
circle.h
![](https://img-blog.csdnimg.cn/img_convert/9ce6b1dd6794f7a0d17a1c6889e169df.png)
circle.c
![](https://img-blog.csdnimg.cn/img_convert/3e2dcb43ab29a75b3e1db5978ad38dc9.png)
运行效果
![](https://img-blog.csdnimg.cn/img_convert/8fe64039c4e100f9e2ec8b53bf0b7811.png)
文件读写(文件相关概念)
1 文件的概念
![](https://img-blog.csdnimg.cn/img_convert/dd640366ae08bf2f441fd644821e0ef1.png)
2 Linux系统中文件的类别
![](https://img-blog.csdnimg.cn/img_convert/8eb410906f463ca229adbd4abcf50fa1.png)
3 文件描述符
![](https://img-blog.csdnimg.cn/img_convert/dafd8fee51ce7b897b364703bbe69d9f.png)
4 文件指针
![](https://img-blog.csdnimg.cn/img_convert/4b70bb09a56aec09fdace74c5ef8bf0a.png)
文件读写(系统调用和标准IO库)
1 系统调用常用函数
![](https://img-blog.csdnimg.cn/img_convert/713bb2722da39d38f552c144a5c15dd2.png)
原子读写主要用于多线程
函数原型如下
![](https://img-blog.csdnimg.cn/img_convert/456b584fb4a9e60cd4682d984b62f56c.png)
2 标准IO库常用函数
![](https://img-blog.csdnimg.cn/img_convert/61e4dcdb6ba009e2aab77d90c93f4f7d.png)
函数原型如下
![](https://img-blog.csdnimg.cn/img_convert/948e9533a4243965e49f86a8dbd7fd72.png)
3 文件描述符与文件指针的关系
![](https://img-blog.csdnimg.cn/img_convert/a3b8eeb99c05b77113c4f74283258840.png)
文件读写(文件读写实践)
1 系统调用文件读写实例
将一个文件逐个字符读出并写入另外一个文件
![](https://img-blog.csdnimg.cn/img_convert/49df747f3d78ab33ed94c43fe258d43d.png)
O_TRUNC若文件已存在,则截断为0byte
O_CREAT若文件不存在,则新建文件
运行效果如下
![](https://img-blog.csdnimg.cn/img_convert/213ca0ac2f82c9f7b8792740de8f0743.png)
2 标准IO库文件读写实例
![](https://img-blog.csdnimg.cn/img_convert/3197b2ec733f77654b2b1d1e4e89627a.png)
![](https://img-blog.csdnimg.cn/img_convert/398f6468992797d42ff2e2de93018ce1.png)
3 系统调用与标准IO库的比较
使用time命令对比执行时间
![](https://img-blog.csdnimg.cn/img_convert/65f3c190e070de94de202f41a02796ab.png)
视频提到POSIX,找到一篇文章,存在这里
进程与线程(进程的概念)
1 什么是进程
![](https://img-blog.csdnimg.cn/img_convert/fc72106a8b581dc99650ea9c37e2ea20.png)
中括号的内容是内核自动启动的
![](https://img-blog.csdnimg.cn/img_convert/577d95878b1e78e91cdbd5636b12d079.png)
2 进程与程序的关系
![](https://img-blog.csdnimg.cn/img_convert/9f80498b22f5597a66b05529fcdcc1c6.png)
3 父进程与子进程的关系
![](https://img-blog.csdnimg.cn/img_convert/a181f1827002860eb3bd454b1f07b027.png)
进程与线程(线程的概念)
1 什么是线程
linux将线程称之为【轻量级进程LWP】
下图中同一个进程PID23044有多个线程LWP
![](https://img-blog.csdnimg.cn/img_convert/4b509316d46b9950f635ede925992d67.png)
2 进程与线程的关系
![](https://img-blog.csdnimg.cn/img_convert/e3f48c8d862235ad550223168253dbe4.png)
![](https://img-blog.csdnimg.cn/img_convert/1589bb46b009211d8afe64e0d52d7983.png)
![](https://img-blog.csdnimg.cn/img_convert/ea35d00d5d127aae230274bc50767743.png)
3 线程的同步
![](https://img-blog.csdnimg.cn/img_convert/35d42086781f524791ed08bebcba6595.png)
进程与线程(实操演练)
1 查看系统中的进程和线程
![](https://img-blog.csdnimg.cn/img_convert/245c4c621d173e37c3ab34b005c33735.png)
-e列出系统所有进程、-o列出属性值、pid进程ID、comm进程名称、cmd进程启动方式
ppid parent process父进程ID
![](https://img-blog.csdnimg.cn/img_convert/0b7621aaf00f432a2f15658e9463efbd.png)
RTPRIO优先级、NI nice优先级的权重 -20~19、pcpu占用CPU的百分比、
2 进程的创建
![](https://img-blog.csdnimg.cn/img_convert/4626bfd54b0f37be8bd353e3c3d2ac1c.png)
![](https://img-blog.csdnimg.cn/img_convert/53eac06aa9e5c4fd18bc1bba0fed99b4.png)
3 线程的创建和同步
![](https://img-blog.csdnimg.cn/img_convert/e630ad2b2c0d85644cbba8731f4ba3f4.png)
![](https://img-blog.csdnimg.cn/img_convert/6ac24f6cfa34a37f5a9bd68810ac8b1c.png)
![](https://img-blog.csdnimg.cn/img_convert/e9625c1369167e01a54c1d4fd0e6eee9.png)
线程同步
![](https://img-blog.csdnimg.cn/img_convert/c24a1049465a3ad49fcc81516e89b529.png)
全局变量sum加锁
TCP、UDP 通信基础(TCPIP 简介)
1 TCP/IP背景和介绍
![](https://img-blog.csdnimg.cn/img_convert/4bf9e7beeb32b6d78e36fe2cdbac8c27.png)
![](https://img-blog.csdnimg.cn/img_convert/e963273516d7a771130827590bb1d0bb.png)
![](https://img-blog.csdnimg.cn/img_convert/fb0d58a7d82f0ad113ed0c8a7096898d.png)
2 基本概念介绍
![](https://img-blog.csdnimg.cn/img_convert/ea3ad1b39db61e7b014d7a9e9864d3ff.png)
端口号用于区分同一台PC机内运行的不同软件【即服务】
![](https://img-blog.csdnimg.cn/img_convert/e20b5bee1652945038a5578d04e94768.png)
TCP、UDP 通信基础(UDP 协议)
1 传输层协议
![](https://img-blog.csdnimg.cn/img_convert/8064fa26820f067bd774e21e884d2fa3.png)
2 UDP概述
![](https://img-blog.csdnimg.cn/img_convert/e25329544287460ceeb7e2bb464e1666.png)
3 UDP报文
![](https://img-blog.csdnimg.cn/img_convert/3d78f7897fd3c9b839a6431472b4d7d2.png)
TCP、UDP 通信基础(TCP 协议)
1 TCP概述
![](https://img-blog.csdnimg.cn/img_convert/f899438acf9431b86d0966dd5504ffa1.png)
2 TCP报文
![](https://img-blog.csdnimg.cn/img_convert/69e886d4f3ea6c7c37c8e635306ae86e.png)
3 连接的建立和断开
![](https://img-blog.csdnimg.cn/img_convert/82dc2d55ea185c5abe3c5935207758eb.png)
![](https://img-blog.csdnimg.cn/img_convert/4578e623c6c137d2fee2707abeb60139.png)
4 TCP可靠传输的实现
![](https://img-blog.csdnimg.cn/img_convert/94c8e191ad1b543fa854a4ff811d8a9e.png)
TCP、UDP 通信基础(IP 网际协议)
1 IP数据报
![](https://img-blog.csdnimg.cn/img_convert/5dbda5e1395cd01fc12ba045c42683a2.png)
2 IP地址分类
![](https://img-blog.csdnimg.cn/img_convert/254c190ee1f8c56cbdcc5f8cb399dcac.png)
3 子网划分
![](https://img-blog.csdnimg.cn/img_convert/413e465944795fdb976eff6c0b05d3e5.png)
4 路由选择
![](https://img-blog.csdnimg.cn/img_convert/b125e5a0cdf52d0995fd432e3dd77dd0.png)
TCP、UDP 通信基础(TCP、UDP 通信实践)
1 UDP echo实例
![](https://img-blog.csdnimg.cn/img_convert/9932a1878602a6e41e6cb93d9dbcd6b7.png)
![](https://img-blog.csdnimg.cn/img_convert/1b6f7d27c6d2de0aa089a10d6395090a.png)
在同一台电脑先运行server,随后运行client端,client发信息,收到server回复。
2 TCP echo实例
![](https://img-blog.csdnimg.cn/img_convert/dcdb62d5d08c91c8606d7256f3ae83db.png)
![](https://img-blog.csdnimg.cn/img_convert/3922c8dae04172b8f16e8cb5c1442935.png)
![](https://img-blog.csdnimg.cn/img_convert/7bad8a51520e413cb8197d645077c01a.png)
相关文章
- 【技术种草】cdn+轻量服务器+hugo=让博客“云原生”一下
- CLB运维&运营最佳实践 ---访问日志大洞察
- vnc方式登陆服务器
- 轻松学排序算法:眼睛直观感受几种常用排序算法
- 十二个经典的大数据项目
- 为什么使用 CDN 内容分发网络?
- 大数据——大数据默认端口号列表
- Weld 1.1.5.Final,JSR-299 的框架
- JavaFX 2012:彻底开源
- 提升as3程序性能的十大要点
- 通过凸面几何学进行独立于边际的在线多类学习
- 利用行动影响的规律性和部分已知的模型进行离线强化学习
- ModelLight:基于模型的交通信号控制的元强化学习
- 浅谈Visual Source Safe项目分支
- 基于先验知识的递归卡尔曼滤波的代理人联合状态和输入估计
- 结合网络结构和非线性恢复来提高声誉评估的性能
- 最佳实践丨云开发CloudBase多环境管理实践
- TimeVAE:用于生成多变量时间序列的变异自动编码器
- 具有线性阈值激活的神经网络:结构和算法
- 内网渗透之横向移动 -- 从域外向域内进行密码喷洒攻击