热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

使用SR替代LDP,配置ospfshamlink

免责声明:1.本文所使用的软件均来自互联网,作者只为学习目的使用该软件,没有任何软件分发行为。2.本文所展示的配置只适用于实验环境,不建议在生产环境使用完全相同的配置;由此导致的任
免责声明:

1.本文所使用的软件均来自互联网,作者只为学习目的使用该软件,没有任何软件分发行为。

2.本文所展示的配置只适用于实验环境,不建议在生产环境使用完全相同的配置;由此导致的任何问题,作者不负任何责任。

实验拓扑

技术图片

IP地址规划

设备 Loopback 0 Loopback 1 G1 G2
CSR1 11.1.1.1/32 11.1.1.2/32 172.16.0.1/30 14.1.1.1/30
CSS2 22.1.1.1/32 -- 172.16.0.2/30 172.16.0.6/30
xrv 33.1.1.1/32 33.1.1.2/32 G0/0/0/2 172.16.0.5/30 G0/0/0/0 35.1.1.1/30
vIOS4 44.1.1.1/32 -- G0/0 14.1.1.2/30 G0/1 45.1.1.1/30
vIOS5 55.1.1.1/32 -- G0/0 35.1.1.2/30 G0/1 45.1.1.2/30

设备型号及软件版本

设备 平台 软件版本
vIOS4、vIOS5 VIOS-ADVENTERPRISEK9-M 15.6(2)T
CSR1, CSR2 X86_64_LINUX_IOSD-UNIVERSALK9-M 16.6.2
XRv ASR9000 IOS-XR 6.0.1

目标

1. CSR1, CSR2和xrv配置 IS-IS协议作为底层IGP,在此基础上配置segment-routing。

2. CSR1和xrv作为PE设备,配置×××v4 BGP邻居,AS号64512。

3. CSR1和vIOS4配置单区域OSPFv2,进程ID 2019;xrv与vIOS5配置单区域OSPFv2,进程ID 2019;PE设备配置OSPFv2和MP-BGP双向重分布。

4. CSR1和xrv配置loopback 1接口,将该接口划分为客户VRF下,并在MP-BGP进程,客户VRF下宣告主机路由。

5. CSR1和xrv的OSPFv2配置sham-link


配置步骤

MPLS ×××基本配置步骤:

1.配置IGP,

2.配置MPLS(segment-routing),

3.配置MP-BGP,

4.配置VRF,

5.配置PE-CE路由协议,

6.PE 配置MP-BGP和VRF路由重分布。


IOS-XE和IOS-XR配置IGP(IS-IS)

设备接口IP地址配置(略)

  • XEv3

router isis igp
is-type level-2-only !---配置ISIS为骨干区域
net 49.2019.0519.0001.00
log-adjacency-changes !---记录邻接log信息
metric-style wide !---使能isis宽度量
exit
interface Loopback0
ip router isis igp
interface GigabitEthernet1
ip router isis igp
isis circuit-type level-2-only !---修改链路为level-2
isis network point-to-point !---修改ISIS网络类型

  • XRv4

router isis igp
is-type level-2-only
net 49.2019.0519.0003.00
log adjacency changes
address-family ipv4 unicast
metric-style wide
interface Loopback0
address-family ipv4 unicast
interface GigabitEthernet0/0/0/0
address-family ipv4 unicast
circuit-type level-2-only
point-to-point
commit

2 验证IS-IS

CSR2#show ip route isis | b bn
11.0.0.0/32 is subnetted, 1 subnets
i L2 11.1.1.1 [115/20] via 172.16.0.1, 1d00h, GigabitEthernet1
33.0.0.0/32 is subnetted, 1 subnets
i L2 33.1.1.1 [115/20] via 172.16.0.5,19:06:28, GigabitEthernet2
RP/0/0/CPU0:xrv#show route ipv4 isis
i L2 11.1.1.1/32 [115/30] via 172.16.0.6, 19:11:15, GigabitEthernet0/0/0/2
i L2 22.1.1.1/32 [115/20] via 172.16.0.6, 19:11:15, GigabitEthernet0/0/0/2
i L2 172.16.0.0/30 [115/20] via 172.16.0.6, 19:11:15, GigabitEthernet0/0/0/2

3 配置MPLS(segment-routing)

  • XEv3

    segment-routing mpls
    connected-prefix-sid-map
    address-family ipv4
    11.1.1.1/32 index 1 range 1
    exit-address-family
    router isis igp
    segment-routing mpls

  • XRv4

    segment-routing
    router isis igp
    address-family ipv4 unicast
    metric-style wide
    segment-routing mpls
    interface Loopback0
    address-family ipv4 unicast
    prefix-sid index 33
    commit

4 验证MPLS

CSR1#show mpls forwarding-table
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
16 Pop Label 172.16.0.2-A 0 Gi1 172.16.0.2
21 Pop Label 11.1.1.2/32[V] 0 aggregate/ospf
16022 Pop Label 22.1.1.1/32 0 Gi1 172.16.0.2
16033 16033 33.1.1.1/32 0 Gi1 172.16.0.2

RP/0/0/CPU0:xrv#show mpls forwarding
Local Outgoing Prefix Outgoing Next Hop Bytes
Label Label or ID Interface Switched


16011 16011 SR Pfx (idx 11) Gi0/0/0/2 172.16.0.6 208166
16022 Pop SR Pfx (idx 22) Gi0/0/0/2 172.16.0.6 0
24006 Pop SR Adj (idx 1) Gi0/0/0/2 172.16.0.6 0
24007 Pop SR Adj (idx 3) Gi0/0/0/2 172.16.0.6 0

5 配置MP-BGP

  • CSR1

    router bgp 64512
    bgp router-id 11.1.1.1
    no bgp default ipv4-unicast
    neighbor 33.1.1.1 remote-as 64512
    neighbor 33.1.1.1 update-source Loopback0
    address-family ***v4
     neighbor 33.1.1.1 activate

  • xrv

    router bgp 64512
    bgp router-id 33.1.1.1
    address-family v4 unicast
    neighbor 11.1.1.1
     remote-as 64512
     update-source Loopback0
     address-family
    v4 unicast
    commit

  • 验证如下:

    CSR1#show bgp ***v4 unicast all sum | b gh
    Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
    33.1.1.1 4 64512 1254 1429 315 0 0 20:17:43 4

    RP/0/0/CPU0:xrv#show bgp ***v4 unicast summary | b gh
    Neighbor Spk AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down St/PfxRcd
    11.1.1.1 0 64512 1890 1674 249 0 0 20:18:04 4

6 配置VRF and PE-CE routing protocol

6.1定义VRF

  • CSR1

    vrf definition AAA
    rd 64512:4
    address-family ipv4
    route-target export 64512:45
    route-target import 64512:45
    exit-address-family

  • xrv

    vrf AAA
    address-family ipv4 unicast
    import route-target
    64512:45
    export route-target
    64512:45

6.2 PE to CE Interface config

  • CSR1

    interface GigabitEthernet2
    vrf forwarding AAA
    ip address 14.1.1.1 255.255.255.252
    no shutdown

  • xrv

    interface GigabitEthernet0/0/0/0
    vrf AAA
    ipv4 address 35.1.1.1 255.255.255.252
    no shutdown

6.3 PE OSPFv2 config

  • CSR1

    router ospf 2019 vrf AAA
    router-id 14.1.1.1
    interface GigabitEthernet2
    ip ospf network point-to-point
    ip ospf 14 area 0

  • xrv

    router ospf 35
    address-family ipv4 unicast
    vrf AAA
    router-id 35.1.1.1
    address-family ipv4 unicast
    area 0
    interface GigabitEthernet0/0/0/0
    network point-to-point

6.4 CE OSPFv2 config

  • vIOS4

    interface GigabitEthernet0/0
    ip address 14.1.1.2 255.255.255.252
    no shutdown
    ip ospf 2019 area 0
    ip ospf network point-to-point
    router ospf 2019
    router-id 44.1.1.1

  • vIOS5

    interface GigabitEthernet0/0
    ipv4 address 35.1.1.2 255.255.255.252
    no shutdown
    ip ospf 2019 area 0
    ip ospf network point-to-point
    router ospf 2019
    router-id 55.1.1.1

6.5 PE OSPFv2 and MP-BGP redistribute

  • CSR1

    router ospf 14 vrf AAA
    redistribute bgp 64512 metric-type 1 subnets
    interface GigabitEthernet2
    router bgp 64512
    address-family ipv4 vrf AAA
    redistribute ospf 14 match internal external 1 external 2

  • xrv

    router ospf 35
    vrf AAA
    redistribute bgp 64512 metric-type 1
    router bgp 64512
    vrf AAA
    rd 64512:5
    address-family ipv4 unicast
    redistribute ospf 35 match internal external

6.6 验证PE-CE OSPFv2配置

CSR1#show ip route vrf AAA ospf | b bn
35.0.0.0/30 is subnetted, 1 subnets
O 35.1.1.0 [110/2] via 33.1.1.1, 00:00:32
44.0.0.0/32 is subnetted, 1 subnets
O 44.1.1.1 [110/2] via 14.1.1.2, 00:00:34, GigabitEthernet2
45.0.0.0/29 is subnetted, 1 subnets
O IA 45.1.1.0 [110/20001] via 14.1.1.2, 00:00:34, GigabitEthernet2

vIOS4#sho ip route ospf | b bn
35.0.0.0/30 is subnetted, 1 subnets
O E1 35.1.1.0 [110/2] via 14.1.1.1, 00:23:54, GigabitEthernet0/0
55.0.0.0/32 is subnetted, 1 subnets
O E1 55.1.1.1 [110/3] via 14.1.1.1, 00:23:54, GigabitEthernet0/0

vIOS4#ping 55.1.1.1 sour lo 0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 55.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 44.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 11/15/33 ms
vIOS4#traceroute 55.1.1.1 sour lo 0
Type escape sequence to abort.
Tracing the route to 55.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 14.1.1.1 8 msec 5 msec 3 msec
2 172.16.0.2 [MPLS: Labels 16033/24003 Exp 0] 19 msec 25 msec 10 msec
3 172.16.0.5 [MPLS: Label 24003 Exp 0] 13 msec 12 msec 8 msec
4 35.1.1.2 12 msec 19 msec *
vIOS4#

CSR1#sho bgp *v4 uni all 44.1.1.1
BGP routing table entry for 64512:4:44.1.1.1/32, version 383
Paths: (1 available, best #1, table AAA)
Advertised to update-groups:
5
Refresh Epoch 1
Local
14.1.1.2 (via vrf ospf) from 0.0.0.0 (11.1.1.1)
Origin incomplete, metric 2, localpref 100, weight 32768, valid, sourced, best
Extended Community: RT:64512:45 OSPF DOMAIN ID:0x0005:0x0000000
E0200
OSPF RT:0.0.0.0:2:0 OSPF ROUTER ID:14.1.1.1:0
mpls labels in/out 23/nolabel
rx pathid: 0, tx pathid: 0x0
!--- DOMAIN ID:0x0005:0x0000000E0200 16进制
E=10进制14**(CSR1 ospfv2 进程ID)

6.7 修改/添加ospfv2 DOMAIN ID

  • IOS-XR默认不携带DOMAIN ID值

    RP/0/0/CPU0:xrv#show bgp ***v4 uni vrf ospf 55.1.1.1/32
    BGP routing table entry for 55.1.1.1/32, Route Distinguisher: 64512:5
    Versions:
    Process bRIB/RIB SendTblVer
    Speaker 345 345
    Local Label: 24003
    Last Modified: May 22 02:21:42.463 for 06:05:44
    Paths: (1 available, best #1)
    Advertised to peers (in unique update groups):
    11.1.1.1
    Path #1: Received by speaker 0
    Advertised to peers (in unique update groups):
    11.1.1.1
    Local
    35.1.1.2 from 0.0.0.0 (33.1.1.1)
    Origin incomplete, metric 2, localpref 100, weight 32768, valid, redistributed, best, group-best, import-candidate
    Received Path ID 0, Local Path ID 1, version 345
    Extended community: OSPF route-type:0:1:0x0 OSPF router-id:35.1.1.1 RT:64512:45

    CSR1#show bgp ***v4 uni vrf AAA 55.1.1.1/32
    BGP routing table entry for 64512:4:55.1.1.1/32, version 417
    Paths: (1 available, best #1, table ospf, RIB-failure(17))
    Not advertised to any peer
    Refresh Epoch 1
    Local, imported path from 64512:5:55.1.1.1/32 (global)
    33.1.1.1 (metric 30) (via default) from 33.1.1.1 (33.1.1.1)
    Origin incomplete, metric 2, localpref 100, valid, internal, best
    Extended Community: RT:64512:45 OSPF RT:0.0.0.0:1:0
    OSPF ROUTER ID:35.1.1.1:0
    mpls labels in/out nolabel/24003
    rx pathid: 0, tx pathid: 0x0

  • 在IOS-XR设备添加DOMAIN ID

    RP/0/0/CPU0:xrv#conf
    RP/0/0/CPU0:xrv(config)#router ospf 35
    RP/0/0/CPU0:xrv(config-ospf)#vrf AAA
    RP/0/0/CPU0:xrv(config-ospf-vrf)#domain-id type 0005 value 000000230200
    RP/0/0/CPU0:xrv(config-ospf-vrf)#commit
    !--- 23(hex)=35(dec)
    RP/0/0/CPU0:xrv(config-ospf-vrf)#do show bgp ***v4 uni vrf ospf 55.1.1.1/32 | in community
    Wed May 22 09:38:03.422 UTC
    Extended community: OSPF domain-id:0x5:0x000000230200 OSPF route-type:0:1:0x0 OSPF router-id:35.1.1.1 RT:64512:45

    CSR1#show bgp ***v4 uni vrf ospf 55.1.1.1/32 | i unity
    Extended Community: RT:64512:45 OSPF DOMAIN ID:0x0005:0x000000230200

6.8 配置CE之间的backdoor link

  • vIOS5

    interface GigabitEthernet0/1
    ip address 45.1.1.5 255.255.255.248
    ip ospf network point-to-point
    ip ospf 2019 area 45
    ip ospf cost 20000
    !---模拟×××链路故障,在vIOS5上手工shutdown链路
    vIOS5(config-if)#int g0/0
    vIOS5(config-if)#shu
    May 20 10:17:09.190: %OSPF-5-ADJCHG: Process 2019, Nbr 35.1.1.1 on GigabitEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
    May 20 10:17:11.136: %LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to administratively down
    May 20 10:17:12.137: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to down
    vIOS5(config-if)#
    vIOS5(config-if)#do sho ip route ospf | b bn
    14.0.0.0/30 is subnetted, 1 subnets
    O IA 14.1.1.0 [110/20001] via 45.1.1.4, 00:00:33, GigabitEthernet0/1
    35.0.0.0/30 is subnetted, 1 subnets
    O 35.1.1.0 [110/20003] via 45.1.1.4, 00:00:33, GigabitEthernet0/1
    44.0.0.0/32 is subnetted, 1 subnets
    O IA 44.1.1.1 [110/20001] via 45.1.1.4, 00:00:33, GigabitEthernet0/1
    vIOS5(config-if)#
    !---在vIOS4上查看ospf路由
    vIOS4#sho ip route ospf | b bn
    35.0.0.0/30 is subnetted, 1 subnets
    O IA 35.1.1.0 [110/3] via 14.1.1.1, 00:09:31, GigabitEthernet0/0
    55.0.0.0/32 is subnetted, 1 subnets
    O IA 55.1.1.1 [110/4] via 14.1.1.1, 00:09:31, GigabitEthernet0/0
    vIOS4#sho ip route ospf | b bn
    35.0.0.0/30 is subnetted, 1 subnets
    O IA 35.1.1.0 [110/3] via 14.1.1.1, 00:11:41, GigabitEthernet0/0
    55.0.0.0/32 is subnetted, 1 subnets
    O IA 55.1.1.1 [110/20001] via 45.1.1.5, 00:00:05, GigabitEthernet0/1
    !---恢复链路
    vIOS5(config-if)#no shu
    May 20 10:18:48.972: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
    May 20 10:18:49.971: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
    May 20 10:19:04.220: %OSPF-5-ADJCHG: Process 2019, Nbr 35.1.1.1 on GigabitEthernet0/0 from LOADING to FULL, Loading Done

    vIOS4#sho ip route ospf | b bn
    35.0.0.0/30 is subnetted, 1 subnets
    O IA 35.1.1.0 [110/3] via 14.1.1.1, 00:14:48, GigabitEthernet0/0
    55.0.0.0/32 is subnetted, 1 subnets
    O IA 55.1.1.1 [110/4] via 14.1.1.1, 00:01:18, GigabitEthernet0/0

6.9 配置OSPFv2 sham-link

6.9.1 Config loopback 1 and propaganda into BGP VRF address-family IPv4

  • CSR1

    interface Loopback1
    vrf forwarding ospf
    ipv4 address 11.1.1.2 255.255.255.255
    router bgp 64512
    address-family ipv4 vrf AAA
    network 11.1.1.2 mask 255.255.255.255

  • xrv

    interface Loopback1
    vrf AAA
    ipv4 address 33.1.1.2 255.255.255.255
    router bgp 64512
    vrf AAA
    address-family ipv4 unicast
    network 33.1.1.2/32

6.9.2 Under OSPFv2 process config sham-link

  • CSR1

    router ospf 14 vrf AAA
    area 0 sham-link 11.1.1.2 33.1.1.2 cost 200

  • xrv

    router ospf 35
    vrf AAA
    address-family ipv4 unicast
    area 0
    sham-link 33.1.1.2 11.1.1.2
    cost 200

6.10 验证sham-ink

CSR1(config-router)#area 0 sham-link 11.1.1.2 33.1.1.2 cost 200
CSR1(config-router)#do sho ip ospf neig
*May 22 08:45:02.593: %OSPF-5-ADJCHG: Process 14, Nbr 35.1.1.1 on OSPF_SL3 from LOADING to FULL, Loading Done
Neighbor ID Pri State Dead Time Address Interface
35.1.1.1 0 FULL/ - 00:00:37 33.1.1.2 OSPF_SL3
44.1.1.1 0 FULL/ - 00:00:34 14.1.1.2 GigabitEthernet2

CSR1#show ip route vrf AAA ospf | b bn
35.0.0.0/30 is subnetted, 1 subnets
O 35.1.1.0 [110/201] via 33.1.1.1, 01:04:13
44.0.0.0/32 is subnetted, 1 subnets
O 44.1.1.1 [110/2] via 14.1.1.2, 01:05:46, GigabitEthernet2
45.0.0.0/29 is subnetted, 1 subnets
O IA 45.1.1.0 [110/20001] via 14.1.1.2, 01:05:46, GigabitEthernet2
55.0.0.0/32 is subnetted, 1 subnets
O 55.1.1.1 [110/202] via 33.1.1.1, 01:04:13
vIOS4#sho ip route ospf | b bn
11.0.0.0/32 is subnetted, 1 subnets
O E1 11.1.1.2 [110/2] via 14.1.1.1, 01:06:20, GigabitEthernet0/0
33.0.0.0/32 is subnetted, 1 subnets
O E1 33.1.1.2 [110/2] via 14.1.1.1, 01:06:20, GigabitEthernet0/0
35.0.0.0/30 is subnetted, 1 subnets
O 35.1.1.0 [110/202] via 14.1.1.1, 01:04:42, GigabitEthernet0/0
55.0.0.0/32 is subnetted, 1 subnets
O 55.1.1.1 [110/203] via 14.1.1.1, 01:04:42, GigabitEthernet0/0

6.11 隐藏sham-link地址

  • CSR1:

    ip prefix-list conn seq 5 permit 11.1.1.2/32
    ip prefix-list conn seq 10 permit 33.1.1.2/32
    route-map deny-conn deny 10
    match ip address prefix-list conn
    route-map deny-conn permit 20
    CSR1(config-router-af)#router ospf 14 vrf ospf
    CSR1(config-router)#redis bgp 64512 subnets route-map deny-conn

  • xrv:

    prefix-set conn
    11.1.1.2/32,
    33.1.1.2/32
    end-set

    route-policy deny-conn
    if destination in conn then
    drop
    else
    pass
    endif
    end-policy

    RP/0/0/CPU0:xrv(config)#router ospf 35
    RP/0/0/CPU0:xrv(config-ospf)#vrf ospf
    RP/0/0/CPU0:xrv(config-ospf-vrf)#redist bgp 64512 route-policy deny-conn
    RP/0/0/CPU0:xrv(config-ospf-vrf)#commit

    vIOS5#sho ip route ospf | b bn
    14.0.0.0/30 is subnetted, 1 subnets
    O 14.1.1.0 [110/202] via 35.1.1.1, 00:07:05, GigabitEthernet0/0
    44.0.0.0/32 is subnetted, 1 subnets
    O 44.1.1.1 [110/203] via 35.1.1.1, 00:07:05, GigabitEthernet0/0
    CE设备看不到sham-link地址

使用SR替代LDP,配置ospf sham-link


推荐阅读
  • 在project.properties添加#Projecttarget.targetandroid-19android.library.reference.1..Sliding ... [详细]
  • 本文讨论了如何优化解决hdu 1003 java题目的动态规划方法,通过分析加法规则和最大和的性质,提出了一种优化的思路。具体方法是,当从1加到n为负时,即sum(1,n)sum(n,s),可以继续加法计算。同时,还考虑了两种特殊情况:都是负数的情况和有0的情况。最后,通过使用Scanner类来获取输入数据。 ... [详细]
  • 基于layUI的图片上传前预览功能的2种实现方式
    本文介绍了基于layUI的图片上传前预览功能的两种实现方式:一种是使用blob+FileReader,另一种是使用layUI自带的参数。通过选择文件后点击文件名,在页面中间弹窗内预览图片。其中,layUI自带的参数实现了图片预览功能。该功能依赖于layUI的上传模块,并使用了blob和FileReader来读取本地文件并获取图像的base64编码。点击文件名时会执行See()函数。摘要长度为169字。 ... [详细]
  • HDU 2372 El Dorado(DP)的最长上升子序列长度求解方法
    本文介绍了解决HDU 2372 El Dorado问题的一种动态规划方法,通过循环k的方式求解最长上升子序列的长度。具体实现过程包括初始化dp数组、读取数列、计算最长上升子序列长度等步骤。 ... [详细]
  • 本文讨论了Alink回归预测的不完善问题,指出目前主要针对Python做案例,对其他语言支持不足。同时介绍了pom.xml文件的基本结构和使用方法,以及Maven的相关知识。最后,对Alink回归预测的未来发展提出了期待。 ... [详细]
  • 本文介绍了OC学习笔记中的@property和@synthesize,包括属性的定义和合成的使用方法。通过示例代码详细讲解了@property和@synthesize的作用和用法。 ... [详细]
  • Mac OS 升级到11.2.2 Eclipse打不开了,报错Failed to create the Java Virtual Machine
    本文介绍了在Mac OS升级到11.2.2版本后,使用Eclipse打开时出现报错Failed to create the Java Virtual Machine的问题,并提供了解决方法。 ... [详细]
  • 知识图谱——机器大脑中的知识库
    本文介绍了知识图谱在机器大脑中的应用,以及搜索引擎在知识图谱方面的发展。以谷歌知识图谱为例,说明了知识图谱的智能化特点。通过搜索引擎用户可以获取更加智能化的答案,如搜索关键词"Marie Curie",会得到居里夫人的详细信息以及与之相关的历史人物。知识图谱的出现引起了搜索引擎行业的变革,不仅美国的微软必应,中国的百度、搜狗等搜索引擎公司也纷纷推出了自己的知识图谱。 ... [详细]
  • 本文讲述了作者通过点火测试男友的性格和承受能力,以考验婚姻问题。作者故意不安慰男友并再次点火,观察他的反应。这个行为是善意的玩人,旨在了解男友的性格和避免婚姻问题。 ... [详细]
  • 本文详细介绍了Linux中进程控制块PCBtask_struct结构体的结构和作用,包括进程状态、进程号、待处理信号、进程地址空间、调度标志、锁深度、基本时间片、调度策略以及内存管理信息等方面的内容。阅读本文可以更加深入地了解Linux进程管理的原理和机制。 ... [详细]
  • 1,关于死锁的理解死锁,我们可以简单的理解为是两个线程同时使用同一资源,两个线程又得不到相应的资源而造成永无相互等待的情况。 2,模拟死锁背景介绍:我们创建一个朋友 ... [详细]
  • 《数据结构》学习笔记3——串匹配算法性能评估
    本文主要讨论串匹配算法的性能评估,包括模式匹配、字符种类数量、算法复杂度等内容。通过借助C++中的头文件和库,可以实现对串的匹配操作。其中蛮力算法的复杂度为O(m*n),通过随机取出长度为m的子串作为模式P,在文本T中进行匹配,统计平均复杂度。对于成功和失败的匹配分别进行测试,分析其平均复杂度。详情请参考相关学习资源。 ... [详细]
  • 动态规划算法的基本步骤及最长递增子序列问题详解
    本文详细介绍了动态规划算法的基本步骤,包括划分阶段、选择状态、决策和状态转移方程,并以最长递增子序列问题为例进行了详细解析。动态规划算法的有效性依赖于问题本身所具有的最优子结构性质和子问题重叠性质。通过将子问题的解保存在一个表中,在以后尽可能多地利用这些子问题的解,从而提高算法的效率。 ... [详细]
  • Java验证码——kaptcha的使用配置及样式
    本文介绍了如何使用kaptcha库来实现Java验证码的配置和样式设置,包括pom.xml的依赖配置和web.xml中servlet的配置。 ... [详细]
  • 高质量SQL书写的30条建议
    本文提供了30条关于优化SQL的建议,包括避免使用select *,使用具体字段,以及使用limit 1等。这些建议是基于实际开发经验总结出来的,旨在帮助读者优化SQL查询。 ... [详细]
author-avatar
z苏苏575
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有