进入Linux后中断出现(base)或没有base

关于这个问题,有一些类似的问题,比如“如何改变Linux系统默认Python路径”,"如何去掉Linux用户中断出现的(base)"

先说明我的情况,我是习惯了带(base)的终端,因为这样终端会用不同颜色区分文件或者文件夹,看起来很舒服。

先解释为什么会有(base)的出现 ,是因为在打开终端的时候自动 执行了   conda  activate base 就会出现(base)。

为什么(base)就不在了呢?经过测试,发现系统默认的Python路径被改了,改成了系统自带的Python,而不是anaconda下的Python。所以我改了Linux系统默认的Python路径。

用以下命令:

1-   echo 'export PATH="/home/xx/anaconda3/bin:$PATH"' >> ~/.bashrc (改变路径,其中xx改成你对于的目录,总之将bin路径写对就行,其它不用改动)

2-  source ~/.bashrc  (重启)

这样问他就解决了,不喜欢用(base)环境的也可以用相关方法改变,可参考这个方法https://blog.csdn.net/zhangvalue/article/details/90312759,不过我自己没试

  • 5
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
深入理解Linux网络内幕(英文) If you've ever wondered how Linux carries out the complicated tasks assigned to it by the IP protocols -- or if you just want to learn about modern networking through real-life examples -- "Understanding Linux Network Internals" is for you. Like the popular O'Reilly book, "Understanding the Linux Kernel," this book clearly explains the underlying concepts and teaches you how to follow the actual C code that implements it. Although some background in the TCP/IP protocols is helpful, you can learn a great deal from this text about the protocols themselves and their uses. And if you already have a base knowledge of C, you can use the book's code walkthroughs to figure out exactly what this sophisticated part of the Linux kernel is doing. Part of the difficulty in understanding networks -- and implementing them -- is that the tasks are broken up and performed at many different times by different pieces of code. One of the strengths of this book is to integrate the pieces and reveal the relationships between far-flung functions and data structures. "Understanding Linux Network Internals" is both a big-picture discussion and a no-nonsense guide to the details of Linux networking. Topics include: Key problems with networking Network interface card (NIe device drivers System initialization Layer 2 (link-layer) tasks and implementation Layer 3 (IPv4) tasks and implementation Neighbor infrastructure and protocols (ARP) Bridging Routing ICMP Author Christian Benvenuti, an operating system designer specializing in networking, explains much more than how Linux code works. He shows the purposes of major networking features and the trade-offs involved inchoosing one solution over another. A large number of flowcharts and other diagrams enhance the book's understandability. Part I: General Background 背景知识 Chapter 1. Introduction 简介 Section 1.1. Basic Terminology 基础技术 Section 1.2. Common Coding Patterns 通用程序模式 Section 1.3. User-Space Tools 用户空间的工具 Section 1.4. Browsing the Source Code 浏览代码 Section 1.5. When a Feature Is Offered as a Patch 一些特性什么时候以补丁的形式提供 Chapter 2. Critical Data Structures 重要数据结构 Section 2.1. The Socket Buffer: sk_buff Structure 套接字缓存:sk_buff结构 Section 2.2. net_device Structure net_device结构 Section 2.3. Files Mentioned in This Chapter 本章所涉及的到的(代码)文件 Chapter 3. User-Space-to-Kernel Interface 从用户空间到内核态的接口 Section 3.1. Overview 简介 Section 3.2. procfs Versus sysctl Section 3.3. ioctl Section 3.4. Netlink 网络链接 Section 3.5. Serializing Configuration Changes 不断的配置变化 Part II: System Initialization 系统初始化 Chapter 4. Notification Chains (消息)通知链 Section 4.1. Reasons for Notification Chains 通知链的原因 Section 4.2. Overview 简介 Section 4.3. Defining a Chain 定义一个链 Section 4.4. Registering with a Chain 注册链 Section 4.5. Notifying Events on a Chain 在链上标记事件 Section 4.6. Notification Chains for the Networking Subsystems 网络子层的标记链 Section 4.7. Tuning via /proc Filesystem Section 4.8. Functions and Variables Featured in This Chapter 本章所涉及的到的函数与变量 Section 4.9. Files and Directories Featured in This Chapter 本章所涉及的到的(代码)文件 Chapter 5. Network Device Initialization 网络设备的组织 Section 5.1. System Initialization Overview 简介 Section 5.2. Device Registration and Initialization 设备注册与初始化 Section 5.3. Basic Goals of NIC Initialization NIC初始化的基本目标 Section 5.4. Interaction Between Devices and Kernel 设备与内核的交互 Section 5.5. Initialization Options 初始化选项 Section 5.6. Module Options 模块选项 Section 5.7. Initializing the Device Handling Layer: net_dev_init 设备处理层的初始化 Section 5.8. User-Space Helpers 用户空间的帮助 Section 5.9. Virtual Devices 虚拟设备 Section 5.10. Tuning via /proc Filesystem Section 5.11. Functions and Variables Featured in This Chapter Section 5.12. Files and Directories Featured in This Chapter Chapter 6. The PCI Layer and Network Interface Cards PCI层的网卡 Section 6.1. Data Structures Featured in This Chapter 本章的数据结构 Section 6.2. Registering a PCI NIC Device Driver PIC NIC设备驱动的注册 Section 6.3. Power Management and Wake-on-LAN 电源管理以及LAN唤醒 Section 6.4. Example of PCI NIC Driver Registration 示例 Section 6.5. The Big Picture 框架图 Section 6.6. Tuning via /proc Filesystem Section 6.7. Functions and Variables Featured in This Chapter Section 6.8. Files and Directories Featured in This Chapter Chapter 7. Kernel Infrastructure for Component Initialization 组件初始化的底层内核(实现) Section 7.1. Boot-Time Kernel Options 内核启动选项 Section 7.2. Module Initialization Code 模块初始化 Section 7.3. Optimized Macro-Based Tagging 基于标记的模块优化 Section 7.4. Boot-Time Initialization Routines 启动时的初始化例程 Section 7.5. Memory Optimizations 内存优化 Section 7.6. Tuning via /proc Filesystem Section 7.7. Functions and Variables Featured in This Chapter Section 7.8. Files and Directories Featured in This Chapter Chapter 8. Device Registration and Initialization 设备的注册与初始化 Section 8.1. When a Device Is Registered 什么时候注册一个设备 Section 8.2. When a Device Is Unregistered Section 8.3. Allocating net_device Structures 给XX结构分配内存 Section 8.4. Skeleton of NIC Registration and Unregistration NIC注册与反注册的框架 Section 8.5. Device Initialization 设备初始化 Section 8.6. Organization of net_device Structures XX结构的组织 Section 8.7. Device State 设备状态 Section 8.8. Registering and Unregistering Devices Section 8.9. Device Registration Section 8.10. Device Unregistration Section 8.11. Enabling and Disabling a Network Device 网络设备的使能与去使能 Section 8.12. Updating the Device Queuing Discipline State 更新设备的?? Section 8.13. Configuring Device-Related Information from User Space 从用户空间配置与设备相关的信息 Section 8.14. Virtual Devices Section 8.15. Locking 查找 Section 8.16. Tuning via /proc Filesystem Section 8.17. Functions and Variables Featured in This Chapter Section 8.18. Files and Directories Featured in This Chapter Part III: Transmission and Reception 传输与接收 Chapter 9. Interrupts and Network Drivers 网络设备的中断 Section 9.1. Decisions and Traffic Direction 数据流的方向与决策 Section 9.2. Notifying Drivers When Frames Are Received 在数据帧接收到时通知驱动 Section 9.3. Interrupt Handlers 中断处理 Section 9.4. softnet_data Structure XX数据结构 Chapter 10. Frame Reception 帧接收 Section 10.1. Interactions with Other Features 与其它特性交互 Section 10.2. Enabling and Disabling a Device 设备的使能与去使能 Section 10.3. Queues 队列 Section 10.4. Notifying the Kernel of Frame Reception: NAPI and netif_rx 帧接收时通知内核 Section 10.5. Old Interface Between Device Drivers and Kernel: First Part of netif_rx 内核到设备驱动之间的老的接口 Section 10.6. Congestion Management 阻塞管理 Section 10.7. Processing the NET_RX_SOFTIRQ: net_rx_action Chapter 11. Frame Transmission 帧传输 Section 11.1. Enabling and Disabling Transmissions Chapter 12. General and Reference Material About Interrupts 中断的常识和和参考 Section 12.1. Statistics 统计 Section 12.2. Tuning via /proc and sysfs Filesystems Section 12.3. Functions and Variables Featured in This Part of the Book Section 12.4. Files and Directories Featured in This Part of the Book Chapter 13. Protocol Handlers 协议处理 Section 13.1. Overview of Network Stack Section 13.2. Executing the Right Protocol Handler Section 13.3. Protocol Handler Organization Section 13.4. Protocol Handler Registration Section 13.5. Ethernet Versus IEEE 802.3 Frames Section 13.6. Tuning via /proc Filesystem Section 13.7. Functions and Variables Featured in This Chapter Section 13.8. Files and Directories Featured in This Chapter Part IV: Bridging 网桥 Chapter 14. Bridging: Concepts Section 14.1. Repeaters, Bridges, and Routers 中继器,网桥和路由器 Section 14.2. Bridges Versus Switches 网桥与交换机 Section 14.3. Hosts 服务器 Section 14.4. Merging LANs with Bridges 聚合LAN和网桥 Section 14.5. Bridging Different LAN Technologies Section 14.6. Address Learning 寻址 Section 14.7. Multiple Bridges 多网桥 Chapter 15. Bridging: The Spanning Tree Protocol 网桥,生成树协议 Section 15.1. Basic Terminology 基础技术 Section 15.2. Example of Hierarchical Switched L2 Topology 分级交换机的二层拓扑示例 Section 15.3. Basic Elements of the Spanning Tree Protocol 生成树协议的基本元素 Section 15.4. Bridge and Port IDs 网桥和端口ID Section 15.5. Bridge Protocol Data Units (BPDUs) 交换机协议数据单元 Section 15.6. Defining the Active Topology Section 15.7. Timers 计时器 Section 15.8. Topology Changes Section 15.9. BPDU Encapsulation Section 15.10. Transmitting Configuration BPDUs Section 15.11. Processing Ingress Frames Section 15.12. Convergence Time 时间收敛 Section 15.13. Overview of Newer Spanning Tree Protocols Chapter 16. Bridging: Linux Implementation 桥接:Linux的实现 Section 16.1. Bridge Device Abstraction Section 16.2. Important Data Structures Section 16.3. Initialization of Bridging Code Section 16.4. Creating Bridge Devices and Bridge Ports Section 16.5. Creating a New Bridge Device Section 16.6. Bridge Device Setup Routine Section 16.7. Deleting a Bridge Section 16.8. Adding Ports to a Bridge Section 16.9. Enabling and Disabling a Bridge Device Section 16.10. Enabling and Disabling a Bridge Port Section 16.11. Changing State on a Bridge Port Section 16.12. The Big Picture Section 16.13. Forwarding Database Section 16.14. Handling Ingress Traffic Section 16.15. Transmitting on a Bridge Device Section 16.16. Spanning Tree Protocol (STP) Section 16.17. netdevice Notification Chain Chapter 17. Bridging: Miscellaneous Topics 桥接:其它的主题 Section 17.1. User-Space Configuration Tools Section 17.2. Tuning via /proc Filesystem Section 17.3. Tuning via /sys Filesystem Section 17.4. Statistics Section 17.5. Data Structures Featured in This Part of the Book Section 17.6. Functions and Variables Featured in This Part of the Book Section 17.7. Files and Directories Featured in This Part of the Book Part V: Internet Protocol Version 4 (IPv4) IP协议(V4) Chapter 18. Internet Protocol Version 4 (IPv4): Concepts Section 18.1. IP Protocol: The Big Picture Section 18.2. IP Header Section 18.3. IP Options Section 18.4. Packet Fragmentation/Defragmentation Section 18.5. Checksums Chapter 19. Internet Protocol Version 4 (IPv4): Linux Foundations and Features Section 19.1. Main IPv4 Data Structures Section 19.2. General Packet Handling Section 19.3. IP Options Chapter 20. Internet Protocol Version 4 (IPv4): Forwarding and Local Delivery Section 20.1. Forwarding Section 20.2. Local Delivery Chapter 21. Internet Protocol Version 4 (IPv4): Transmission Section 21.1. Key Functions That Perform Transmission Section 21.2. Interface to the Neighboring Subsystem Chapter 22. Internet Protocol Version 4 (IPv4): Handling Fragmentation Section 22.1. IP Fragmentation Section 22.2. IP Defragmentation Chapter 23. Internet Protocol Version 4 (IPv4): Miscellaneous Topics Section 23.1. Long-Living IP Peer Information Section 23.2. Selecting the IP Header's ID Field Section 23.3. IP Statistics Section 23.4. IP Configuration Section 23.5. IP-over-IP Section 23.6. IPv4: What's Wrong with It? Section 23.7. Tuning via /proc Filesystem Section 23.8. Data Structures Featured in This Part of the Book Section 23.9. Functions and Variables Featured in This Part of the Book Section 23.10. Files and Directories Featured in This Part of the Book Chapter 24. Layer Four Protocol and Raw IP Handling Section 24.1. Available L4 Protocols Section 24.2. L4 Protocol Registration Section 24.3. L3 to L4 Delivery: ip_local_deliver_finish Section 24.4. IPv4 Versus IPv6 Section 24.5. Tuning via /proc Filesystem Section 24.6. Functions and Variables Featured in This Chapter Section 24.7. Files and Directories Featured in This Chapter Chapter 25. Internet Control Message Protocol (ICMPv4) Section 25.1. ICMP Header Section 25.2. ICMP Payload Section 25.3. ICMP Types Section 25.4. Applications of the ICMP Protocol Section 25.5. The Big Picture Section 25.6. Protocol Initialization Section 25.7. Data Structures Featured in This Chapter Section 25.8. Transmitting ICMP Messages Section 25.9. ICMP Statistics Section 25.10. Passing Error Notifications to the Transport Layer Section 25.11. Tuning via /proc Filesystem Section 25.12. Functions and Variables Featured in This Chapter Section 25.13. Files and Directories Featured in This Chapter Part VI: Neighboring Subsystem Chapter 26. Neighboring Subsystem: Concepts Section 26.1. What Is a Neighbor? Section 26.2. Reasons That Neighboring Protocols Are Needed Section 26.3. Linux Implementation Section 26.4. Proxying the Neighboring Protocol Section 26.5. When Solicitation Requests Are Transmitted and Processed Section 26.6. Neighbor States and Network Unreachability Detection (NUD) Chapter 27. Neighboring Subsystem: Infrastructure Section 27.1. Main Data Structures Section 27.2. Common Interface Between L3 Protocols and Neighboring Protocols Section 27.3. General Tasks of the Neighboring Infrastructure Section 27.4. Reference Counts on neighbour Structures Section 27.5. Creating a neighbour Entry Section 27.6. Neighbor Deletion Section 27.7. Acting As a Proxy Section 27.8. L2 Header Caching Section 27.9. Protocol Initialization and Cleanup Section 27.10. Interaction with Other Subsystems Section 27.11. Interaction Between Neighboring Protocols and L3 Transmission Functions Section 27.12. Queuing Chapter 28. Neighboring Subsystem: Address Resolution Protocol (ARP) Section 28.1. ARP Packet Format Section 28.2. Example of an ARP Transaction Section 28.3. Gratuitous ARP Section 28.4. Responding from Multiple Interfaces Section 28.5. Tunable ARP Options Section 28.6. ARP Protocol Initialization Section 28.7. Initialization of a neighbour Structure Section 28.8. Transmitting and Receiving ARP Packets Section 28.9. Processing Ingress ARP Packets Section 28.10. Proxy ARP Section 28.11. Examples Section 28.12. External Events Section 28.13. ARPD Section 28.14. Reverse Address Resolution Protocol (RARP) Section 28.15. Improvements in ND (IPv6) over ARP (IPv4) Chapter 29. Neighboring Subsystem: Miscellaneous Topics Section 29.1. System Administration of Neighbors Section 29.2. Tuning via /proc Filesystem Section 29.3. Data Structures Featured in This Part of the Book Section 29.4. Files and Directories Featured in This Part of the Book Part VII: Routing Chapter 30. Routing: Concepts Section 30.1. Routers, Routes, and Routing Tables Section 30.2. Essential Elements of Routing Section 30.3. Routing Table Section 30.4. Lookups Section 30.5. Packet Reception Versus Packet Transmission Chapter 31. Routing: Advanced Section 31.1. Concepts Behind Policy Routing Section 31.2. Concepts Behind Multipath Routing Section 31.3. Interactions with Other Kernel Subsystems Section 31.4. Routing Protocol Daemons Section 31.5. Verbose Monitoring Section 31.6. ICMP_REDIRECT Messages Section 31.7. Reverse Path Filtering Chapter 32. Routing: Li nux Implementation Section 32.1. Kernel Options Section 32.2. Main Data Structures Section 32.3. Route and Address Scopes Section 32.4. Primary and Secondary IP Addresses Section 32.5. Generic Helper Routines and Macros Section 32.6. Global Locks Section 32.7. Routing Subsystem Initialization Section 32.8. External Events Section 32.9. Interactions with Other Subsystems Chapter 33. Routing: The Routing Cache Section 33.1. Routing Cache Initialization Section 33.2. Hash Table Organization Section 33.3. Major Cache Operations Section 33.4. Multipath Caching Section 33.5. Interface Between the DST and Calling Protocols Section 33.6. Flushing the Routing Cache Section 33.7. Garbage Collection Section 33.8. Egress ICMP REDIRECT Rate Limiting Chapter 34. Routing: Routing Tables Section 34.1. Organization of Routing Hash Tables Section 34.2. Routing Table Initialization Section 34.3. Adding and Removing Routes Section 34.4. Policy Routing and Its Effects on Routing Table Definitions Chapter 35. Routing: Lookups Section 35.1. High-Level View of Lookup Functions Section 35.2. Helper Routines Section 35.3. The Table Lookup: fn_hash_lookup Section 35.4. fib_lookup Function Section 35.5. Setting Functions for Reception and Transmission Section 35.6. General Structure of the Input and Output Routing Routines Section 35.7. Input Routing Section 35.8. Output Routing Section 35.9. Effects of Multipath on Next Hop Selection Section 35.10. Policy Routing Section 35.11. Source Routing Section 35.12. Policy Routing and Routing Table Based Classifier Chapter 36. Routing: Miscellaneous Topics Section 36.1. User-Space Configuration Tools Section 36.2. Statistics Section 36.3. Tuning via /proc Filesystem Section 36.4. Enabling and Disabling Forwarding Section 36.5. Data Structures Featured in This Part of the Book Section 36.6. Functions and Variables Featured in This Part of the Book Section 36.7. Files and Directories Featured in This Part of the Book About the Authors Colophon Index
//供学习用,禁止用于商业用途。 2012.04.20   OceanBase解决什么问题   许多公司的核心资产是各种各样的商业数据,例如淘宝的商品、交易、订单、购物爱好等等,这些数据通常是结构化的,并且数据之间存在各种各样的关联,传统的关系数据库曾经是这些数据的最佳载体。然而,随着业务的快速发展,这些数据急剧膨胀,记录数从几千万条增加到数十亿条,数据量从百GB增加到数TB,未来还可能增加到数千亿条和数百TB,传统的关系型数据库已经无法承担如此海量的数据。OceanBase解决不断增加的结构化数据存储与查询的问题。   从Eric Brewer教授的CAP(一致性C: Consistency, 可用性A: Availability,分区容错性P: Tolerance of network Partition)理论角度分析,作为电子商务企业,淘宝和其他公司的业务对一致性和可用性的要求高于分区容错性,数据特征是数据总量庞大且逐步增加,单位时间内的数据更新量并不大,但实时性要求很高。这就要求我们提供一套更加偏重于支持CA特性的系统,同时兼顾可分区性,并且在实时性、成本、性能等方面表现良好。   OceanBase的架构   OceanBase的逻辑架构简图    ▲   OceanBase架构的一些基本概念   主键   row key,也称为primary key,类似于DBMS的主键,与DBMS不同的是,OceanBase的主键总是二进制字符串(binary string),但可以有某种结构。OceanBase以主键为顺序存放表格数据   sstable   一种数据存储格式,OceanBase用来存储一个或几个表的一段按主键连续的数据   tablet   一个表按主键划分的一个(前开后闭的)范围,通常包含一个或几个sstable,一个tablet的数据量通常在256MB左右   基准数据和动态数据   OceanBase以增量方式记录一段时间内的表格数据的增删改,从而保持着表格主体数据在一段时间内相对稳定,其中增删改的数据称为动态数据(通常在内存,也称为内存表),而一段时间内相对稳定的主体数据称为基准数据,基准数据和转储后(保存到SSD固态盘或磁盘)的动态数据以sstable格式存储   ChunkServer   保存基准数据的服务器,通常是多台,为了避免软件硬件故障导致的服务中断,同一份基准数据通常保存了3份并存储在不同ChunkServer上   UpdateServer   保存动态数据的服务器,一般是单台服务器。为了避免软件硬件故障导致的服务中断,UpdateServer记录commit log并通常使用双机热备   MergeServer   进行静态动态数据合并的服务器,常常与ChunkServer共用一台物理服务器。MergeServer使得用户能够访问到完整的最新的数据   RootServer   配置服务器,一般是单台服务器。为了避免软件硬件故障导致的服务中断,RootServer记录commit log并通常采用双机热备。由于RootServer负载一般都很轻,所以它常常与UpdateServer共用物理机器   冻结   指动态数据(也称为内存表)的更新到一定时间或者数据量达到一定规模后,OceanBase停止该块动态数据的修改,后续的更新写入新的动态数据块(即新的内存表),旧的动态数据块不再修改,这个过程称为冻结   转储   出于节省内存或者持久化等原因将一个冻结的动态数据块(内存表)持久化(转化为sstable并保存到SSD固态盘或磁盘上)的过程   数据合并(merge)   查询时,查询项的基准数据与其动态数据(即增删改操作)合并以得到该数据项的最新结果的过程。此外,把旧的基准数据与冻结的动态数据进行合并生成新的基准数据的过程也称为数据合并   联表(join)   一张表与另一张或几张表基于主键的左连接关系,类似于DBMS的自然连接   COW   Copy on Write的缩写,在OceanBase中特指BTree在更新时复制数据备份写入,避免系统锁的技术手段   OceanBase的特点   OceanBase功能   OceanBase设计和实现的时候暂时摒弃了不紧急的DBMS的功能,例如临时表,视图(view),研发团队把有限的资源集中到关键点上,当前OceanBase主要解决数据更新一致性、高性能的跨表读事务、范围查询、join、数据全量及增量dump、批量数据导入。   OceanBase数据访问特点   虽然数据总量比较大,但跟许多行业一样,淘宝业务一段时间(例如小时或天)内数据的增删改是有限的(通常一天不超过几千万次到几亿次),根据这个特点,OceanBase把一段时间内的增删改等修改操作以增量形式记录下来(称之为动态数据,通常保存在内存中),这样也使得了主体数据在一段时间内保持了相对稳定(称之为基准数据)。   由于动态数据相对较小,通常情况下,OceanBase把它保存在独立的服务器UpdateServer的内存中。以内存保存增删改记录极大地提高了系统写事务的性能。此外,假如每条修改平均消耗100 Bytes,那么10GB内存可以记录100M(即1亿)条修改,且扩充UpdateServer内存即增加了内存中容纳的修改量。不仅如此,由于冻结后的内存表不再修改,它也可以转换成sstable格式并保存到SSD固态盘或磁盘上。转储到SSD固态盘后所占内存即可释放,并仍然可以提供较高性能的读服务,这也缓解了极端情况下UpdateServer的内存需求。为了应对机器故障,动态数据服务器UpdateServer写commit log并采取双机(乃至多机)热备。由于UpdateServer的主备机是同步的,因此备机也可同时提供读服务。   因为基准数据相对稳定,OceanBase把它按照主键(primary key,也称为row key)分段(即tablet)后保存多个副本(一般是3个)到多台机器(ChunkServer)上,避免了单台机器故障导致的服务中断,多个副本也提升了系统服务能力。单个tablet的尺寸可以根据应用数据特点进行配置,相对配置过小的tablet会合并,过大的tablet则会分裂。   由于tablet按主键分块连续存放,因此OceanBase按主键的范围查询对应着连续的磁盘读,十分高效。   对于已经冻结/转储的动态数据,OceanBase的ChunkServer会在自己不是太繁忙的时候启动基准数据与冻结/转储内存表的合并,并生成新的基准数据。这种合并过程其实是一种范围查询,是一串连续的磁盘读和连续的磁盘写,也是很高效的。   传统DBMS提供了强大的事务性、良好的一致性和很短的查询修改响应时间,但数据规模受到严重制约,缺乏扩展性;现代云计算提供了极大的数据规模、良好的扩展性,但缺乏跨行跨表事务、数据一致性也较弱、查询修改响应时间通常也较长,OceanBase的设计和实现融合了二者的优势:   --------------------------------------------------------------------------------   UpdateServer:类似于DBMS中的DB角色,提供跨行跨表事务和很短的查询修改的响应时间以及良好的一致性。   ChunkServer:类似于云计算中的工作机(如GFS的chunk server),具有数据多副本(通常是3)、中等规模数据粒度(tablet大小约256MB)、自动负载平衡、宕机恢复、机器plug and play等特点,系统容量及性能可随时扩展。   MergeServer:结合ChunkServer和UpdateServer,获得最新数据,实现数据一致性。   RootServer:类似于云计算中的主控机(如GFS master),进行机器故障检测、负载平衡计算、负载迁移调度等。   --------------------------------------------------------------------------------   上述的DBMS和云计算技术的优势互补使得OceanBase既具有传统DBMS的跨行跨表事务、数据的强一致性以及很短的查询修改响应时间,还有云计算的海量数据管理能力、自动故障恢复、自动负载平衡以及良好的扩展性。   OceanBase当前在淘宝的应用   OceanBase现在已经应用于淘宝收藏夹,用于存储淘宝用户收藏条目和具体的商品、店铺信息,每天支持4~5千万的更新操作。等待上线的应用还包括CTU、SNS等,每天更新超过20亿,更新数据量超过2.5TB,并会逐步在淘宝内部推广,也期待外部合作者。   主要的性能数据   测试软硬件环境   Red Hat Enterprise Linux Server release 5.4 (Tikanga)   gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)   Intel(R) Xeon(R) CPU E5520 @ 2.27GH   ChunkServer & MergeServer:Memory 16GB Disk 300GB SAS*10 NO Raid   UpdateServer & RootServer:Memory 48GB Disk 300GB SAS*6 Raid1   测试环境部署简图   ▲   测试数据规模   21亿条数据,基准数据3备份。   测试Schema   两张表,其中表1中有21列,表2中11列。   其中表1中的11列和表2中的11列存在join关系。   单条记录大小为500字节。   测试性能曲线图   Range数据查询   ▲   单条数据查询   ▲   当压力最大时,ChunkServer单台输出数据90MB/S,已经接近了千兆网卡的极限   更新数据   ▲
Linux系统移植 目 录 第一部分 前言....................................................................................................................................8 1 硬件环境......................................................................................................................................8 1.1 主机硬件环境.......................................................................................................................8 1.2 目标板硬件环境...................................................................................................................8 1.3 工具介绍...............................................................................................................................8 2 软件环境.......................................................................................................................................8 2.1 主机软件环境.......................................................................................................................8 2.1.1 Windows 操作系统.......................................................................................................8 2.1.2 Linux 操作系统 .......................................................................................................8 2.1.3 目标板最后运行的环境...............................................................................................9 2.2 Linux 下工作用户及环境....................................................................................................9 2.2.1 交叉工具的安装...........................................................................................................9 2.2.2 u­boot移植工作目录....................................................................................................9 2.2.3 内核及应用程序移植工作...........................................................................................9 2.3 配置系统服务.....................................................................................................................10 2.3.1 tftp 服务器的配置.......................................................................................................10 2.4 工具使用.............................................................................................................................12 2.4.1 minicom的使用..........................................................................................................12 3 作者介绍....................................................................................................................................13 3.1 策划, 组织, 指导, 发布者...................................................................................................13 3.2 ADS bootloader部分..........................................................................................................13 3.3 交叉工具部分.....................................................................................................................13 3.4 uboot 部分...........................................................................................................................13 3.5 内核部分.............................................................................................................................13 3.6 应用程序部分.....................................................................................................................13 3.7 网卡驱动部分.....................................................................................................................13 3.8 Nand Flash 驱动部分.........................................................................................................13 第二部分 系统启动bootloader 的编写(ADS).................................................................................14 1 工具介绍....................................................................................................................................14 1.1 ADS 命令行命令介绍........................................................................................................14 1.1.1 armasm........................................................................................................................14 1.1.2 armcc, armcpp.............................................................................................................14 1.1.3 armlink.........................................................................................................................14 2 基本原理....................................................................................................................................15 2.1 可执行文件组成及内存映射.............................................................................................15 2.1.1 可执行文件的组成.....................................................................................................15 2.1.2 装载过程.....................................................................................................................16 2.1.3 启动过程的汇编部分.................................................................................................17 2.1.4 启动过程的 C部分.....................................................................................................17 3 AXD的使用以及源代码说明...................................................................................................18 3.1 源代码说明.........................................................................................................................18 3.1.1 汇编源代码说明.........................................................................................................18 3.1.2 C语言源代码说明......................................................................................................23 3.1.3 源代码下载.................................................................................................................23 3.2 AXD的使用.......................................................................................................................23 3.2.1 配置仿真器.................................................................................................................23 3.2.2 启动 AXD 配置开发板...............................................................................................23 第三部分 GNU交叉工具链.............................................................................................................25 1  设置环境变量,准备源码及相关补丁...................................................................................25 1.1 设置环境变量.....................................................................................................................25 1. 2 准备源码包............................................................................................................................25 1.2.1 binuils..........................................................................................................................25 1.2.2 gcc...............................................................................................................................25 1.2.3 glibc.............................................................................................................................25 1.2.4 linux kernel..................................................................................................................26 1.3 准备补丁.............................................................................................................................26 1.3.1 ioperm.c.diff................................................................................................................26 1.3.2 flow.c.diff....................................................................................................................26 1.3.3 t­linux.diff....................................................................................................................26 1.4   编译 GNU binutils...........................................................................................................26 1.5 准备内核头文件.................................................................................................................26 1.5.1 使用当前平台的 gcc编译内核头文件......................................................................26 1.5.2 复制内核头文件.........................................................................................................27 1.6   译编glibc头文件.............................................................................................................27 1.7   编译gcc第一阶段............................................................................................................27 1.8   编译完整的glibc..............................................................................................................27 1.9  编译完整的gcc.................................................................................................................28 2 GNU 交叉工具链的下载...........................................................................................................28 2.1 ARM 官方网站...................................................................................................................28 2.2 本文档提供的下载.............................................................................................................28 3 GNU 交叉工具链的介绍与使用...............................................................................................29 3.1 常用工具介绍.....................................................................................................................29 3.2.1 arm­linux­gcc的使用.................................................................................................29 3.2.2 arm­linux­ar 和 arm­linux­ranlib 的使用..................................................................30 3.2.3 arm­linux­objdump 的使用.........................................................................................30 3.2.4 arm­linux­readelf 的使用............................................................................................31 3.2.6 arm­linux­copydump 的使用......................................................................................32 4 ARM GNU 常用汇编语言介绍.................................................................................................32 4.1 ARM GNU常用汇编伪指令介绍.....................................................................................32 4.2 ARM GNU专有符号.........................................................................................................33 4.3 操作码.................................................................................................................................33 5 可执行生成说明........................................................................................................................33 5.1 lds文件说明.......................................................................................................................33 5.1.1 主要符号说明.............................................................................................................33 5.1.2 段定义说明.................................................................................................................34 第四部分 u­boot 的移植...................................................................................................................35 1 u­boot的介绍及系统结构.........................................................................................................35 1.1 u­boot 介绍.........................................................................................................................35 1.2 获取u­boot.........................................................................................................................35 1.3 u­boot 体系结构.................................................................................................................35 1.3.1 u­boot目录结构..........................................................................................................35 2 uboot的启动过程及工作原理...................................................................................................36 2.1 启动模式介绍.....................................................................................................................36 2.2 阶段1 介绍.........................................................................................................................36 2.2.1 定义入口.....................................................................................................................36 2.2.2 设置异常向量.............................................................................................................37 2.2.3 设置 CPU的模式为SVC模式..................................................................................37 2.2.4 关闭看门狗.................................................................................................................37 2.2.5 禁掉所有中断.............................................................................................................37 2.2.6 设置以 CPU的频率....................................................................................................37 2.2.7 设置 CP15...................................................................................................................37 2.2.8 配置内存区控制寄存器.............................................................................................38 2.2.9 安装 U­BOOT 使的栈空间........................................................................................38 2.2.10 BSS 段清 0................................................................................................................38 2.2.11 搬移 Nand Flash 代码...............................................................................................39 2.2.12 进入 C代码部分.......................................................................................................39 2.3 阶段2 的C语言代码部分 .............................................................................................39 2.3.1 调用一系列的初始化函数.........................................................................................39 2.3.2 初始化网络设备.........................................................................................................41 2.3.3 进入主 UBOOT 命令行..............................................................................................41 2.4 代码搬运.............................................................................................................................41 3 uboot的移植过程.......................................................................................................................42 3.1 环境.....................................................................................................................................42 3.2 步骤.....................................................................................................................................42 3.2.1 修改 Makefile..............................................................................................................42 3.2.2 在 board 子目录中建立 crane2410.............................................................................42 3.2.3 在 include/configs/中建立配置头文件......................................................................42 3.2.4 指定交叉编译工具的路径.........................................................................................42 3.2.5 测试编译能否成功.....................................................................................................42 3.2.6 修改 lowlevel_init.S 文件...........................................................................................43 3.2.9 UBOOT 的 Nand Flash 移植......................................................................................45 3.2.8 重新编译u­boot..........................................................................................................45 3.2.9 把 u­boot烧入flash....................................................................................................45 4  U­BOOT 命令的使用................................................................................................................46 4.1 U­BOOT命令的介绍.........................................................................................................46 4.1.1 获得帮助信息.............................................................................................................46 4.2 常用命令使用说明.............................................................................................................47 4.2.1 askenv(F).....................................................................................................................47 4.2.2 autoscr.........................................................................................................................47 4.2.3 base   ...........................................................................................................................47 4.2.4 bdinfo...........................................................................................................................47 4.2.5 bootp............................................................................................................................47 4.2.8 tftp(tftpboot)................................................................................................................48 4.2.9 bootm...........................................................................................................................48 4.2.10 go...............................................................................................................................48 4.2.11 cmp   .........................................................................................................................48 4.2.12 coninfo  .....................................................................................................................48 4.2.13 cp...............................................................................................................................48 4.2.14 date............................................................................................................................49 4.2.15 erase(F)......................................................................................................................49 4.2.16 flinfo(F).....................................................................................................................49 4.2.17 iminfo........................................................................................................................49 4.2.18 loadb..........................................................................................................................49 4.2.19 md..............................................................................................................................49 4.2.20 mm ............................................................................................................................50 4.2.21 mtest   .......................................................................................................................50 4.2.22 mw.............................................................................................................................50 4.2.23 nm   ...........................................................................................................................50 4.2.24 printenv......................................................................................................................50 4.2.25 ping  ..........................................................................................................................51 4.2.26 reset...........................................................................................................................51 4.2.27 run   ...........................................................................................................................51 4.2.28 saveenv(F).................................................................................................................51 4.2.29 setenv.........................................................................................................................51 4.2.30 sleep...........................................................................................................................51 4.2.31 version.......................................................................................................................51 4.2.32 nand info....................................................................................................................51 4.2.33 nand device ........................................................................................................51 4.2.34 nand bad....................................................................................................................51 4.2.35 nand read...................................................................................................................52 4.2.36 nand erease................................................................................................................52 4.2.37 nand write..................................................................................................................52 4.3 命令简写说明.....................................................................................................................52 4.4 把文件写入NandFlash.......................................................................................................53 4.5 下载提供.............................................................................................................................53 5 参考资料....................................................................................................................................53 第五部分 linux 2.6 内核的移植.......................................................................................................53 1 内核移植过程............................................................................................................................53 1.1 下载linux 内核...................................................................................................................53 1.2 修改Makefile.....................................................................................................................53 1.3 设置flash 分区...................................................................................................................54 1.3.1 指明分区信息.............................................................................................................54 1.3.2 指定启动时初始化.....................................................................................................56 1.3.3 禁止 Flash ECC校验 ................................................................................................56 1.4 配置内核.............................................................................................................................56 1.4.1 支持启动时挂载 devfs................................................................................................56 1.4.2 配置内核产生.config 文件.........................................................................................57 1.4.3 编译内核.....................................................................................................................58 1.4.4 下载 zImage到开发板................................................................................................58 2 创建 uImage................................................................................................................................61 2.1 相关技术背景介绍.............................................................................................................61 2.2 在内核中创建uImage 的方法...........................................................................................61 2.2.1 获取 mkimage工具.....................................................................................................61 2.2.2 修改内核的 Makefile文件.........................................................................................61 3 追加实验记录.............................................................................................................................62 3.1 移植 linux­2.6.15.7..............................................................................................................62 3.2 移植 linux­2.6.16.21............................................................................................................62 3.3 移植linux­2.6.17................................................................................................................62 4 参考资料....................................................................................................................................62 第六部分 应用程序的移植..............................................................................................................63 1 构造目标板的根目录及文件系统.............................................................................................63 1.1 建立一个目标板的空根目录.............................................................................................63 1.2 在 my_rootfs 中建立Linux 目录树...................................................................................63 1.3 创建linuxrc文件................................................................................................................63 2 移植 Busybox.............................................................................................................................64 2.1 下载busybox......................................................................................................................64 2.3 编译并安装Busybox..........................................................................................................65 3 移植 TinyLogin...........................................................................................................................66 3.1 下载.....................................................................................................................................66 3.2 修改tinyLogin 的 Makefile................................................................................................66 3.3 编译并安装.........................................................................................................................66 4 相关配置文件的创建................................................................................................................66 4.1 创建帐号及密码文件.........................................................................................................66 4.2 创建profile文件................................................................................................................67 4.4 创建fstab 文件...................................................................................................................67 4.5 创建inetd.conf 配置文件...................................................................................................67 5 移植 inetd....................................................................................................................................67 5.1 inetd 的选择及获取............................................................................................................67 5.1.1 获取 inetd....................................................................................................................67 5.2 编译inetd............................................................................................................................67 5.2.1 修改 configure文件....................................................................................................67 5.2.2 编译 ...........................................................................................................................68 5.3 配置inetd............................................................................................................................68 5.3.1 拷贝 inetd 到根文件系统的usr/sbin 目录中.............................................................68 6 移植 thttpd Web 服务器.............................................................................................................69 6.1 下载.....................................................................................................................................69 6.2 编译thttpd...........................................................................................................................69 6.3 配置.....................................................................................................................................69 6.3.1 拷贝 thttpd 二进制可执行文件到根文件系统/usr/sbin/目录中...............................69 6.3.2 修改 thttpd 配置文件..................................................................................................69 6.3.3 转移到根文件系统目录,创建相应的文件.............................................................69 7 建立根目录文件系统包............................................................................................................70 7.1 建立CRAMFS 包...............................................................................................................70 7.1.1 下载 cramfs 工具........................................................................................................70 7.1.2 制作 cramfs 包............................................................................................................70 7.1.3 写 cramfs 包到Nand Flash.........................................................................................70 8 参考资料....................................................................................................................................70 第七部分 Nand flash 驱动的编写与移植........................................................................................71 1 Nand flash 工作原理..................................................................................................................71 1.1 Nand flash 芯片工作原理..................................................................................................71 1.1.1 芯片内部存储布局及存储操作特点.........................................................................71 1.1.2 重要芯片引脚功能.....................................................................................................71 1.1.3 寻址方式.....................................................................................................................71 1.1.4 Nand flash 主要内设命令详细介绍...........................................................................72 1.2 Nand Flash 控制器工作原理.............................................................................................72 1.2.1 Nand Flash 控制器特性..............................................................................................72 1.2.2 Nand Flash 控制器工作原理......................................................................................72 1.3 Nand flash 控制器中特殊功能寄存器详细介绍 ............................................................72 1.4 Nand Flash 控制器中的硬件ECC介绍............................................................................73 1.4.1 ECC产生方法............................................................................................................73 1.4.2 ECC生成器工作过程................................................................................................74 1.4.3 ECC的运用................................................................................................................74 2 在 ADS下flash 烧写程序.........................................................................................................74 2.1 ADS 下 flash 烧写程序原理及结构...................................................................................74 2.2 第三层实现说明.................................................................................................................74 2.1.1 特殊功能寄存器定义.................................................................................................74 2.1.2 操作的函数实现.........................................................................................................74 2.3 第二层实现说明.................................................................................................................75 2.3.1 Nand Flash 初始化......................................................................................................75 2.3.3 获取 Nand flash ID......................................................................................................75 2.3.4 Nand flash 写入...........................................................................................................76 2.3.5 Nand flash 读取...........................................................................................................77 2.3.6 Nand flash 标记坏块...................................................................................................78 2.3.7 Nand Flash 检查坏块..................................................................................................79 2.3.8 擦除指定块中数据.....................................................................................................79 2.4  第一层的实现....................................................................................................................80 3 在 U­BOOT 对Nand Flash 的支持............................................................................................82 3.1 U­BOOT对从 Nand Flash 启动的支持.............................................................................82 3.1.1 从 Nand Flash 启动U­BOOT 的基本原理................................................................82 3.1.2 支持 Nand Flash 启动代码说明.................................................................................82 3.2 U­BOOT对 Nand Flash 命令的支持.................................................................................84 3.2.1 主要数据结构介绍.....................................................................................................84 3.2.2 支持的命令函数说明.................................................................................................85 4 在 Linux 对Nand Flash 的支持.................................................................................................87 4.1 Linux 下Nand Flash 调用关系..........................................................................................87 4.1.1 Nand Flash 设备添加时数据结构包含关系..............................................................87 4.1.2 Nand Flash 设备注册时数据结构包含关系..............................................................87 4.2 Linux 下Nand Flash 驱动主要数据结构说明..................................................................88 4.2.1 s3c2410 专有数据结构...............................................................................................88 4.2.2 Linux 通用数据结构说明..........................................................................................89 4.3.1 注册 driver_register....................................................................................................94 4.3.2 探测设备 probe...........................................................................................................94 4.3.3 初始化 Nand Flash 控制器.........................................................................................94 4.3.4 移除设备.....................................................................................................................94 4.3.5 Nand Flash 芯片初始化..............................................................................................94 4.3.6  读 Nand  Flash............................................................................................................95 4.3.7  写 Nand Flash.............................................................................................................95 第八部分 Cs8900a网卡驱动的编写与移植...................................................................................95 1 Cs8900a工作原理......................................................................................................................95 2 在 ADS下cs8900a的实现........................................................................................................95 2.1 在 cs8900a下实现的ping 工具.........................................................................................95 3 在 u­boot下cs8900a的支持......................................................................................................96 3.1 u­boot 下cs8900a的驱动介绍...........................................................................................96 3.2 u­boot 下cs8900a的移植说明...........................................................................................96 4 在 linux 下cs8900a驱动的编写与移植....................................................................................96 4.1 Linux 下cs8900a的驱动说明............................................................................................96 4.2 Linux 下 cs8900a的移植说明...........................................................................................96 4.2.1 为 cs8900a建立编译菜单..........................................................................................96 4.2.2 修改 S3C2410相关信息............................................................................................97 序 该文档的目的是总结我们在工作中的一些经验,并把它们分享给喜欢 ARM 和 Linux 的朋友, 如有错误 之处,请大家多多指点. 同样, 我们也希望更多人能把自己的工作经验和体会加入该文档,让大家共同进步. 该文档是一份交流性文档, 只供个人学习与交流,不允许公司和企业用于商业行为
下面是一个简单的示例程序,可以让GPIO引脚在高低电平间交替触发中断: ```c #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <sys/mman.h> #define GPIO_BASE_ADDR 0x3F200000 // 树莓派GPIO控制器的物理地址 #define BLOCK_SIZE 4096 // GPIO控制器寄存器的偏移地址 #define GPFSEL0 0x00 #define GPFSEL1 0x04 #define GPSET0 0x1c #define GPCLR0 0x28 #define GPLEV0 0x34 #define GPEDS0 0x40 #define GPREN0 0x4c #define GPFEN0 0x58 #define GPHEN0 0x64 #define GPLEN0 0x70 #define GPAREN0 0x7c #define GPAFEN0 0x88 volatile unsigned int *gpio; // 用于存储GPIO控制器寄存器的指针 // 初始化GPIO控制器 void gpio_init() { int fd = open("/dev/mem", O_RDWR | O_SYNC); if (fd < 0) { perror("open /dev/mem failed"); exit(-1); } gpio = (unsigned int *)mmap(NULL, BLOCK_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, GPIO_BASE_ADDR); if (gpio == MAP_FAILED) { perror("mmap failed"); exit(-1); } close(fd); } // 设置GPIO引脚为输入模式 void gpio_input(unsigned int pin) { unsigned int reg = pin / 10; unsigned int shift = (pin % 10) * 3; gpio[reg] &= ~(7 << shift); } // 设置GPIO引脚为输出模式 void gpio_output(unsigned int pin) { unsigned int reg = pin / 10; unsigned int shift = (pin % 10) * 3; gpio[reg] |= (1 << shift); } // 设置GPIO引脚为高电平 void gpio_high(unsigned int pin) { gpio[GPSET0 / 4] = 1 << pin; } // 设置GPIO引脚为低电平 void gpio_low(unsigned int pin) { gpio[GPCLR0 / 4] = 1 << pin; } // 读取GPIO引脚的电平值 int gpio_read(unsigned int pin) { return (gpio[GPLEV0 / 4] >> pin) & 1; } // 设置GPIO引脚触发中断的方式 void gpio_set_edge(unsigned int pin, unsigned int edge) { unsigned int reg = pin / 32; unsigned int shift = (pin % 32); gpio[reg == 0 ? GPREN0 / 4 : GPHEN0 / 4] = edge << shift; } // 清除GPIO引脚触发中断的标志位 void gpio_clear_event(unsigned int pin) { gpio[GPEDS0 / 4] = 1 << pin; } int main() { gpio_init(); gpio_input(17); // 设置GPIO17为输入模式 gpio_output(18); // 设置GPIO18为输出模式 gpio_set_edge(17, 0b10); // 设置GPIO17为上升沿触发中断 while (1) { if (gpio_read(17)) { gpio_high(18); // 如果GPIO17的电平为高,则设置GPIO18为高电平 } else { gpio_low(18); // 如果GPIO17的电平为低,则设置GPIO18为低电平 } gpio_clear_event(17); // 清除GPIO17的中断标志位 usleep(100000); // 等待100毫秒 } return 0; } ``` 在上面的程序中,我们使用了树莓派GPIO控制器的物理地址和寄存器偏移地址来控制GPIO引脚的输入输出和中断触发方式。具体来说,我们使用了 `mmap()` 函数将GPIO控制器的物理地址映射到用户空间,通过访问对应的寄存器地址来操作GPIO引脚。在 `main()` 函数中,我们不断地读取GPIO17的电平值,如果它为高电平,则设置GPIO18为高电平;如果它为低电平,则设置GPIO18为低电平。同时,我们还设置了GPIO17为上升沿触发中断的方式,并在每次循环结束时清除GPIO17的中断标志位。这样,当GPIO17的电平从低电平变为高电平时,就会触发中断,从而执行相应的中断处理函数。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值