Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
lsandgithub
C
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
C
/
kernel
/
i.kernel-data-algorithm
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
61 lines (40 loc) · 3.22 KB
master
Breadcrumbs
C
/
kernel
/
i.kernel-data-algorithm
Copy path
Top
File metadata and controls
Code
Blame
61 lines (40 loc) · 3.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
==============================================================================
程序=数据结构+算法
------------------
这句经典的话,大家应该很熟悉。
数据结构是什么?
“数据”从字面上应该不难理解,就是我们计算的“数”。“结构”从字面上理解应该是数据的
存在形态,也就是我们计算的“数”的“形态”。
“数据结构”为我们提供了操作“数”的基础,就拿C语言来说,其中的基本数据结构有整型,
短整型,长整型,浮点型,单精度型,双精度型,字符类型等,整型也就是我们通常所说
的整数,这样就让我们能够清楚明白了,但是对于计算机是如何计算整数的呢?是用只能
识别0和1的二进制进行计算的,浮点型和我们说的小数是类似,也是通过一个电路的设计
用二进制的方式计算出来的。这个字符类型怎么办呢?通过整数与字符之间的映射来建立
联系的,也就是说字符类型是站在整型的肩膀上的。更高的数据类型则站在他们的肩膀上
来构建的。
用一句话就是用二进制抽象出了数,用数抽象出了更多。
算法是什么?顾名思义,计算方法。上面提到“数据结构”从本质上是为我们提供了“数”,
而算法则为我们提供了如何将“数”计算出结果的方法。
程序是什么?算数即算术。
内核的(程序=数据结构+算法)
----------------------------
内核的本质就是我们为管理计算机上所有的硬件而抽象出的工具,当然内核也是程序。
在计算机总线上的硬件,比如中央处理器(CPU),内存,硬盘,键盘,鼠标,这些东西
都是由内核控制和管理的,本质上这些组件在内核中是由“数”来表示的(即“数据结构”),
而对这些组件的调度与使用本质上就是“算法”。
当然,这些只是从内核的宏观角度来考虑的,随着内核的发展和成长,其本身有其自身的
特性。例如:内核的加密的多种方法就是算法,内核对于文件系统中的目录管理方法就是
算法,内核对计算机内存的管理和使用方法就是算法。
当然,当我们从分布式计算集群的角度去考虑如何管理和使用集群中的每一台计算机的计
算资源时,这个管理集群的方法也是算法。因此,算法会因你所站的角度和高度不同而有
不同,可大可小。
如何深入了解内核
----------------
上面解释了什么是数据结构和算法,当我们想要了解内核是如何具体工作的时候,我们需
要看内核的代码,如何有侧重点的观看这些大量的内核代码呢?当然就是,数据结构如何
设计的,算法如何实现的。
由于内核是用C代码和少量的汇编代码写成的,当然C语言的数据类型就是我们应该重点观
察的数据结构了,数据结构了然于胸之后,就是观察这些数据是如何的被操作和传递的。
指针作为避免在内存空间浪费使用上是不可忽视的。
==============================================================================
==============================================================================
You can’t perform that action at this time.