mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 01:04:06 +08:00
add plugin
This commit is contained in:
parent
4b7a6966b0
commit
84bc57a70e
@ -647,7 +647,11 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Server: &CTX{},
|
|||||||
} else {
|
} else {
|
||||||
m.Add("append", "ctx", "")
|
m.Add("append", "ctx", "")
|
||||||
}
|
}
|
||||||
m.Add("append", "msg", msg.target.message.code)
|
if msg.target.message != nil {
|
||||||
|
m.Add("append", "msg", msg.target.message.code)
|
||||||
|
} else {
|
||||||
|
m.Add("append", "msg", "")
|
||||||
|
}
|
||||||
m.Add("append", "status", msg.Cap("status"))
|
m.Add("append", "status", msg.Cap("status"))
|
||||||
m.Add("append", "stream", msg.Cap("stream"))
|
m.Add("append", "stream", msg.Cap("stream"))
|
||||||
m.Add("append", "helps", msg.target.Help)
|
m.Add("append", "helps", msg.target.Help)
|
||||||
|
@ -2,6 +2,7 @@ package ctx
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
@ -60,11 +61,18 @@ type Context struct {
|
|||||||
Server
|
Server
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) Register(s *Context, x Server) {
|
func (c *Context) Register(s *Context, x Server, args ...interface{}) {
|
||||||
if c.contexts == nil {
|
if c.contexts == nil {
|
||||||
c.contexts = make(map[string]*Context)
|
c.contexts = make(map[string]*Context)
|
||||||
}
|
}
|
||||||
if x, ok := c.contexts[s.Name]; ok {
|
force := false
|
||||||
|
if len(args) > 0 {
|
||||||
|
switch arg := args[0].(type) {
|
||||||
|
case bool:
|
||||||
|
force = arg
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if x, ok := c.contexts[s.Name]; ok && !force {
|
||||||
panic(errors.New(c.Name + "上下文中已存在模块:" + x.Name))
|
panic(errors.New(c.Name + "上下文中已存在模块:" + x.Name))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,6 +275,24 @@ func (c *Context) BackTrace(m *Message, hand func(m *Message) (stop bool)) *Cont
|
|||||||
return target
|
return target
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Context) Plugin(args []string) string {
|
||||||
|
m := &Message{code: 0, time: time.Now(), source: c, target: c, Meta: map[string][]string{}}
|
||||||
|
if len(args) == 0 {
|
||||||
|
m.Echo("%s: %s\n", c.Name, c.Help)
|
||||||
|
for k, v := range c.Commands {
|
||||||
|
m.Echo("%s: %s %v\n", k, v.Name, v.Help)
|
||||||
|
}
|
||||||
|
} else if cs, ok := c.Commands[args[0]]; ok {
|
||||||
|
h := cs.Hand
|
||||||
|
if e := h(m, c, args[0], args[1:]...); e != nil {
|
||||||
|
m.Echo("error: ").Echo("%v\n", e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
m.Echo("error: ").Echo("not found: %v\n", args[0])
|
||||||
|
}
|
||||||
|
return strings.Join(m.Meta["result"], "")
|
||||||
|
}
|
||||||
|
|
||||||
type DEBUG interface {
|
type DEBUG interface {
|
||||||
Wait(*Message, ...interface{}) interface{}
|
Wait(*Message, ...interface{}) interface{}
|
||||||
Goon(interface{}, ...interface{})
|
Goon(interface{}, ...interface{})
|
||||||
@ -1178,6 +1204,8 @@ func (m *Message) Log(action string, str string, arg ...interface{}) *Message {
|
|||||||
}
|
}
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.Printf(str, arg...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if action == "error" {
|
if action == "error" {
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"plugin"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -187,6 +188,17 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
}, Help: "组件列表"},
|
}, Help: "组件列表"},
|
||||||
"componet_group": &ctx.Config{Name: "component_group", Value: "index", Help: "默认组件"},
|
"componet_group": &ctx.Config{Name: "component_group", Value: "index", Help: "默认组件"},
|
||||||
|
|
||||||
|
"make": &ctx.Config{Name: "make", Value: map[string]interface{}{
|
||||||
|
"go": map[string]interface{}{
|
||||||
|
"build": []interface{}{"go", "build"},
|
||||||
|
"plugin": []interface{}{"go", "build", "-buildmode=plugin"},
|
||||||
|
"load": []interface{}{"load"},
|
||||||
|
},
|
||||||
|
"so": map[string]interface{}{
|
||||||
|
"load": []interface{}{"load"},
|
||||||
|
},
|
||||||
|
}, Help: "免密登录"},
|
||||||
|
|
||||||
"flash": &ctx.Config{Name: "flash", Value: map[string]interface{}{
|
"flash": &ctx.Config{Name: "flash", Value: map[string]interface{}{
|
||||||
"data": []interface{}{},
|
"data": []interface{}{},
|
||||||
"view": map[string]interface{}{"default": []interface{}{"index", "time", "text", "code", "output"}},
|
"view": map[string]interface{}{"default": []interface{}{"index", "time", "text", "code", "output"}},
|
||||||
@ -281,6 +293,43 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
"counter_service": &ctx.Config{Name: "counter_service", Value: "http://localhost:9094/code/counter", Help: "counter"},
|
"counter_service": &ctx.Config{Name: "counter_service", Value: "http://localhost:9094/code/counter", Help: "counter"},
|
||||||
},
|
},
|
||||||
Commands: map[string]*ctx.Command{
|
Commands: map[string]*ctx.Command{
|
||||||
|
"make": &ctx.Command{Name: "make [action] file [args...]", Help: "更新代码", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
target, action, suffix := path.Join(m.Conf("runtime", "boot.ctx_home"), "src/examples/app/bench.go"), "build", "go"
|
||||||
|
if len(arg) == 0 {
|
||||||
|
arg = append(arg, target)
|
||||||
|
}
|
||||||
|
|
||||||
|
if cs := strings.Split(arg[0], "."); len(cs) > 1 {
|
||||||
|
suffix = cs[len(cs)-1]
|
||||||
|
} else if cs := strings.Split(arg[1], "."); len(cs) > 1 {
|
||||||
|
action, suffix, arg = arg[0], cs[len(cs)-1], arg[1:]
|
||||||
|
}
|
||||||
|
|
||||||
|
target = m.Cmdx("nfs.path", arg[0])
|
||||||
|
if target == "" {
|
||||||
|
target = m.Cmdx("nfs.path", path.Join("src/plugin/", arg[0]))
|
||||||
|
}
|
||||||
|
|
||||||
|
cook := m.Confv("make", []string{suffix, action})
|
||||||
|
switch kit.Chains(cook, "0") {
|
||||||
|
case "load":
|
||||||
|
if suffix == "go" {
|
||||||
|
so := strings.Replace(target, ".go", ".so", -1)
|
||||||
|
m.Cmd("cli.system", m.Confv("make", "go.plugin"), "-o", so, target)
|
||||||
|
arg[0] = so
|
||||||
|
}
|
||||||
|
|
||||||
|
if p, e := plugin.Open(arg[0]); m.Assert(e) {
|
||||||
|
s, e := p.Lookup("Index")
|
||||||
|
m.Assert(e)
|
||||||
|
w := *(s.(**ctx.Context))
|
||||||
|
c.Register(w, nil, true)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
m.Cmdy("cli.system", cook, arg)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}},
|
||||||
"flash": &ctx.Command{Name: "flash", Help: "闪存", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"flash": &ctx.Command{Name: "flash", Help: "闪存", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
total := len(m.Confv("flash", "data").([]interface{}))
|
total := len(m.Confv("flash", "data").([]interface{}))
|
||||||
// 查看列表
|
// 查看列表
|
||||||
|
158
src/plugin/sort.go
Normal file
158
src/plugin/sort.go
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"contexts/ctx"
|
||||||
|
"fmt"
|
||||||
|
"math"
|
||||||
|
"math/rand"
|
||||||
|
"os"
|
||||||
|
"toolkit"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Merge(left []int, right []int) []int {
|
||||||
|
result := make([]int, 0, len(left)+len(right))
|
||||||
|
for len(left) > 0 || len(right) > 0 {
|
||||||
|
if len(right) == 0 || (len(left) > 0 && (left[0] < right[0])) {
|
||||||
|
result, left = append(result, left[0]), left[1:]
|
||||||
|
} else {
|
||||||
|
result, right = append(result, right[0]), right[1:]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
func MergeSort(m *ctx.Message, level int, data []int) []int {
|
||||||
|
if len(data) < 2 {
|
||||||
|
m.Add("append", kit.Format(level), fmt.Sprintf("[][]"))
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
middle := len(data) / 2
|
||||||
|
m.Add("append", kit.Format(level), fmt.Sprintf("%v%v", data[:middle], data[middle:]))
|
||||||
|
return Merge(MergeSort(m, level+1, data[:middle]), MergeSort(m, level+1, data[middle:]))
|
||||||
|
}
|
||||||
|
func QuickSort(m *ctx.Message, level int, data []int, left int, right int) {
|
||||||
|
if left >= right {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
p, l, r := left, left+1, right
|
||||||
|
for l < r {
|
||||||
|
for ; p < r && data[p] < data[r]; r-- {
|
||||||
|
}
|
||||||
|
if p < r {
|
||||||
|
data[p], data[r] = data[r], data[p]
|
||||||
|
p = r
|
||||||
|
}
|
||||||
|
for ; l < p && data[l] < data[p]; l++ {
|
||||||
|
}
|
||||||
|
if l < p {
|
||||||
|
data[l], data[p] = data[p], data[l]
|
||||||
|
p = l
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m.Add("append", kit.Format(level), fmt.Sprintf("%v%v", data[left:p+1], data[p+1:right+1]))
|
||||||
|
QuickSort(m, level+1, data, left, p)
|
||||||
|
QuickSort(m, level+1, data, p+1, right)
|
||||||
|
}
|
||||||
|
|
||||||
|
var Index = &ctx.Context{Name: "sort", Help: "sort code",
|
||||||
|
Configs: map[string]*ctx.Config{
|
||||||
|
"data": &ctx.Config{Name: "data", Value: map[string]interface{}{
|
||||||
|
"seed": []int{47, 59, 81, 40, 56, 0, 94, 11, 18, 25},
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
Commands: map[string]*ctx.Command{
|
||||||
|
"data": &ctx.Command{Name: "data", Help: "data", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
data := []int{}
|
||||||
|
for i := 0; i < kit.Int(kit.Select("10", arg, 0)); i++ {
|
||||||
|
data = append(data, rand.Intn(kit.Int(kit.Select("100", arg, 1))))
|
||||||
|
}
|
||||||
|
m.Confv("data", "seed", data)
|
||||||
|
m.Echo("data: %v", data)
|
||||||
|
return
|
||||||
|
}},
|
||||||
|
"select": &ctx.Command{Name: "select", Help: "select", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
data := append([]int{}, m.Confv("data", "seed").([]int)...)
|
||||||
|
|
||||||
|
m.Echo("data: %v\n", data)
|
||||||
|
for i := 0; i < len(data)-1; i++ {
|
||||||
|
for j := i + 1; j < len(data); j++ {
|
||||||
|
if data[j] < data[i] {
|
||||||
|
data[i], data[j] = data[j], data[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m.Echo("data: %d %v %v\n", i, data[:i+1], data[i+1:])
|
||||||
|
}
|
||||||
|
m.Echo("data: %v\n", data)
|
||||||
|
return
|
||||||
|
}},
|
||||||
|
"insert": &ctx.Command{Name: "insert", Help: "insert", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
data := append([]int{}, m.Confv("data", "seed").([]int)...)
|
||||||
|
|
||||||
|
m.Echo("data: %v\n", data)
|
||||||
|
for i, j := 1, 0; i < len(data); i++ {
|
||||||
|
tmp := data[i]
|
||||||
|
for j = i - 1; j >= 0; j-- {
|
||||||
|
if data[j] < tmp {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
data[j+1] = data[j]
|
||||||
|
}
|
||||||
|
data[j+1] = tmp
|
||||||
|
m.Echo("data: %d %v %v\n", i, data[:i+1], data[i+1:])
|
||||||
|
}
|
||||||
|
m.Echo("data: %v\n", data)
|
||||||
|
return
|
||||||
|
}},
|
||||||
|
"bubble": &ctx.Command{Name: "bubble", Help: "bubble", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
data := append([]int{}, m.Confv("data", "seed").([]int)...)
|
||||||
|
m.Echo("data: %v\n", data)
|
||||||
|
for i := 1; i < len(data); i++ {
|
||||||
|
finish := true
|
||||||
|
for j := 0; j < len(data)-i; j++ {
|
||||||
|
if data[j] > data[j+1] {
|
||||||
|
finish, data[j], data[j+1] = false, data[j+1], data[j]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if finish {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
m.Echo("data: %d %v %v\n", i, data[:len(data)-i], data[len(data)-i:])
|
||||||
|
}
|
||||||
|
m.Echo("data: %v\n", data)
|
||||||
|
return
|
||||||
|
}},
|
||||||
|
"quick": &ctx.Command{Name: "quick", Help: "quick", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
data := append([]int{}, m.Confv("data", "seed").([]int)...)
|
||||||
|
m.Echo("data: %v\n", data)
|
||||||
|
QuickSort(m, 0, data, 0, len(data)-1)
|
||||||
|
for i := 0; i < len(data); i++ {
|
||||||
|
meta, ok := m.Meta[kit.Format(i)]
|
||||||
|
if !ok {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
m.Echo("data: %v %v\n", i, meta)
|
||||||
|
}
|
||||||
|
m.Echo("data: %v\n", data)
|
||||||
|
return
|
||||||
|
}},
|
||||||
|
"merge": &ctx.Command{Name: "merge", Help: "merge", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
data := append([]int{}, m.Confv("data", "seed").([]int)...)
|
||||||
|
m.Echo("data: %v\n", data)
|
||||||
|
data = MergeSort(m, 0, data)
|
||||||
|
for i := 0; int(math.Exp2(float64(i))) < len(data); i++ {
|
||||||
|
meta, ok := m.Meta[kit.Format(i)]
|
||||||
|
if !ok {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
m.Echo("data: %v %v\n", i, meta)
|
||||||
|
}
|
||||||
|
m.Echo("data: %v\n", data)
|
||||||
|
return
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Print(Index.Plugin(os.Args[1:]))
|
||||||
|
}
|
6
usr/wiki/自然/编程/后端技术栈/golang.md
Normal file
6
usr/wiki/自然/编程/后端技术栈/golang.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
## golang
|
||||||
|
|
||||||
|
- 官网: <https://golang.org/>
|
||||||
|
- 文档: <https://golang.org/doc/>
|
||||||
|
- 源码: <https://dl.google.com/go/go1.11.1.src.tar.gz>
|
||||||
|
- 开源: <https://github.com/golang/go>
|
@ -0,0 +1,289 @@
|
|||||||
|
## linux
|
||||||
|
|
||||||
|
- 官网:<https://www.linux.org/>
|
||||||
|
- 文档:<https://www.kernel.org/doc/html/latest/>
|
||||||
|
- 源码:<https://mirrors.edge.kernel.org/pub/linux/kernel/v3.x/linux-3.7.4.tar.gz>
|
||||||
|
- 开源:<https://github.com/torvalds/linux>
|
||||||
|
|
||||||
|
- 代理:<https://mirror.tuna.tsinghua.edu.cn/kernel/v3.x/linux-3.7.4.tar.gz>
|
||||||
|
|
||||||
|
## 内核源码
|
||||||
|
|
||||||
|
lib
|
||||||
|
arch
|
||||||
|
init
|
||||||
|
kernel
|
||||||
|
include
|
||||||
|
drivers
|
||||||
|
ipc
|
||||||
|
net
|
||||||
|
mm
|
||||||
|
fs
|
||||||
|
|
||||||
|
firmware
|
||||||
|
security
|
||||||
|
crypto
|
||||||
|
sound
|
||||||
|
block
|
||||||
|
virt
|
||||||
|
|
||||||
|
tools
|
||||||
|
scripts
|
||||||
|
samples
|
||||||
|
Makefile
|
||||||
|
Kconfig
|
||||||
|
Kbuild
|
||||||
|
usr
|
||||||
|
|
||||||
|
README
|
||||||
|
COPYING
|
||||||
|
CREDITS
|
||||||
|
Documentation
|
||||||
|
MAINTAINERS
|
||||||
|
REPORTING-BUGS
|
||||||
|
|
||||||
|
## 系统启动
|
||||||
|
```
|
||||||
|
startup_32() // linux-2.6.12/arch/i386/kernel/head.S:57
|
||||||
|
start_kernel() // linux-2.6.12/init/main.c:424
|
||||||
|
sched_init()
|
||||||
|
trap_init() // arch/i386/kernel/traps.c
|
||||||
|
init_IRQ()
|
||||||
|
init_timers()
|
||||||
|
softirq_init()
|
||||||
|
time_init() // arch/i386/kernel/time.c
|
||||||
|
time_init_hook()
|
||||||
|
setup_irq(0, timer_interrupt)
|
||||||
|
```
|
||||||
|
|
||||||
|
## 进程调度
|
||||||
|
```
|
||||||
|
schedule()
|
||||||
|
```
|
||||||
|
|
||||||
|
## 系统中断
|
||||||
|
```
|
||||||
|
interrupt() // arch/i386/kernel/entry.S:397
|
||||||
|
do_IRQ() // arch/i386/kernel/irq.c:51
|
||||||
|
__do_IRQ() // kernel/irq/handle.c:107
|
||||||
|
handle_IRQ_event()
|
||||||
|
|
||||||
|
do_softirq() // arch/i386/kernel/softirq.c:158
|
||||||
|
__do_softirq() // kernel/softirq.c:74
|
||||||
|
|
||||||
|
tasklet_schedule() // include/linux/interrupt.h
|
||||||
|
__tasklet_schedule() // kernel/softirq.c:223
|
||||||
|
|
||||||
|
run_workqueue() // kernel/workqueue.c:145
|
||||||
|
```
|
||||||
|
|
||||||
|
## 并发同步
|
||||||
|
```
|
||||||
|
atomic_add() // include/asm-i386/atomic.h
|
||||||
|
spin_lock_irq() // include/linux/spinlock.h
|
||||||
|
down_interruptible() // include/asm-i386/semaphore.h
|
||||||
|
wait_for_completion() // kernel/sched.c
|
||||||
|
```
|
||||||
|
|
||||||
|
## 时间管理
|
||||||
|
```
|
||||||
|
timer_interrupt() // arch/i386/kernel/time.c:292
|
||||||
|
do_timer_interrupt() // arch/i386/kernel/time.c:250
|
||||||
|
do_timer_interrupt_hook()
|
||||||
|
do_timer() // kernel/timer.c:925
|
||||||
|
```
|
||||||
|
|
||||||
|
## 系统调用
|
||||||
|
```
|
||||||
|
system_call() // arch/i386/kernel/entry.S:225
|
||||||
|
sys_call_table[] // arch/i386/kernel/syscall_table.S
|
||||||
|
.long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */
|
||||||
|
.long sys_exit() // kernel/exit.c:859
|
||||||
|
do_exit()
|
||||||
|
exit_mm()
|
||||||
|
exit_sem()
|
||||||
|
__exit_files()
|
||||||
|
__exit_fs()
|
||||||
|
exit_namespace()
|
||||||
|
exit_thread()
|
||||||
|
cpuset_exit()
|
||||||
|
exit_keys()
|
||||||
|
exit_notify()
|
||||||
|
schedule()
|
||||||
|
.long sys_fork // arch/i386/kernel/process.c:645
|
||||||
|
do_fork() // kernel/fork.c:1192
|
||||||
|
copy_process()
|
||||||
|
dup_task_struct()
|
||||||
|
copy_files()
|
||||||
|
copy_fs()
|
||||||
|
copy_sighand()
|
||||||
|
copy_signal()
|
||||||
|
copy_mm()
|
||||||
|
sched_fork()
|
||||||
|
wake_up_new_task()
|
||||||
|
.long sys_read
|
||||||
|
.long sys_write
|
||||||
|
.long sys_open /* 5 */
|
||||||
|
get_unused_fd()
|
||||||
|
filp_open()
|
||||||
|
open_namei()
|
||||||
|
path_lookup()
|
||||||
|
dentry_open()
|
||||||
|
fd_install()
|
||||||
|
|
||||||
|
.long sys_close
|
||||||
|
.long sys_waitpid
|
||||||
|
.long sys_creat
|
||||||
|
.long sys_link
|
||||||
|
.long sys_unlink /* 10 */
|
||||||
|
.long sys_execve
|
||||||
|
.long sys_chdir
|
||||||
|
.long sys_time
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
## 进程管理
|
||||||
|
```
|
||||||
|
struct task_struct {
|
||||||
|
// 进程状态
|
||||||
|
state long / TASK_RUNNING // include/linux/sched.h:108
|
||||||
|
|
||||||
|
// 线程信息
|
||||||
|
thread_info *struct thread_info
|
||||||
|
task *struct task_struct
|
||||||
|
status
|
||||||
|
|
||||||
|
// 进程树
|
||||||
|
parent *struct task_struct
|
||||||
|
children struct list_head
|
||||||
|
sibling struct list_head
|
||||||
|
|
||||||
|
mm *struct mm_struct
|
||||||
|
binfmt *struct linux_binfmt
|
||||||
|
thread struct thread_struct
|
||||||
|
esp0
|
||||||
|
eip
|
||||||
|
esp
|
||||||
|
fs
|
||||||
|
gs
|
||||||
|
|
||||||
|
fs *struct fs_struct
|
||||||
|
files *struct files_struct
|
||||||
|
signal *struct signal_struct
|
||||||
|
|
||||||
|
pid pid_t
|
||||||
|
tgit pid_t
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Compile
|
||||||
|
```
|
||||||
|
linux-3.7.4/Makefile
|
||||||
|
include $(srctree)/arch/$(SRCARCH)/Makefile # linux-3.7.4/Makefile:495
|
||||||
|
```
|
||||||
|
sudo apt-get install libncurses5-dev
|
||||||
|
make defconfig
|
||||||
|
make menuconfig
|
||||||
|
make
|
||||||
|
make tags
|
||||||
|
|
||||||
|
## GCC
|
||||||
|
gcc -E hi.c -o hi.i
|
||||||
|
gcc -S hi.c
|
||||||
|
gcc -c hi.c
|
||||||
|
|
||||||
|
ar -r hi.a hi.o he.o
|
||||||
|
gcc -shared -fPIC -o hi.so hi.c he.c
|
||||||
|
gcc -L./ -lhi main.c
|
||||||
|
|
||||||
|
nm
|
||||||
|
readelf -S hi.o
|
||||||
|
objdump -d hi.o
|
||||||
|
hexdump -C hi.o
|
||||||
|
|
||||||
|
## GRUB
|
||||||
|
- 下载:<ftp://ftp.gnu.org/gnu/grub/grub-2.00.tar.gz>
|
||||||
|
BIOS MBR GRUB
|
||||||
|
|
||||||
|
## 内核启动
|
||||||
|
```
|
||||||
|
startup_32() // arch/x86/kernel/head_32.S:88
|
||||||
|
i386_start_kernel() // arch/x86/kernel/head32.c:31
|
||||||
|
start_kernel() // init/main.c:468
|
||||||
|
mm_init()
|
||||||
|
sched_init()
|
||||||
|
console_init()
|
||||||
|
signals_init()
|
||||||
|
rest_init()
|
||||||
|
kernel_thread(kernel_init)
|
||||||
|
do_fork() // kernel/fork.c:1548
|
||||||
|
copy_process()
|
||||||
|
wake_up_new_task() // kernel/sched/core.c:1622
|
||||||
|
activate_task()
|
||||||
|
enqueue_task(rq, p)
|
||||||
|
|
||||||
|
kernel_init() // init/main.c:805
|
||||||
|
run_init_process()
|
||||||
|
kernel_execve() // fs/exec.c:1710
|
||||||
|
do_execve()
|
||||||
|
do_execve_common()
|
||||||
|
open_exec()
|
||||||
|
sched_exec() // kernel/sched/core.c:2538
|
||||||
|
select_task_rq()
|
||||||
|
bprm_mm_init()
|
||||||
|
prepare_binprm()
|
||||||
|
search_binary_handler()
|
||||||
|
formats[i]->load_binary()
|
||||||
|
|
||||||
|
fair_sched_class() // kernel/sched/fair.c:5308
|
||||||
|
select_task_rq_fair()
|
||||||
|
pick_next_task_fair()
|
||||||
|
pick_next_entity()
|
||||||
|
__pick_first_entity()
|
||||||
|
rb_entry()
|
||||||
|
|
||||||
|
formats[i]->load_binary()
|
||||||
|
load_elf_binary() // fs/binfmt_elf.c:561
|
||||||
|
current->mm->start_stack
|
||||||
|
set_brk(elf_bss, elf_brk)
|
||||||
|
|
||||||
|
start_thread() // arch/x86/kernel/process_32.c:200
|
||||||
|
formats[i]->load_binary()
|
||||||
|
load_script()
|
||||||
|
bprm_change_interp()
|
||||||
|
open_exec()
|
||||||
|
prepare_binprm()
|
||||||
|
search_binary_handler()
|
||||||
|
|
||||||
|
struct task_struct { // linux-3.7.4/include/linux/sched.h:1190
|
||||||
|
mm *struct mm_struct
|
||||||
|
start_code
|
||||||
|
end_code
|
||||||
|
start_data
|
||||||
|
end_data
|
||||||
|
start_brk
|
||||||
|
brk
|
||||||
|
mmap_base
|
||||||
|
start_stack
|
||||||
|
arg_start
|
||||||
|
arg_end
|
||||||
|
env_start
|
||||||
|
env_end
|
||||||
|
|
||||||
|
thread struct thread_struct
|
||||||
|
sp0
|
||||||
|
sp
|
||||||
|
es
|
||||||
|
ds
|
||||||
|
fsindex
|
||||||
|
gsindex
|
||||||
|
ip
|
||||||
|
fs
|
||||||
|
gs
|
||||||
|
|
||||||
|
fs *struct fs_struct
|
||||||
|
files *struct files_struct
|
||||||
|
pid pid_t
|
||||||
|
tgid pit_t
|
||||||
|
}
|
||||||
|
```
|
6
usr/wiki/自然/编程/后端技术栈/mongodb.md
Normal file
6
usr/wiki/自然/编程/后端技术栈/mongodb.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
## mongodb
|
||||||
|
|
||||||
|
- 官网:<https://www.mongodb.com/>
|
||||||
|
- 文档:<https://docs.mongodb.com/>
|
||||||
|
- 源码:<https://fastdl.mongodb.org/src/mongodb-src-r4.0.9.tar.gz>
|
||||||
|
- 开源:<https://github.com/mongodb/mongo>
|
@ -1,4 +1,4 @@
|
|||||||
## 简介
|
## mysql
|
||||||
|
|
||||||
MySQL 是一个开源的关系型数据库管理系统。
|
MySQL 是一个开源的关系型数据库管理系统。
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
## 简介
|
## nginx
|
||||||
Nginx 是一个异步框架的Web服务器,也可以用作反向代理,负载均衡和HTTP缓存。
|
Nginx 是一个异步框架的Web服务器,也可以用作反向代理,负载均衡和HTTP缓存。
|
||||||
|
|
||||||
- 官网: <https://www.nginx.org/>
|
- 官网: <https://www.nginx.org/>
|
||||||
|
6
usr/wiki/自然/编程/后端技术栈/nodejs.md
Normal file
6
usr/wiki/自然/编程/后端技术栈/nodejs.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
## nodejs
|
||||||
|
|
||||||
|
- 官网:<https://nodejs.org/en/>
|
||||||
|
- 文档:<https://nodejs.org/en/docs/>
|
||||||
|
- 源码:<https://nodejs.org/dist/v10.15.3/node-v10.15.3.tar.gz>
|
||||||
|
- 开源:<https://github.com/nodejs/node>
|
@ -0,0 +1,6 @@
|
|||||||
|
## python
|
||||||
|
|
||||||
|
- 官网:<https://www.python.org/>
|
||||||
|
- 文档:<https://docs.python.org/2/>
|
||||||
|
- 源码:<https://www.python.org/ftp/python/2.7.16/Python-2.7.16.tgz>
|
||||||
|
- 开源:<https://github.com/python/cpython>
|
@ -1,4 +1,4 @@
|
|||||||
## 简介
|
## redis
|
||||||
|
|
||||||
Redis是一个使用ANSI C编写的开源、支持网络、基于内存、可持久性的键值对存储数据库。
|
Redis是一个使用ANSI C编写的开源、支持网络、基于内存、可持久性的键值对存储数据库。
|
||||||
Redis是最流行的键值对存储数据库。
|
Redis是最流行的键值对存储数据库。
|
||||||
|
@ -1,11 +1,84 @@
|
|||||||
## 简介
|
## golang
|
||||||
golang 是 google 开发的一种静态的强类型、编译型、并发型、并具有垃圾回收功能的编程语言。
|
|
||||||
|
|
||||||
- 既有编译语言的严谨与高效,又具有脚本语言的动态与灵活。
|
|
||||||
|
|
||||||
### 相关链接
|
|
||||||
- 官网: <https://golang.org/>
|
- 官网: <https://golang.org/>
|
||||||
- 源码: <https://github.com/golang>
|
- 文档: <https://golang.org/doc/>
|
||||||
|
- 源码: <https://dl.google.com/go/go1.11.1.src.tar.gz>
|
||||||
|
- 开源: <https://github.com/golang>
|
||||||
|
|
||||||
|
## 基本命令
|
||||||
|
```
|
||||||
|
run clean build install
|
||||||
|
fmt fix vet bug
|
||||||
|
mod get doc list
|
||||||
|
env help version
|
||||||
|
test tool generate
|
||||||
|
```
|
||||||
|
## 编译过程
|
||||||
|
```
|
||||||
|
main() // cmd/compile/main.go:40
|
||||||
|
gc.Main() // cmd/compile/internal/gc/main.go:130
|
||||||
|
parseFiles() // cmd/compile/internal/gc/noder.go:26
|
||||||
|
syntax.Parse() // cmd/compile/internal/syntax/syntax.go:58
|
||||||
|
p.fileOrNil() // cmd/compile/internal/syntax/parser.go:58
|
||||||
|
p.funcDeclOrNil()
|
||||||
|
p.funcBody()
|
||||||
|
p.blockStmt()
|
||||||
|
p.stmtList()
|
||||||
|
p.stmtOrNil()
|
||||||
|
p.simpleStmt()
|
||||||
|
p.exprList()
|
||||||
|
p.expr()
|
||||||
|
p.binaryExpr()
|
||||||
|
p.unaryExpr()
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
fmt
|
||||||
|
mime
|
||||||
|
text
|
||||||
|
html
|
||||||
|
image
|
||||||
|
unicode
|
||||||
|
strings
|
||||||
|
strconv
|
||||||
|
encoding
|
||||||
|
|
||||||
|
hash
|
||||||
|
math
|
||||||
|
sort
|
||||||
|
index
|
||||||
|
container
|
||||||
|
compress
|
||||||
|
archive
|
||||||
|
crypto
|
||||||
|
regexp
|
||||||
|
|
||||||
|
os
|
||||||
|
flag
|
||||||
|
path
|
||||||
|
time
|
||||||
|
errors
|
||||||
|
syscall
|
||||||
|
|
||||||
|
io
|
||||||
|
log
|
||||||
|
net
|
||||||
|
bytes
|
||||||
|
bufio
|
||||||
|
database
|
||||||
|
|
||||||
|
go
|
||||||
|
cmd
|
||||||
|
sync
|
||||||
|
debug
|
||||||
|
plugin
|
||||||
|
vendor
|
||||||
|
unsafe
|
||||||
|
expvar
|
||||||
|
runtime
|
||||||
|
context
|
||||||
|
testing
|
||||||
|
reflect
|
||||||
|
builtin
|
||||||
|
internal
|
||||||
|
|
||||||
### 源码安装
|
|
||||||
可以去官网下载各种安装包(<https://golang.org/dl/>),直接进行安装。
|
|
||||||
|
665
usr/wiki/自然/编程/终端工具链/shell.md
Normal file
665
usr/wiki/自然/编程/终端工具链/shell.md
Normal file
@ -0,0 +1,665 @@
|
|||||||
|
## shell
|
||||||
|
|
||||||
|
- 官网:<https://www.gnu.org/software/bash/>
|
||||||
|
- 文档:<https://www.gnu.org/software/bash/manual/>
|
||||||
|
- 源码:<http://ftp.gnu.org/gnu/bash/bash-4.3.30.tar.gz>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 文件管理
|
||||||
|
```
|
||||||
|
etc lib dev usr
|
||||||
|
boot proc
|
||||||
|
root home
|
||||||
|
sbin bin
|
||||||
|
var tmp run sys
|
||||||
|
opt srv mnt media
|
||||||
|
```
|
||||||
|
|
||||||
|
ls
|
||||||
|
cp
|
||||||
|
ln
|
||||||
|
mv
|
||||||
|
rm
|
||||||
|
cd
|
||||||
|
pwd
|
||||||
|
mkdir
|
||||||
|
rmdir
|
||||||
|
|
||||||
|
cat
|
||||||
|
more
|
||||||
|
less
|
||||||
|
head
|
||||||
|
tail
|
||||||
|
stat
|
||||||
|
file
|
||||||
|
hexdump
|
||||||
|
objdump
|
||||||
|
touch
|
||||||
|
|
||||||
|
## 进程管理
|
||||||
|
ps
|
||||||
|
top
|
||||||
|
kill
|
||||||
|
killall
|
||||||
|
nice
|
||||||
|
renice
|
||||||
|
|
||||||
|
## 磁盘管理
|
||||||
|
df
|
||||||
|
du
|
||||||
|
mount
|
||||||
|
umount
|
||||||
|
|
||||||
|
find
|
||||||
|
grep
|
||||||
|
sort
|
||||||
|
tar
|
||||||
|
|
||||||
|
## 网络管理
|
||||||
|
|
||||||
|
## 权限管理
|
||||||
|
/etc/passwd
|
||||||
|
/etc/shadow
|
||||||
|
/etc/skel
|
||||||
|
useradd
|
||||||
|
userdel
|
||||||
|
usermod
|
||||||
|
passwd
|
||||||
|
chpasswd
|
||||||
|
chsh
|
||||||
|
chfn
|
||||||
|
chage
|
||||||
|
groupadd
|
||||||
|
groupmod
|
||||||
|
groupdel
|
||||||
|
|
||||||
|
umask
|
||||||
|
chmod
|
||||||
|
chown
|
||||||
|
chgrp
|
||||||
|
|
||||||
|
## 环境变量
|
||||||
|
env
|
||||||
|
set
|
||||||
|
unset
|
||||||
|
export
|
||||||
|
alias
|
||||||
|
PATH
|
||||||
|
PS1
|
||||||
|
|
||||||
|
## 使用命令
|
||||||
|
```
|
||||||
|
$=
|
||||||
|
<< < | > >>
|
||||||
|
|
||||||
|
nohup & C-C C-Z fg bg trap sleep jobs
|
||||||
|
crontab inittab rc.local
|
||||||
|
```
|
||||||
|
|
||||||
|
## 脚本编程
|
||||||
|
```
|
||||||
|
#! /bin/bash
|
||||||
|
echo "hello world"
|
||||||
|
```
|
||||||
|
source
|
||||||
|
return
|
||||||
|
bash
|
||||||
|
exit
|
||||||
|
|
||||||
|
```
|
||||||
|
[ -eq -gt -lt -ne -ge -le ]
|
||||||
|
[ < <= = >= > != -z -n ]
|
||||||
|
[ -d -f -e -r -w -x -nt -ot ]
|
||||||
|
|
||||||
|
if cmd; then cmd; elif cmd; then cmd; else cmd; fi
|
||||||
|
case var in cond) cmd;; esac
|
||||||
|
|
||||||
|
IFS= for var in list; do cmd; done
|
||||||
|
while true; do cmd; done
|
||||||
|
until false; do cmd; done
|
||||||
|
break continue
|
||||||
|
|
||||||
|
$0 $1 $# $* $@ shift
|
||||||
|
OPTARG= OPTINDEX= getopts fmt var
|
||||||
|
select var in list; do cmd; done
|
||||||
|
REPLY read
|
||||||
|
|
||||||
|
function local return
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
uname
|
||||||
|
umount
|
||||||
|
touch
|
||||||
|
tar
|
||||||
|
su
|
||||||
|
sleep
|
||||||
|
sed
|
||||||
|
rm
|
||||||
|
ps
|
||||||
|
ping
|
||||||
|
netstat
|
||||||
|
mv
|
||||||
|
nano
|
||||||
|
more
|
||||||
|
lsmod
|
||||||
|
ls
|
||||||
|
ln
|
||||||
|
less
|
||||||
|
kill
|
||||||
|
gzip
|
||||||
|
grep
|
||||||
|
false
|
||||||
|
echo
|
||||||
|
dd
|
||||||
|
dmesg
|
||||||
|
date
|
||||||
|
cp
|
||||||
|
chgrp
|
||||||
|
cat
|
||||||
|
bash
|
||||||
|
sh
|
||||||
|
chmod
|
||||||
|
chown
|
||||||
|
cpio
|
||||||
|
df
|
||||||
|
dir
|
||||||
|
gunzip
|
||||||
|
hostname
|
||||||
|
lsblk
|
||||||
|
mkdir
|
||||||
|
mknod
|
||||||
|
mount
|
||||||
|
pwd
|
||||||
|
rmdir
|
||||||
|
true
|
||||||
|
which
|
||||||
|
|
||||||
|
|
||||||
|
default
|
||||||
|
alternatives
|
||||||
|
adduser.conf
|
||||||
|
|
||||||
|
bash.bashrc
|
||||||
|
|
||||||
|
dhcp
|
||||||
|
timezone
|
||||||
|
|
||||||
|
init
|
||||||
|
init.d
|
||||||
|
systemd
|
||||||
|
rc.local
|
||||||
|
rc0.d
|
||||||
|
rc1.d
|
||||||
|
rc2.d
|
||||||
|
rc3.d
|
||||||
|
rc4.d
|
||||||
|
rc5.d
|
||||||
|
rc6.d
|
||||||
|
rcS.d
|
||||||
|
|
||||||
|
fstab
|
||||||
|
fstab.aliyun_backup
|
||||||
|
fstab.aliyun_backup.xen
|
||||||
|
fstab.d
|
||||||
|
|
||||||
|
ld.so.cache
|
||||||
|
ld.so.conf
|
||||||
|
ld.so.conf.d
|
||||||
|
|
||||||
|
passwd
|
||||||
|
|
||||||
|
inputrc
|
||||||
|
ssh
|
||||||
|
ssl
|
||||||
|
shells
|
||||||
|
skel
|
||||||
|
zsh
|
||||||
|
|
||||||
|
vim
|
||||||
|
pki
|
||||||
|
terminfo
|
||||||
|
zsh_command_not_found
|
||||||
|
|
||||||
|
network
|
||||||
|
networks
|
||||||
|
host.conf
|
||||||
|
hostname
|
||||||
|
hosts
|
||||||
|
hosts.allow
|
||||||
|
hosts.deny
|
||||||
|
qemu
|
||||||
|
qemu-ifdown
|
||||||
|
qemu-ifup
|
||||||
|
|
||||||
|
cron.d
|
||||||
|
cron.daily
|
||||||
|
cron.hourly
|
||||||
|
cron.monthly
|
||||||
|
cron.weekly
|
||||||
|
crontab
|
||||||
|
|
||||||
|
apt
|
||||||
|
perl
|
||||||
|
python
|
||||||
|
python2.7
|
||||||
|
python3
|
||||||
|
python3.4
|
||||||
|
rsyslog.conf
|
||||||
|
rsyslog.d
|
||||||
|
php5
|
||||||
|
X11
|
||||||
|
apache2
|
||||||
|
mysql
|
||||||
|
|
||||||
|
apm
|
||||||
|
apparmor
|
||||||
|
apparmor.d
|
||||||
|
backup
|
||||||
|
bash_completion
|
||||||
|
bash_completion.d
|
||||||
|
bindresvport.blacklist
|
||||||
|
blkid.conf
|
||||||
|
blkid.tab
|
||||||
|
ca-certificates
|
||||||
|
ca-certificates.conf
|
||||||
|
ca-certificates.conf.dpkg-old
|
||||||
|
calendar
|
||||||
|
chatscripts
|
||||||
|
cloud
|
||||||
|
console-setup
|
||||||
|
dbus-1
|
||||||
|
debconf.conf
|
||||||
|
debian_version
|
||||||
|
deluser.conf
|
||||||
|
depmod.d
|
||||||
|
dictionaries-common
|
||||||
|
discover-modprobe.conf
|
||||||
|
discover.conf.d
|
||||||
|
dpkg
|
||||||
|
drirc
|
||||||
|
emacs
|
||||||
|
environment
|
||||||
|
fonts
|
||||||
|
fuse.conf
|
||||||
|
gai.conf
|
||||||
|
gdb
|
||||||
|
groff
|
||||||
|
group
|
||||||
|
group-
|
||||||
|
grub.d
|
||||||
|
gshadow
|
||||||
|
gshadow-
|
||||||
|
hdparm.conf
|
||||||
|
initramfs-tools
|
||||||
|
insserv
|
||||||
|
insserv.conf
|
||||||
|
insserv.conf.d
|
||||||
|
iproute2
|
||||||
|
iscsi
|
||||||
|
issue
|
||||||
|
issue.net
|
||||||
|
kbd
|
||||||
|
kernel
|
||||||
|
kernel-img.conf
|
||||||
|
ldap
|
||||||
|
legal
|
||||||
|
libaudit.conf
|
||||||
|
libnl-3
|
||||||
|
locale.alias
|
||||||
|
localtime
|
||||||
|
logcheck
|
||||||
|
login.defs
|
||||||
|
logrotate.conf
|
||||||
|
logrotate.d
|
||||||
|
lsb-release
|
||||||
|
ltrace.conf
|
||||||
|
lynx-cur
|
||||||
|
magic
|
||||||
|
magic.mime
|
||||||
|
mailcap
|
||||||
|
mailcap.order
|
||||||
|
manpath.config
|
||||||
|
mime.types
|
||||||
|
mke2fs.conf
|
||||||
|
modprobe.d
|
||||||
|
modules
|
||||||
|
motd
|
||||||
|
mtab
|
||||||
|
nanorc
|
||||||
|
newt
|
||||||
|
nscd.conf
|
||||||
|
nsswitch.conf
|
||||||
|
ntp.conf
|
||||||
|
ntp.conf.backup
|
||||||
|
opt
|
||||||
|
os-release
|
||||||
|
pam.conf
|
||||||
|
pam.d
|
||||||
|
passwd-
|
||||||
|
pm
|
||||||
|
popularity-contest.conf
|
||||||
|
ppp
|
||||||
|
profile
|
||||||
|
profile.d
|
||||||
|
protocols
|
||||||
|
pulse
|
||||||
|
resolv.conf
|
||||||
|
resolvconf
|
||||||
|
rmt
|
||||||
|
rpc
|
||||||
|
securetty
|
||||||
|
security
|
||||||
|
selinux
|
||||||
|
sensors.d
|
||||||
|
sensors3.conf
|
||||||
|
services
|
||||||
|
sgml
|
||||||
|
shadow
|
||||||
|
shadow-
|
||||||
|
subgid
|
||||||
|
subgid-
|
||||||
|
subuid
|
||||||
|
subuid-
|
||||||
|
sudoers
|
||||||
|
sudoers.d
|
||||||
|
sysctl.conf
|
||||||
|
sysctl.d
|
||||||
|
sysstat
|
||||||
|
ucf.conf
|
||||||
|
udev
|
||||||
|
ufw
|
||||||
|
update-manager
|
||||||
|
update-motd.d
|
||||||
|
updatedb.conf
|
||||||
|
upstart-xsessions
|
||||||
|
vtrgb
|
||||||
|
wgetrc
|
||||||
|
xml
|
||||||
|
|
||||||
|
bunzip2
|
||||||
|
busybox
|
||||||
|
bzcat
|
||||||
|
bzcmp
|
||||||
|
bzdiff
|
||||||
|
bzegrep
|
||||||
|
bzexe
|
||||||
|
bzfgrep
|
||||||
|
bzgrep
|
||||||
|
bzip2
|
||||||
|
bzip2recover
|
||||||
|
bzless
|
||||||
|
bzmore
|
||||||
|
chacl
|
||||||
|
chvt
|
||||||
|
dash
|
||||||
|
dbus-cleanup-sockets
|
||||||
|
dbus-daemon
|
||||||
|
dbus-uuidgen
|
||||||
|
dnsdomainname
|
||||||
|
domainname
|
||||||
|
dumpkeys
|
||||||
|
ed
|
||||||
|
egrep
|
||||||
|
fgconsole
|
||||||
|
fgrep
|
||||||
|
findmnt
|
||||||
|
fuser
|
||||||
|
fusermount
|
||||||
|
getfacl
|
||||||
|
gzexe
|
||||||
|
ip
|
||||||
|
kbd_mode
|
||||||
|
kmod
|
||||||
|
lessecho
|
||||||
|
lessfile
|
||||||
|
lesskey
|
||||||
|
lesspipe
|
||||||
|
loadkeys
|
||||||
|
login
|
||||||
|
loginctl
|
||||||
|
lowntfs-3g
|
||||||
|
mktemp
|
||||||
|
mountpoint
|
||||||
|
mt
|
||||||
|
mt-gnu
|
||||||
|
nc
|
||||||
|
nc.openbsd
|
||||||
|
nc.traditional
|
||||||
|
netcat
|
||||||
|
nisdomainname
|
||||||
|
ntfs-3g
|
||||||
|
ntfs-3g.probe
|
||||||
|
ntfs-3g.secaudit
|
||||||
|
ntfs-3g.usermap
|
||||||
|
ntfscat
|
||||||
|
ntfsck
|
||||||
|
ntfscluster
|
||||||
|
ntfscmp
|
||||||
|
ntfsdump_logfile
|
||||||
|
ntfsfix
|
||||||
|
ntfsinfo
|
||||||
|
ntfsls
|
||||||
|
ntfsmftalloc
|
||||||
|
ntfsmove
|
||||||
|
ntfstruncate
|
||||||
|
ntfswipe
|
||||||
|
open
|
||||||
|
openvt
|
||||||
|
pidof
|
||||||
|
ping6
|
||||||
|
plymouth
|
||||||
|
plymouth-upstart-bridge
|
||||||
|
rbash
|
||||||
|
readlink
|
||||||
|
red
|
||||||
|
rnano
|
||||||
|
run-parts
|
||||||
|
running-in-container
|
||||||
|
rzsh
|
||||||
|
setfacl
|
||||||
|
setfont
|
||||||
|
setupcon
|
||||||
|
sh.distrib
|
||||||
|
ss
|
||||||
|
static-sh
|
||||||
|
stty
|
||||||
|
sync
|
||||||
|
tailf
|
||||||
|
tempfile
|
||||||
|
udevadm
|
||||||
|
ulockmgr_server
|
||||||
|
uncompress
|
||||||
|
unicode_start
|
||||||
|
vdir
|
||||||
|
whiptail
|
||||||
|
ypdomainname
|
||||||
|
zcat
|
||||||
|
zcmp
|
||||||
|
zdiff
|
||||||
|
zegrep
|
||||||
|
zfgrep
|
||||||
|
zforce
|
||||||
|
zgrep
|
||||||
|
zless
|
||||||
|
zmore
|
||||||
|
znew
|
||||||
|
zsh
|
||||||
|
zsh5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fdisk
|
||||||
|
fsck
|
||||||
|
halt
|
||||||
|
ifconfig
|
||||||
|
ldconfig
|
||||||
|
lsmod
|
||||||
|
mkfs
|
||||||
|
modinfo
|
||||||
|
reboot
|
||||||
|
rmmod
|
||||||
|
route
|
||||||
|
shutdown
|
||||||
|
modprobe
|
||||||
|
ifdown
|
||||||
|
ifquery
|
||||||
|
ifup
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
MAKEDEV
|
||||||
|
acpi_available
|
||||||
|
agetty
|
||||||
|
apm_available
|
||||||
|
apparmor_parser
|
||||||
|
badblocks
|
||||||
|
biosdevname
|
||||||
|
blkid
|
||||||
|
blockdev
|
||||||
|
bridge
|
||||||
|
capsh
|
||||||
|
cfdisk
|
||||||
|
crda
|
||||||
|
ctrlaltdel
|
||||||
|
debugfs
|
||||||
|
depmod
|
||||||
|
dhclient
|
||||||
|
dhclient-script
|
||||||
|
discover
|
||||||
|
discover-modprobe
|
||||||
|
discover-pkginstall
|
||||||
|
dmsetup
|
||||||
|
dosfsck
|
||||||
|
dosfslabel
|
||||||
|
dumpe2fs
|
||||||
|
e2fsck
|
||||||
|
e2image
|
||||||
|
e2label
|
||||||
|
e2undo
|
||||||
|
fatlabel
|
||||||
|
findfs
|
||||||
|
fsck.cramfs
|
||||||
|
fsck.ext2
|
||||||
|
fsck.ext3
|
||||||
|
fsck.ext4
|
||||||
|
fsck.ext4dev
|
||||||
|
fsck.fat
|
||||||
|
fsck.minix
|
||||||
|
fsck.msdos
|
||||||
|
fsck.nfs
|
||||||
|
fsck.vfat
|
||||||
|
fsfreeze
|
||||||
|
fstab-decode
|
||||||
|
fstrim
|
||||||
|
fstrim-all
|
||||||
|
getcap
|
||||||
|
getpcaps
|
||||||
|
getty
|
||||||
|
hdparm
|
||||||
|
hwclock
|
||||||
|
init
|
||||||
|
initctl
|
||||||
|
insmod
|
||||||
|
installkernel
|
||||||
|
ip
|
||||||
|
ip6tables
|
||||||
|
ip6tables-apply
|
||||||
|
ip6tables-restore
|
||||||
|
ip6tables-save
|
||||||
|
ipmaddr
|
||||||
|
iptables
|
||||||
|
iptables-apply
|
||||||
|
iptables-restore
|
||||||
|
iptables-save
|
||||||
|
iptunnel
|
||||||
|
isosize
|
||||||
|
kbdrate
|
||||||
|
killall5
|
||||||
|
ldconfig.real
|
||||||
|
logsave
|
||||||
|
losetup
|
||||||
|
mii-tool
|
||||||
|
mkdosfs
|
||||||
|
mke2fs
|
||||||
|
mkfs.bfs
|
||||||
|
mkfs.cramfs
|
||||||
|
mkfs.ext2
|
||||||
|
mkfs.ext3
|
||||||
|
mkfs.ext4
|
||||||
|
mkfs.ext4dev
|
||||||
|
mkfs.fat
|
||||||
|
mkfs.minix
|
||||||
|
mkfs.msdos
|
||||||
|
mkfs.ntfs
|
||||||
|
mkfs.vfat
|
||||||
|
mkhomedir_helper
|
||||||
|
mkntfs
|
||||||
|
mkswap
|
||||||
|
mntctl
|
||||||
|
mount.fuse
|
||||||
|
mount.lowntfs-3g
|
||||||
|
mount.ntfs
|
||||||
|
mount.ntfs-3g
|
||||||
|
mountall
|
||||||
|
nameif
|
||||||
|
ntfsclone
|
||||||
|
ntfscp
|
||||||
|
ntfslabel
|
||||||
|
ntfsresize
|
||||||
|
ntfsundelete
|
||||||
|
on_ac_power
|
||||||
|
pam_tally
|
||||||
|
pam_tally2
|
||||||
|
parted
|
||||||
|
partprobe
|
||||||
|
pivot_root
|
||||||
|
plipconfig
|
||||||
|
plymouthd
|
||||||
|
poweroff
|
||||||
|
rarp
|
||||||
|
raw
|
||||||
|
regdbdump
|
||||||
|
reload
|
||||||
|
resize2fs
|
||||||
|
resolvconf
|
||||||
|
restart
|
||||||
|
rtacct
|
||||||
|
rtmon
|
||||||
|
runlevel
|
||||||
|
setcap
|
||||||
|
setvtrgb
|
||||||
|
sfdisk
|
||||||
|
shadowconfig
|
||||||
|
slattach
|
||||||
|
start
|
||||||
|
start-stop-daemon
|
||||||
|
startpar
|
||||||
|
startpar-upstart-inject
|
||||||
|
status
|
||||||
|
stop
|
||||||
|
sulogin
|
||||||
|
swaplabel
|
||||||
|
swapoff
|
||||||
|
swapon
|
||||||
|
switch_root
|
||||||
|
sysctl
|
||||||
|
tc
|
||||||
|
telinit
|
||||||
|
tune2fs
|
||||||
|
udevadm
|
||||||
|
udevd
|
||||||
|
unix_chkpwd
|
||||||
|
unix_update
|
||||||
|
upstart-dbus-bridge
|
||||||
|
upstart-event-bridge
|
||||||
|
upstart-file-bridge
|
||||||
|
upstart-local-bridge
|
||||||
|
upstart-socket-bridge
|
||||||
|
upstart-udev-bridge
|
||||||
|
ureadahead
|
||||||
|
wipefs
|
||||||
|
xtables-multi
|
55
usr/wiki/自然/计算机/数据结构/index.md
Normal file
55
usr/wiki/自然/计算机/数据结构/index.md
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
## 数据结构
|
||||||
|
逻辑结构:集合结构、线性结构、树状结构、图形结构
|
||||||
|
|
||||||
|
存储结构:散列、数组、链表、索引
|
||||||
|
|
||||||
|
数据操作:查找、排序
|
||||||
|
|
||||||
|
算法复杂度:
|
||||||
|
|
||||||
|
- 常数阶O(1)
|
||||||
|
- 线性阶O(n)
|
||||||
|
- 平方阶O(n<sup>2</sup>)
|
||||||
|
- 对数阶O(log n)
|
||||||
|
|
||||||
|
## 线性结构
|
||||||
|
### 线性表
|
||||||
|
#### 顺序表
|
||||||
|
#### 单链表
|
||||||
|
#### 双链表
|
||||||
|
#### 双向链表
|
||||||
|
### 栈
|
||||||
|
#### 顺序栈
|
||||||
|
#### 链接栈
|
||||||
|
### 队列
|
||||||
|
#### 循环队列
|
||||||
|
#### 链式队列
|
||||||
|
### 串
|
||||||
|
|
||||||
|
## 树状结构
|
||||||
|
### 二叉树
|
||||||
|
#### 二叉树性质
|
||||||
|
#### 二叉树存储
|
||||||
|
#### 二叉树遍历
|
||||||
|
|
||||||
|
## 图形结构
|
||||||
|
### 图的性质
|
||||||
|
### 图的存储
|
||||||
|
### 图的遍历
|
||||||
|
|
||||||
|
## 算法分析
|
||||||
|
### 查找算法
|
||||||
|
#### 二分查找
|
||||||
|
#### 查找二叉树
|
||||||
|
#### 平衡二叉树
|
||||||
|
#### 红黑二叉树
|
||||||
|
#### B树
|
||||||
|
#### B+树
|
||||||
|
### 排序算法
|
||||||
|
#### 冒泡排序
|
||||||
|
#### 选择排序
|
||||||
|
#### 插入排序
|
||||||
|
#### 归并排序
|
||||||
|
#### 希尔排序
|
||||||
|
#### 桶排序
|
||||||
|
#### 快速排序
|
Loading…
x
Reference in New Issue
Block a user